使用reveal.js将标题幻灯片图像添加到RMarkdown幻灯片

jeb*_*nes 8 rstudio knitr r-markdown reveal.js

我正在尝试弄清楚如何使用reveal.js幻灯片在标题幻灯片中包含居中的背景图像,同时在RMarkdown和http://rmarkdown.rstudio.com/revealjs_presentation_format.html中书写

我的测试平台如下

---
title: "Attempt"
css: style.css
output: revealjs::revealjs_presentation
---

## Will this work

- Did the title slide have an image?
Run Code Online (Sandbox Code Playgroud)

style.cssas

.title {
    background-image: url(http://img1.wikia.nocookie.net/__cb20100706023807/familyguy/images/c/c7/Tauntaun.png);
    background-position: center center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    }
Run Code Online (Sandbox Code Playgroud)

注意,.title唯一能在标题幻灯片上显示任何图像的东西.我已经根据我在SO和其他地方看到的内容尝试了一些其他组合.

.section .reveal .state-background基于Rstudio 0.98.1028,仅将背景图像添加到标题幻灯片中

.title-slide基于使用slidify将图像添加到标题幻灯片

这些都不起作用.我错过了什么吗?也许我遗漏了一个神奇的YAML选项?

jeb*_*nes 5

好的,这是简单的答案。本质上,先制作一个空白标题,然后在标题幻灯片上放一个图像作为数据背景。您还可以在标题幻灯片上做任何您想做的事情。我使用div在幻灯片中间放置一个不错的大标题。

---
title: 
output: revealjs::revealjs_presentation
---

## {data-background="http://img1.wikia.nocookie.net/__cb20100706023807/familyguy/images/c/c7/Tauntaun.png"}
Run Code Online (Sandbox Code Playgroud)

  • 看起来有点像黑客。还有其他办法吗? (2认同)