R Sweave: NO TeX installation detected

Usually Rstudio finds the correct path to your Latex installation automatically. In your case that doesn’t seem to be the case. After making sure Miktex is installed correctly (have you opened it and compiled a simple file?) you can set the pdflatex path manually:

Sys.setenv(PATH = paste(Sys.getenv("PATH"), "C:\\Program Files\\MiKTeX 2.9\\miktex\\bin\\x64", sep=.Platform$path.sep))

This is the path to my pdflatex.exe file, yours might live somewhere else.

You will have to run this every time you restart RStudio. Adding the path to pdflatex.exe to your PATH variable in Windows should make this permanent but I haven’t tested that. Go to System Properties, click on Environment Variables, then on Path and then Edit. Then just enter the path to your pdflatex.exe:

Leave a Comment