Code
```{r, eval=TRUE}
library(caret)
plot(iris$Sepal.Length)
```
Error reported
pandoc.exe: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 41 In addition: Warning message: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS t4.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output t4.pdf --template "C:\\Users\\15235330\\Documents\\R\\R-3.3.0\\library\\rmarkdown\\rmd\\latex\\default-1.15.2.tex" --highlight-style tango --latex-engine pdflatex --variable graphics=yes --variable "geometry:margin=1in"' had status 41 Execution halted 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) Mac OS X: TexLive 2013 (Full) - http://tug.org/mactex/ (NOTE: Download with Safari rather than Chrome _strongly_ recommended) Linux: Use system package manager
After getting a new computer, I found this post I wrote a year ago, and the technique I documented below still worked. However my original instructions were not clear, and I have updated to hopefully help others having the same challenge. Of course, YMMV.
I spent hours trying to resolve this. I installed Miktex, but was unable to get the packages directly from the package manager due to sitting behind a firewall at work. I finally was able to resolve this using the following steps:
Go to the CTAN package archive and download the following .tar.lzma files:
After downloading the above files, move the above .tar.lzma files to the folder you created, eg "C:\\miktex_pkgs"
Now you should be able to knit as PDF.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.