rmarkdown:pandoc:找不到pdflatex [英] rmarkdown: pandoc: pdflatex not found
问题描述
当我在Mac上使用render {rmarkdown}从.Rmd文件生成pdf文件时,出现错误消息
When I use the render{rmarkdown} to produce pdf file from .Rmd file on my Mac, an error message says
pandoc: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed
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已安装在我的计算机中.
The pdflatex is installed in my machine.
任何人都可以帮助告诉我如何告诉R在哪里找到pdflatex吗?
Can anyone help to tell how can I tell R where to find the pdflatex?
非常感谢!
推荐答案
I found I was having issues with pdflatex
"missing" after I upgraded to OS X Mavericks (e.g. when checking package builds in RStudio I was getting an error tools::texi2pdf pdflatex missing
message).
-
检查是否存在
/usr/texbin
.
在终端中:
Check that
/usr/texbin
exists.
In terminal:
cd /usr/texbin
如果没有这样的文件或目录",那么您将需要创建指向安装的texbin的符号链接.我的在/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin
在终端中:
If "No such file or directory" then you will need to create a symbolic link to your installation's texbin. Mine was in /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin
In terminal:
ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin /usr/texbin
在终端中,检查echo $PATH
的结果.确保存在/usr/texbin
.如果不存在,则需要在PATH
变量中添加/usr/texbin
.
In terminal, check the result of echo $PATH
. Make sure that /usr/texbin
is present. If it isn't present, then you need to add /usr/texbin
to your PATH
variable.
如果发现自己必须弄乱PATH
变量,则可以安装最新版本的 MacTex 成为更好的解决方案.
If you find yourself having to mess with the PATH
variable, installing the latest version of MacTex might be a better solution.
更新:OS X 10.11 El Capitan不再允许对/usr
的写操作,因此最新版本的MacTeX(2015)现在在此系统上写了指向/Library/TeX/texbin
而不是/usr/texbin
的链接.
UPDATE: OS X 10.11 El Capitan no longer allows writes to /usr
so the latest version of MacTeX (2015) now writes a link to /Library/TeX/texbin
instead of /usr/texbin
on this system.
这篇关于rmarkdown:pandoc:找不到pdflatex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!