Problems with TeX or Sweave


RStudio cannot find TeX

RStudio uses the existence of pdflatex to verify that TeX is installed. If you are experiencing problems with RStudio detecting your installation of TeX, start a new support discussion and include the output of the following commands from RStudio console.

> Sys.which('pdflatex')

This may vary depending upon how you installed TeX (MiKTeX, Mac Ports, etc)

TeX or Sweave file does not compile

Remove spaces from path

TeX does not support paths with spaces. Make sure there are no spaces in your file name or your username.

Check the log

Check the log file located in the same directory as the .tex or .Rnw file (the file extension will be .log). This will help you discover errors in the script.

Test the R code

For Sweave documents, be sure your R code runs without errors before compiling your pdf. You can test your R code by using the Source button at the top right of the pane. If you are having trouble with your R code, the following Knowledge Base articles may help:

Test compiling the PDF outside of RStudio

Test your TeX or Sweave file outside of RStudio to ensure that it compiles correctly. Try opening a standard console session (RGui,, Terminal, etc) and ensure the pdf compiles correctly.

Return to Troubleshooting Guide: Using RStudio

Have more questions? Submit a request


Powered by Zendesk