How to change font color in R Markdown Powerpoint
I am using R Markdown
to create a PowerPoint presentation and would like to change the font color in one of the slides. I am wondering if that's possible? It applies to only one slide so can't change in PowerPoint template. All the solutions I have found so far seem to be for HTML
and PDF
documents only.
- CSS for html document
---
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>
- LaTex for pdf
---
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.}
You can do it using {officedown} an {officer} packages as suggested in chapter 8.3 of Rmarkdown Cook book.
1- Use the officedown::rpptx_document
document output
2- Load officedown
and officer
packages
3- create the style to apply to the individual element in a chunk with fp_text()
4- Apply the style with in line code
---
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)`.