尝试使用包文章中的模板编织 PDF 时 output: rticles::acm_article
我收到以下错误:
! LaTeX Error: Environment Shaded undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.76 \begin{Shaded}
这似乎只发生在我在输出文档中包含代码块时。
可重现的示例 :
您需要使用
New Document -> From Template -> Association for Computing Machinery
开始一个新的 R Markdown 文档。 .这是 R Markdown 文件:---
title: Short Paper
author:
- name: I Am Me
email: me@email.com
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))
```
但是,如果我设置
echo=FALSE
,则上面的示例有效在标题中。你不会在输出中得到代码,但是对于一篇学术论文,你可能无论如何都不需要它,如果你需要它,你可以以不同的方式显示它。笔记:
最佳答案
所以,这里的问题是 rticles
模板有时会省略 pandoc 注入(inject)代码突出显示环境的方法,例如Shaded
.要解决这个问题,您必须插入 template.tex
前言:
$if(highlighting-macros)$
$highlighting-macros$
$endif$
关于Rstudio pdf knit 失败并出现 "Environment Shaded undefined"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41052687/