在xaringan中,我想在标题幻灯片中添加背景。 我已经按照Yihui's的说明进行了操作。
此方法有效,但我放弃了默认字体(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
---
其中my-theme.css
如下:
.title-slide {
background-image: url(Figures/MyBackground.jpg);
background-size: cover;
}
答案 0 :(得分:2)
我不建议您将default-fonts.css
添加到您的my-theme.css
中。如果要使用默认字体,可以使用
output:
xaringan::moon_reader:
css: [default, default-fonts, my-theme.css]
在R Markdown书的Section 7.5中查看更多信息。
答案 1 :(得分:0)
我想我已经解决了。我已经将字体调用添加到自定义css中。所以现在我的my-theme.css
如下:
.title-slide {
background-image: url(Figures/Suncor_2018_Background.jpg);
background-size: cover;
}
@import url(https://fonts.googleapis.com/css?family=Yanone+Kaffeesatz);
@import url(https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic);
@import url(https://fonts.googleapis.com/css?family=Source+Code+Pro:400,700);
body { font-family: 'Droid Serif', 'Palatino Linotype', 'Book Antiqua', Palatino, 'Microsoft YaHei', 'Songti SC', serif; }
h1, h2, h3 {
font-family: 'Yanone Kaffeesatz';
font-weight: normal;
}
.remark-code, .remark-inline-code { font-family: 'Source Code Pro', 'Lucida Console', Monaco, monospace; }
我在default-fonts.css
... \ library \ xaringan \ rmarkdown \ templates \ xaringan \ resources中找到了这个