I downloaded bookdown-chinese at Bookdown Chinese demo and removed all the .Rmd
files except index.Rmd
. When I built the book, why some R codes have to be included in index.Rmd
,.
```{r}
sessionInfo()
```
otherwise some errors would be prompted
! 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.
in fact I edited a book without block R codes, and found I have to keep those R codes or changed any others R codes in index.Rmd
in order build the book.
Chunk Optionsinclude = FALSE prevents code and results from appearing in the finished file. R Markdown still runs the code in the chunk, and the results can be used by other chunks. echo = FALSE prevents code, but not the results from appearing in the finished file.
You can insert an R code chunk either using the RStudio toolbar (the Insert button) or the keyboard shortcut Ctrl + Alt + I ( Cmd + Option + I on macOS).
Inline R code is embedded in the narratives of the document using the syntax `r ` . In the above example, we defined a variable x in a code chunk, which is the radius of a circle, and calculated its area in the next paragraph.
The LaTeX command that is causing this error comes from preamble.tex
and is defined in the LaTeX package fancyvrb
. In template.tex
we see that fancyvrb
is included only conditionally. And indeed, in bookdown.tex
that is present when this error is produced, fancyvrb
is not loaded.
If you are sure that you will not need R chunks in the future, you can simply remove the offending line from preamble.tex
. If you might use R chunks in the future, have a look at this PR.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With