I am having trouble getting the background color of code chunks to change when I knit to PDF. My understanding of the code chunk options is that setting the background
option should allow me to specify the background shading for code. However, it does not seem to work. MWE below. In the example I'm trying to set the background globally and locally. Neither seems to make a difference.
---
output:
pdf_document:
keep_tex: true
---
```{r}
knitr::opts_chunk$set(background = c(.1, 0, 0))
``
```{r cars-1}
summary(cars)
``
```{r cars-2, background=c(0,.1,0)}
summary(cars)
``
(Note that missing backticks in code chunks is deliberate and necessary to post on the site. My actual code has properly delimited chunks.)
The .tex file does not seem to do anything with the background options. From the .tex file, I see:
[LaTeX stuff]
\usepackage{framed}
\definecolor{shadecolor}{RGB}{248,248,248}
\newenvironment{Shaded}{\begin{snugshade}}{\end{snugshade}}
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{#1}}}
[more LaTeX stuff]
\begin{Shaded}
\begin{Highlighting}[]
\KeywordTok{summary}\NormalTok{(cars)}
\end{Highlighting}
\end{Shaded}
I'm using tinytex (which is fantastic!) on Ubuntu 18.04.