Knitting to PDF in R
Asked Answered
C

3

6

I am new to R and am trying to knit my R Markdown files into PDF format.

I continually get the error message:

pandoc: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed with error 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

I have downloaded pandoc, and I have also downloaded TexLive and have installed them both onto my computer. For the life of me I cannot figure out why R wont recognize that Ive installed them, and knit into a PDF.

Please help!

Cruet answered 4/2, 2015 at 21:0 Comment(1)
Is pdflatex in your path? Try running which pdflatex and echo $PATH and post the results.Kurt
M
7

For Mac OS X, if you have installed TexLive (I installed so through homebrew caskroom) you should have pdftex available via command line.

type 'which pdftex' to make sure something shows up. from there, i created a symbolic link into my $PATH, specifically into my /usr/local/bin (which is where all my homebrew stuff is stored) with:

ln -s /usr/texbin/pdftex /usr/local/bin/pdflatex

from there, using knitr in RStudio and R in general seemed to work and rendering R Markdown is definitely a really beautiful option (check some of the templates too like the Tufte one!)

Micrometry answered 3/9, 2015 at 18:26 Comment(0)
F
0

I had the same problem, after downloading mactex through FireFox and installing the package. I quit and restarted RStudio, and it worked (no changes at the terminal command line level). The .pdf output is, however, a bit blurry at least on my first attempt.

Festinate answered 11/5, 2017 at 16:19 Comment(0)
H
0

I had a similar issue as I wasn't able to knit pdf file & solved it by installing & running tinitex packages using those commands in the console -- not the terminal

install.packages("tinytex")

tinytex::install_tinytex()

Hentrich answered 11/2, 2020 at 20:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.