When an Rnw file Rnw converted to PDF using RStudio and knitr , the code blocks have a nice gray background color (for example, they are here in SO). When I convert the md file to PDF , the background color is white and I cannot change it. The knitr background option is for LaTeX only and has no effect in md .
How to set the background color for code blocks in a PDF that I get from my md file? I see in some related questions that editing the markdown.css file may be relevant, but I'm not sure if this is applicable here since there is no html file between the md and PDF files.
This effect can be reproduced using examples of knitr: Rnw source: knitr-minimal.Rnw and markdown source: 001-minimal.Rmd .
To convert Rnw to PDF , I just click the Compile PDF button in RStudio. Here is what I am doing to convert md to PDF :
# Load packages require(knitr) require(markdown) setwd("C:/Users/.../Desktop/")
Is there any other way to convert md to PDF so that I can get a colored code background?
source share