5

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:

Sys.which("pdflatex")
pdflatex 
  "" 

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

4
  • Welcome to TeX SX! Why didn't you install it in the default C\Program Files?
    – Bernard
    Commented 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
    Commented Oct 26, 2017 at 19:13
  • The bin folder is in C:Program Files\MiKTeX 2.9\miktex\bin
    – Bernard
    Commented Oct 26, 2017 at 19:36
  • Did you install it? miktex.org/howto/install-miktex
    – nebi
    Commented Oct 27, 2017 at 9:34

1 Answer 1

2

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

You must log in to answer this question.

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