When trying to knit a PDF using a template from package rticles output: rticles::acm_article
I get the following error:
! LaTeX Error: Environment Shaded undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.76 \begin{Shaded}
This appears to only happen when I include code chunks within the output document.
Reproducible example:
You will need to start a new R Markdown document using the New Document -> From Template -> Association for Computing Machinery
. Here is the R Markdown file:
---
title: Short Paper
author:
- name: I Am Me
email: [email protected]
affiliation: Fictional University
abstract: |
This is the abstract.
It consists of two paragraphs.
output:
rticles::acm_article:
keep_tex: true
---
## Simple test
Code chuck follows:
```{r}
plot(rnorm(10))
```
This above example, however, works if I set echo=FALSE
in the header. You won't get code in the output, but for an academic paper you probably don't need it anyway, an if you do you can display it in a different manner.
Notes:
So, the issue here is the rticles
templates sometimes omit a means for pandoc to inject code highlighting environments, e.g. Shaded
. To get around this, you would have to insert into the template.tex
preamble:
$if(highlighting-macros)$
$highlighting-macros$
$endif$