Is it possible to use the knitr2pdf () function directly with R Markdown (Rmd) files? I have seen various textbooks / class notes, which apparently suggest that it could be, for example, here and here (Ctrl + F "knit2pdf").
But when I take a simple rmd file (saved as "test.rmd")
--- title: "knit2pdf test" author: "A Aaronson" date: "Thursday, February 19, 2015" output: pdf_document --- This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http:
and try
library(knitr) knit2pdf("test.Rmd")
I get the following error
leads to:
output file: test.md Error: running 'texi2dvi' on 'test.md' failed LaTeX errors: ! Emergency stop *** (job aborted, no legal \end found) ! ==> Fatal error occurred, no output PDF file produced! ! ==> Fatal error occurred, no output PDF file produced! In addition: Warning message: running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\texi2dvi.exe" --quiet --pdf "test.md" --max-iterations=20 -I "C:/PROGRA~1/R/R-31~1.2/share/texmf/tex/latex" -I "C:/PROGRA~1/R/R-31~1.2/share/texmf/bibtex/bst"' had status 1
Clicking the Knit PDF button always successfully creates a PDF file. So, did I skip the intermediate step?
I have to add that knit2pdf () with Rnw files works as expected for me, although I still get a warning
running command '"C:\PROGRA~2\MIKTEX~1.9\miktex\bin\texi2dvi.exe" --quiet --pdf "rnwtest.tex" --max-iterations=20 -I "C:/PROGRA~1/R/R-31~1.2/share/texmf/tex/latex" -I "C:/PROGRA~1/R/R-31~1.2/share/texmf/bibtex/bst"' had status 1
Help with thanks.
r knitr r-markdown
peter_w
source share