How to export an .Rmd file to raw tex rather than pdf?

rmarkdown
latex

#1

Hi all,

I have a paper written in .Rmd but have to include it in a thesis with other papers written directly in Latex. When producing a .pdf, the .Rmd file is translated to .tex first, however that file is deleted upon successful compilation of the .pdf file.

My question is, how can I export the .Rmd file to .tex, rather than directly to .pdf?

Thanks!


#2

Hi there - this SO thread may be helpful.


#3
library(rmarkdown)
rmarkdown::render("document.Rmd", output_format = latex_document())

#4

Perfect, thanks a lot!