Goal
In an R/Markdown document that I want to convert to LaTeX I want to set knitr options so that the entire document uses plain code chunks for all code inputs by default. Thus, for a .Rmd document with
```{r}
x <- 1 + 1
```
I want to obtain the output
```
x <- 1 + 1
```
Using the highlight option
I had hoped that the highlight=FALSE option could be used for this but this generates text-chunks rather than plain chunks. More precisely, for the simple example above, knit() produces an R-chunk by default (i.e., with highlight = TRUE):
```r
x <- 1 + 1
```
After setting knitr::opts_chunk$set(highlight = FALSE) a text-chunk is produced:
```text
x <- 1 + 1
```
But what I would like to have a plain chunk without any special language, see above.
Combination with lang option
I can obtain what I want via
knitr::opts_chunk$set(highlight = TRUE, lang = "")
Thus, I do enable highlighting but set the lang to an empty string. This indeed yields the plain code I want to have.
There is at least one disadvantage, though (apart from the rather hacky feel of this solution). Namely, if in the same document I do want to enable highlighting in the options of one specific chunk, I have to set lang = "r" now instead of highlight = TRUE, e.g.,
```{r, lang="r"}
x <- 1 + 1
```
So I wonder whether there is a better solution for this?
Background
In older versions of pandoc (I tried 2.9.x) text-chunks were converted to {verbatim} code chunks in LaTeX output.
However, more recent versions of pandoc (I tried 2.17.x) text-chunks are converted to {Shaded} instead and only plain chunks are converted to {verbatim}.