I am trying to change the colour of a font in RMarkdown. I would like to be able to highlight in the document when i use a package. For example this seems to work for simple colours $\color{blue}{\text{readxl}}$ but I would like to set it up in such a way that the colour can use an RGB code for maybe something like steel blue (#003766). Using my previous method causes my document to crash with an unrecognizable colour error
! Illegal parameter number in definition of .
0
l.140 ...reation of this section (\color{#003766}
{\text{knitr}}), (\color...
My second question if someone has the time is to be able to format the colour behind the text, highlighting it like an inline code chunk for example library(rstudio).In essence i want to be able to highlight any packages I use in my analysis
I found a way to do it for PDF, using LaTeX commands:
---
title: "RCommunityForum"
author: "PJ"
date: "13/07/2019"
output:
word_document: default
pdf_document:
extra_dependencies: xcolor
html_document:
df_print: paged
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
\```
## R Markdown
\definecolor{fancyTextColor}{HTML}{4284f5}
\definecolor{hightlightColor}{HTML}{FFFF66}
This is an R Markdown document. \colorbox{hightlightColor}{Markdown} is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button \textcolor{fancyTextColor}{a document will be generated} that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars}
summary(cars)
\```
* Careful if you copy paste this in markdown since I had to use \ to format the code as it uses ``` as well