r - 如何在 R Markdown Powerpoint 中更改字体颜色
问题描述
我正在使用R Markdown
创建 PowerPoint 演示文稿并想更改其中一张幻灯片中的字体颜色。我想知道这是否可能?它仅适用于一张幻灯片,因此不能在 PowerPoint 模板中更改。到目前为止,我发现的所有解决方案似乎都仅适用于HTML
和PDF
文档。
- 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.}
解决方案
您可以按照 Rmarkdown Cook book 的第 8.3 章中的建议使用 {officedown} 和 {officer} 包来完成。
1-使用officedown::rpptx_document
文档输出
2- 装载officedown
和officer
包装
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)`.
推荐阅读
- configuration - 无法通过 LuCI 或 SSH 访问 OpenWrt
- javascript - 检查是否所有必填字段都填写在特定的 div 中
- java - spring mvc中不同的@ModelAttribute
- android - 如何将我的 XML 文件保存到特定文件夹?
- reactjs - 如何在 React Hooks 中使用 Antd 进行搜索
- amazon-web-services - Glue 是否需要安全配置才能从加密存储桶运行 Athena 查询?
- php - 存储来自多个输入字段的数组值 - Laravel
- .htaccess - htaccess - 重定向所有 PDF 文件,不包括指定文件夹中的 PDF
- android - Android导航组件从homefragment关闭应用程序
- ms-access - 在交叉表查询中按地名 ID 对列和行进行排序