rmarkdown:找不到pandoc:pdflatex

当我使用渲染{rmarkdown}从Mac上的.Rmd文件生成pdf文件时,出现错误消息

pandoc: pdflatex not found. pdflatex is needed for pdf output. Error: pandoc document conversion failed

但是,当我检查

 pdflatex -v 

我有

 pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012) kpathsea version 6.1.0 Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Compiled with libpng 1.5.10; using libpng 1.5.10 Compiled with zlib 1.2.7; using zlib 1.2.7 Compiled with xpdf version 3.03 

pdflatex安装在我的机器上。

谁能告诉我如何告诉R在哪里可以findpdflatex?

非常感谢!

TexExchange上的这个答案可能会有所帮助 。

我发现我升级到OS X Mavericks后,出现pdflatex “missing”的问题(例如,在RStudio中检查软件包版本时,我收到了error tools::texi2pdf pdflatex missing消息)。

  1. 检查/usr/texbin存在。
    在docker:

     cd /usr/texbin 
  2. 如果“没有这样的文件或目录”,那么你将需要创build一个符号链接到你的安装的texbin。 我在/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin
    在docker:

     ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin /usr/texbin 
  3. 在terminal中,检查echo $PATH的结果。 确保/usr/texbin存在。 如果不存在,则需要将/usr/texbin添加到PATHvariables中。

如果您发现自己不得不弄乱PATHvariables,那么安装最新版本的MacTex可能是更好的解决scheme。

更新: OS X 10.11 El Capitan不再允许写入/usr因此最新版本的MacTeX(2015)现在在此系统上写入到/Library/TeX/texbin而不是/usr/texbin

对于使用Ubuntu的人来说,这里有一个更好的select(因为它是1/5的大小)是使用:

 sudo apt-get install texlive-latex-base 

我通过https://tex.stackexchange.com/a/128309find了;

对于那些使用Dunk的答案(对于使用UBUNTU的人), Font <font> at <size> not loadable: Metric (TFM) file not found.Font <font> at <size> not loadable: Metric (TFM) file not found. 错误,您还需要:

 sudo apt-get install texlive-fonts-recommended texlive-latex-recommended 

这不幸的扩大了texlive安装的大小,但它仍然是texlive-latex-extra安装的一半大小。

对于那些因为在Linux发行版中出现同样的错误而滞留在这里的人。 通过安装在Ubuntu中获取pdflatex

 sudo apt-get install texlive-latex-extra 

它太多的软件,但需要例如knitr(rmarkdown-pdf-compilation)