为什么有些R代码必须包含在Bookdown的index.Rmd中?

Min*_*Han 5 markdown r r-markdown

我在Bookdown中文演示中下载了bookdown-chinese 并删除了所有.Rmd文件,除了index.Rmd.当我构建这本书时,为什么必须包含一些R代码index.Rmd,.

```{r}
 sessionInfo()
```
Run Code Online (Sandbox Code Playgroud)

否则会提示一些错误

! Undefined control sequence.
l.105 \RecustomVerbatimEnvironment
                              {Highlighting}{Verbatim}{commandchars=\\\{...

Error: Failed to compile bookdown.tex. See bookdown.log for more info.
Please delete bookdown.Rmd after you finish debugging the error.
Execution halted

Exited with status 1.
Run Code Online (Sandbox Code Playgroud)

事实上我编辑了一本没有块R代码的书,发现我必须保留这些R代码或改变其他R代码index.Rmd才能构建这本书.

Ral*_*ner 6

导致此错误的乳胶命令来preamble.tex和在乳胶包被定义fancyvrb.在template.tex我们看到,fancyvrb仅包括有条件地.事实上,在bookdown.tex产生此错误时存在,fancyvrb不会加载.

如果你确定将来不需要R块,你可以简单地删除违规行preamble.tex.如果您将来可能会使用R块,请查看此PR.