Another reproducible error with pander (+ knitr): When I try to pander a list, I cannot create a PDF File - it seems to occur when a table or data.frame is put inside the list. If only vectors are in the list, the PDF compiles but looks ugly.
I use pander 0.5.1, knitr 1.7, R version 3.1.1, Miktex + RStudio on Windows.
Doesn't work:
```{r, eval=FALSE}
pander(list(cor=cor(cars) ) )
```
Error:
output file: Preview-e905ccd5f1a.knit.md
! Undefined control sequence.
l.246 \textbf{cars}: {[}1{]} ``\n
pandoc.exe: Error producing PDF from TeX source
Fehler: pandoc document conversion failed with error 43
Zus�tzlich: Warnmeldung:
Ausf�hrung von Kommando '"C:/Program Files/RStudio/bin/pandoc/pandoc" Preview-e905ccd5f1a.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output Preview-e905ccd5f1a.pdf --template "C:\Users\jbothe\Documents\R\win-library\3.1\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' ergab Status 43
Ausf�hrung angehalten
It compiles when I use pander in the console and manually copy and paste it:
* **cor**:
--------------------------
speed dist
----------- ------- ------
**speed** 1 0.8069
**dist** 0.8069 1
--------------------------
The same error occurs when trying to put cars in the list:
```{r, eval=TRUE}
pander(list(cars=cars ) )
```
If I put Vectors into the list, it works, but the output looks ugly, since attributes are parsed as well:
{r}
pander(list(a=c(1,2,3),b=c('A','b') ) )
PDF-Output:
• a: [1] “1, 2 and 3” attr(,“class”) [1] “knit_asis” attr(,“knit_cacheable”) [1] TRUE
• b: [1] “A and b” attr(,“class”) [1] “knit_asis” attr(,“knit_cacheable”) [1] TRUE
I found a workaround, disabling the knitr.auto.asis option in pander and manually setting results='asis' in knitr. But I still think this should be considered a bug?!?
## Workaround with asis
```{r results='asis'}
panderOptions('knitr.auto.asis', FALSE)
pander(list(a=c(1,2,3),b=c('A','b') ) )
```
```{r, results='asis'}
panderOptions('knitr.auto.asis', FALSE)
pander(list(cor=cor(cars) ) )
```
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