【问题标题】:Change caption font size in Reveal JS R Markdown在 Reveal JS R Markdown 中更改标题字体大小
【发布时间】:2017-08-24 11:35:17
【问题描述】:

我是使用 R 包revealjs 使用 Reveal JS 和 R Markdown 创建演示文稿的新手,但我一直不知道如何减小标题字体大小。

我看到了这个答案: Changing the font size of figure captions in RMarkdown HTML output

还检查了: http://rmarkdown.rstudio.com/revealjs_presentation_format.html#custom_css

但不幸的是,我似乎遗漏了一些东西,而且它似乎不起作用! 任何人都可以提供任何帮助将不胜感激:)

这是我的 R Markdown:

    ---
title: "Cars"
author: "Me"
date: "24 August 2017"
output:
  revealjs::revealjs_presentation:
    fig_caption: yes

---

<style>

.reveal section p.caption {
  font-size: 0.2em;
}

</style>

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```

```{r,echo = FALSE, warning = FALSE,message=FALSE, fig.cap= "Cars"}

library(ggplot2)
data(mtcars)
g <- ggplot(mpg, aes(class))
g <- g + geom_bar()

print(g)

```

【问题讨论】:

    标签: html css r


    【解决方案1】:

    所以事实证明我需要一个额外的 css 文件。 我在工作目录中保存了一个名为 custom_css.css 的 css 文件。 这是css代码:

    .reveal section figcaption {
      font-size: 0.3em;
    }
    

    然后,在我的 RMarkdown 文件中,编写的代码是:

    ---
    title: "Cars"
    author: "Me"
    date: "24 August 2017"
    output:
      revealjs::revealjs_presentation:
        css: custom_css.css
        fig_caption: yes
    
    
    ---
    
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE)
    ```
    
    ```{r,echo = FALSE, warning = FALSE,message=FALSE, fig.cap= "Cars"}
    
    library(ggplot2)
    data(mtcars)
    g <- ggplot(mpg, aes(class))
    g <- g + geom_bar()
    
    print(g)
    
    ```
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-05-30
      • 1970-01-01
      • 2022-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-15
      相关资源
      最近更新 更多