【问题标题】:How to change font color in R Markdown Powerpoint如何在 R Markdown Powerpoint 中更改字体颜色
【发布时间】:2020-07-10 17:20:20
【问题描述】:

我正在使用R Markdown 创建一个 PowerPoint 演示文稿,并想更改其中一张幻灯片的字体颜色。我想知道这是否可能?它仅适用于一张幻灯片,因此不能在 PowerPoint 模板中更改。到目前为止,我发现的所有解决方案似乎都仅适用于 HTMLPDF 文档。

  • html 文档的 CSS
---
title: "Example"
author: ""
date: "09/07/2020"
output:
  powerpoint_presentation
---


## R Markdown

<span style="color: red;">
This is an R Markdown presentation. 
I would like this text in red.
</span>


  • 用于 pdf 的 LaTex
---
title: "Example"
author: ""
date: "09/07/2020"
output:
  powerpoint_presentation
---


## R Markdown

\textcolor{red}{
This is an R Markdown presentation. 
I would like this text in red.}

【问题讨论】:

    标签: r markdown powerpoint


    【解决方案1】:

    您可以按照chapter 8.3 of Rmarkdown Cook book. 中的建议使用 {officedown} 和 {officer} 软件包来完成此操作

    1- 使用officedown::rpptx_document 文档输出

    2- 加载 officedownofficer

    3- 使用fp_text()创建应用于块中单个元素的样式

    4- 使用行内代码应用样式

    ---
    title: Style text with officedown
    output:
      officedown::rpptx_document: default
    ---
    
    `` `{r setup, include=FALSE}
    
    knitr::opts_chunk$set(echo = FALSE)
    
    library(officedown)
    library(officer)
    
    ft <- fp_text(color = 'red', bold = TRUE)
    `` `
    
    ## R Markdown
    
    This is an R Markdown presentation. 
    `r ftext("I would like this text in red", ft)`.
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-01-10
      • 1970-01-01
      • 1970-01-01
      • 2017-05-23
      • 2016-04-03
      • 2019-11-23
      • 2020-06-15
      相关资源
      最近更新 更多