RStudio cannot find TeX
The RStudio IDE uses the existence of pdflatex to verify that TeX is installed. If you are experiencing problems with RStudio detecting your installation of TeX, inspect the output of the following commands from the Console pane in the RStudio IDE.
> Sys.which('pdflatex')
The output will vary depending upon how you installed TeX (MiKTeX, Mac Ports, etc.), but if there is no output, please verify that you have installed TeX properly and that your system can access/launch it properly.
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, R.app, Terminal, etc) and ensure the pdf compiles correctly.
Ask for help on community.rstudio.com
You may also ask for help from R and RStudio users on community.rstudio.com. Be sure to include a reproducible example of your issue. To start a new community discussion, click here.
Return to Troubleshooting Guide: Using RStudio
Comments