【问题标题】:Xaringan Title SlideXaringan 标题幻灯片
【发布时间】:2019-01-18 10:55:58
【问题描述】:

在 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;
}

【问题讨论】:

    标签: css r xaringan


    【解决方案1】:

    我不建议您将default-fonts.css 添加到您的my-theme.css。如果你想要默认字体,你可以使用

    output:
      xaringan::moon_reader:
        css: [default, default-fonts, my-theme.css]
    

    在 R Markdown 书籍的Section 7.5 中查看更多信息。

    【讨论】:

      【解决方案2】:

      我想我已经弄清楚了。我已将字体调用添加到自定义 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 中找到了这个

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-12-09
        • 2020-02-11
        • 2020-02-03
        • 2019-03-18
        • 1970-01-01
        • 2022-11-23
        • 1970-01-01
        • 2018-03-12
        相关资源
        最近更新 更多