How to color specitic text in rmarkdown word?

I would to color the number with red

title: "officedown template"
output: officedown::rdocx_document
  ```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, fig.cap = TRUE)

ft <- fp_text(color = "red", underlined = TRUE)

This document presents most of the features of the package `r ftext("officedown", ft)`. 

`r paste0("This document presents most of the features of the package", ftext(1:5, ft))`. 

You can always use elements of the knitr package:


Or, if if you need to color a variable:

\textcolor{color}{`r var`}

Hope this helps!

I would to produce word file not pdf

Ah got it. In that case, this resource may be beneficial for you. I'll be the first to admit that I have no experience using R in the creation of docx files

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.