I am using knitr in RStudio and I am looking for an explanation for an odd error when creating a document from an rmarkdown file. As in example, I have a file, pdf-test.Rmd:
---
title: "PDF knit error"
output: pdf_document
---
##Headers
> ###Quote 1
This results in an error; if the blockquote symbol ('>') in
preceeding line is removed, no error
> ###Quote 2
This line is fine
When I try to create a pdf using the Knit PDF button, this is the output:
|.................................................................| 100% ordinary text without R code processing file: pdf-test.Rmd output file: pdf-test.knit.md /usr/bin/pandoc +RTS -K512m -RTS pdf-test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pdf-test.pdf --template /home/jcoliver/R/x86_64-pc-linux-gnu-library/3.3/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in' ! LaTeX Error: Something's wrong--perhaps a missing \item. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... l.94 \end{quote} pandoc: Error producing PDF Error: pandoc document conversion failed with error 43 Execution halted
As mentioned above, removing the block quote character (>
) from the first instance makes the error go away (although so does the desired formatting).
---
title: "PDF knit error"
output: pdf_document
---
##Headers
###Quote 1
No error here
> ###Quote 2
This line remains fine
And there are no complaints from pandoc/LaTeX:
|.................................................................| 100% ordinary text without R code /usr/bin/pandoc +RTS -K512m -RTS pdf-test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pdf-test.pdf --template /home/jcoliver/R/x86_64-pc-linux-gnu-library/3.3/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable 'geometry:margin=1in' processing file: pdf-test.Rmd output file: pdf-test.knit.md Output created: pdf-test.pdf
I can also avoid the error by changing the header level of the block quote to H4 or higher (H5, H6, etc.), while changing the header level of the first block quote to H1 or H2 still results in an error.
So why is this error occurring? Why can I not have a block quote with H3 immediately following a header? Note that I have tried different header levels on the header line(#Headers
, ##Headers
, ###Headers
), varying spacing following the ##Headers
line, and a different output format (i.e. HTML), but the error always occurred.
A few system details:
- Ubuntu 16.04
- pandoc 1.17.2 (error also occurred with 1.16.0.2)
- R 3.3.1
- RStudio 0.99.489