- Mac Os: 10.11.6
- R version: 3.3.1
- MacTex: 2016 / TexLive: 6.2.2
- RMarkdown: 1.0.9014
- Knitr: 1.14
- Pandoc: 1.17
RMarkdown fails to knit PDF when latex commands such as:
\textcolor{blue}{Character String}
are present in the .rmd file. The error output is:
/usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template ~/R/3.3/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex --variable graphics=yes --variable 'geometry:margin=1in' ! Undefined control sequence. l.105 \textcolor
pandoc: Error producing PDF
Error: pandoc document conversion failed with error 43
Execution halted
Inclusion of an r code chunk with echo = TRUE such as:
```{r, echo = TRUE}
# I am a glitch
```
in the .rmd file allows for the successful creation of the PDF document.
If all r code chunks in the .rmd file are set with echo = FALSE or equivalent statements, the PDF file will not knit regardless of latex engine used if latex commands such as /textcolor are present. If only latex commands such as \begin{tabular}, many, etc… are used the error is not present.