In RMarkdown is there a way to specify the font color?
There doesn\'t seem to be an option while browsing through the chunk options
I create a function like this:
#Color Format
colFmt = function(x,color){
outputFormat = knitr::opts_knit$get("rmarkdown.pandoc.to")
if(outputFormat == 'latex')
paste("\\textcolor{",color,"}{",x,"}",sep="")
else if(outputFormat == 'html')
paste("",x,"",sep="")
else
x
}
Then you can use it inline like this:`r colFmt("MY RED TEXT",'red')`
, and colored text will be rendered regardless of whether working on latex or HTML document.