I'm running RStudio (0.98.1091) and Texworks MiKTeX (2.9 64 bit) on Windows 7.

My PATH environment variable is set and includes the complete path to the MiKTeX directory where pdflatex lives: "F:\Tools\MiKTeX 2.9\miktex\bin\x64". If I open a command shell I can see the PATH is set; I can also invoke pdflatex simply by typing in the command shell.

I can see my PATH variable with the correct path to the MiKTeX /bin folder if I open RStudio and type Sys.getenv("PATH") in the console.

However, when I run Rmarkdown in Rstudio it complains that there's no pdflatex available.

No TeX installation detected (TeX is required to create PDF output). You should install a recommended TeX distribution for your platform:

  Windows: MiKTeX (Complete) - http://miktex.org/2.9/setup
  (NOTE: Be sure to download the Complete rather than Basic installation)

Google searches bring back several questions like mine, except for MacOS, like this:


Is there any way for me to tell RStudio where MiKTeX is installed so I can generate PDFs?

  • 1
    This here support.rstudio.com/hc/communities/public/questions/… sounds as if you can use in Rstudio Sys.setenv(PATH = paste(Sys.getenv("PATH"), "p:\Git\bin", sep=.Platform$path.sep)) to add pathes. (But I don't have Rstudio so I can't say it. You could also try Sys.getenv("PATH" to find out, what value rstudio is using. Mar 6, 2015 at 8:06

2 Answers 2


Ulrike Fischer's comment is correct. In RStudio for Windows, I can do this:

Sys.setenv(PATH = paste(Sys.getenv("PATH"), "C:\\RMathew\\PortableApps\\MikTeX\\miktex\\bin", sep=.Platform$path.sep))

which will let me use pdfLaTeX for that session. If you want RStudio to remember this command each time you start RStudio, you have to add the command to your .Rprofile file.

Note the use of the double backslash for each folder.


If it still fails once you've set the environment PATH, I found that restarting the PC does the trick.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .