Text coloring
To add color you can use CSS or R code like this:
<- function(x, color){
color_text if(knitr::is_latex_output())
paste("\\textcolor{",color,"}{",x,"}",sep="")
else if(knitr::is_html_output())
paste("<font color='",color,"'>",x,"</font>",sep="")
else
x
}
<- function(x){
red if(knitr::is_latex_output())
paste("\\textcolor{",'red',"}{",x,"}",sep="")
else if(knitr::is_html_output())
paste("<font color='red'>",x,"</font>",sep="")
else
x }
The strng This is colored with the red function comes from:
`r red("This is colored with the red function")`
The string This is colored with the color_text function set to mauve comes from:
`r color_text("This is colored with the color_text function set to mauve", "#E0B0FF")`