Can I use Rstudio to translate .Rmd to LaTeX directly without pandoc?

Playable example (if you have rstudio):

  • File | New | R markdown
  • Knitting in html, saving as test :

knitr

Go to the working directory

  • In the terminal (with pandoc installed) enter

    pandoc -s test.md -t latex -o test.tex

(results are inserted here )

  • Convert to pdf using pdflatex (see result here )

Or skip the tex step by going directly to .pdf:

 pandoc -s test.md -t latex -o test2.pdf 

The results are good, but there seem to be many steps, given that knitr includes sweave. It should be able to directly convert from .Rmd to .tex or .pdf. Right?

+6
source share
1 answer

This is described at http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering ; you must add .Rprofile to your directory, for example:

 options(rstudio.markdownToHTML = function(inputFile, outputFile) { system(paste("pandoc", shQuote(inputFile), "-o", shQuote(outputFile))) } ) 

Some changes may be required. Too bad the same does not work with spin due to an error in RStudio.

http://support.rstudio.org/help/discussions/problems/4128-spin-and-rprofile

+11
source

All Articles