# RStudio Can't Find pdflatex On Windows 7

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
``````

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

https://support.rstudio.com/hc/communities/public/questions/203561546-RStudio-can-t-detect-pdflatex-No-Tex-installation-detected-

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

• 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

``````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.