在 xaringan 中,我想在标题幻灯片中添加背景。我已经按照一辉的指示做到了。
这有效,除了我松开了默认字体 (Yanone Kaffeesatz)。
YAML:
---
title: "My title"
subtitle: "My subtitle"
author: "Me Myself"
date: "01/01/2012"
output:
xaringan::moon_reader:
css: my-theme.css
lib_dir: libs
nature:
ratio: '16:9'
highlightStyle: github
highlightLines: true
countIncrementalSlides: false
---
Run Code Online (Sandbox Code Playgroud)
其中my-theme.css如下:
.title-slide {
background-image: url(Figures/MyBackground.jpg);
background-size: cover;
}
Run Code Online (Sandbox Code Playgroud)
我不建议你添加default-fonts.css到你的my-theme.css. 如果你想要默认字体,你可以使用
output:
xaringan::moon_reader:
css: [default, default-fonts, my-theme.css]
Run Code Online (Sandbox Code Playgroud)
在 R Markdown 书的第 7.5 节中查看更多信息。