I am trying to exporty a pdf file from the R output using R markdown. I donwnloaded the MikTex, but when I tried to run the R markdown, it showed this error message:

pandoc.exe: pdflatex not found. pdflatex is needed for pdf output.

When I typed sessionInfo() in R, I got this:

R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

It seems that R could not find the location of the downloaded latex:


Not sure if there is something wrong with downloading the MikTex, the location of the downloaded MikTex in my computer is:

"C:\Users\username\Desktop\MiKTeX Download Files"

And I reset the path in R, but still showed the same error:

Sys.setenv(PATH = paste(Sys.getenv("PATH"), "C:\\Users\\username\\Desktop\\MikTeX Download Files\\miktex\\bin", sep=.Platform$path.sep))

I know the issue might be related to path setting, but not sure what exactly to do to solve this. Any ideas? Thanks!!

  • Welcome to TeX SX! Why didn't you install it in the default C\Program Files?
    – Bernard
    Oct 26, 2017 at 19:10
  • Thanks! I tried that but still could not work. After I finish downloading, there are many pieces of packages, and I could not find a folder called bin. strange...
    – mandy
    Oct 26, 2017 at 19:13
  • The bin folder is in C:Program Files\MiKTeX 2.9\miktex\bin
    – Bernard
    Oct 26, 2017 at 19:36
  • Did you install it? miktex.org/howto/install-miktex
    – nebi
    Oct 27, 2017 at 9:34

1 Answer 1


I resolved the issue, it turns out that after I complete downloading, I should open the installer again and click on install MikTeX. I thought I just need to use that wizard once. I found a detailed solution here: installation issue

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.