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

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!

Hi there - this SO thread may be helpful.

1 Like
library(rmarkdown)
rmarkdown::render("document.Rmd", output_format = latex_document())
4 Likes

Perfect, thanks a lot!