ask*_*ing 54 macos r pdflatex pandoc r-markdown
当我使用render {rmarkdown}从我的Mac上的.Rmd文件生成pdf文件时,会显示一条错误消息
pandoc: pdflatex not found. pdflatex is needed for pdf output.
Error: pandoc document conversion failed
但是当我检查时
pdflatex -v
Run Code Online (Sandbox Code Playgroud)
我有
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
Run Code Online (Sandbox Code Playgroud)
pdflatex安装在我的机器上.
任何人都可以帮忙告诉我如何告诉R在哪里找到pdflatex?
非常感谢!
Dun*_*unk 37
对于使用ubuntu的人来说,这里有一个更好的选择(因为它的大小是1/5)是使用:
sudo apt-get install texlive-latex-base
Run Code Online (Sandbox Code Playgroud)
我通过https://tex.stackexchange.com/a/128309找到了
Eri*_*ric 31
我pdflatex
在升级到OS X Mavericks之后发现我遇到了"丢失"的问题(例如,在检查RStudio中的包构建时,我收到了error tools::texi2pdf pdflatex missing
一条消息).
检查是否/usr/texbin
存在.
在终端:
cd /usr/texbin
Run Code Online (Sandbox Code Playgroud)如果"没有这样的文件或目录",那么您将需要创建一个指向您的安装的texbin的符号链接.我在/Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin
In终端:
ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin /usr/texbin
Run Code Online (Sandbox Code Playgroud)在终端中,检查结果echo $PATH
.确保它/usr/texbin
存在.如果它不存在,那么您需要添加/usr/texbin
到您的PATH
变量.
如果您发现自己不得不弄乱PATH
变量,安装最新版本的MacTex可能是一个更好的解决方案.
更新: OS X 10.11 El Capitan不再允许写入,/usr
因此最新版本的MacTeX(2015)现在写入链接/Library/TeX/texbin
而不是/usr/texbin
此系统.
Nig*_*000 17
对于那些使用Dunk的答案(对于使用UBUNTU的人),如果出现Font <font> at <size> not loadable: Metric (TFM) file not found.
错误,您还需要:
sudo apt-get install texlive-fonts-recommended texlive-latex-recommended
Run Code Online (Sandbox Code Playgroud)
不幸的是,这大大扩展了texlive安装的大小,但它仍然只是texlive-latex-extra
安装大小的一半.
对于那些被困在这里的人,因为他们的Linux发行版中出现了同样的错误.通过安装在Ubuntu中获取pdflatex
sudo apt-get install texlive-latex-extra
Run Code Online (Sandbox Code Playgroud)
它太多的软件,但需要例如knitr(rmarkdown-pdf-compilation)
如果您尚未安装任何Latex东西,这可能会有所帮助。
env:macOS Sierra
brew cask install basictex
(env) jluc@texbin$ pwd
/Library/TeX/texbin
(env) jluc@texbin$ ls | grep pdfla
lrwxr-xr-x 1 user wheel 6 13 Mar 10:36 pdflatex -> pdftex
(env) jluc@texbin$ ls /Library/TeX/texbin/pdflatex
lrwxr-xr-x 1 user wheel 6 13 Mar 10:36 /Library/TeX/texbin/pdflatex -> pdftex
/ Library / TeX / texbin / pdflatex是我们所需要的,您不能引用pdftex符号链接和/或使用,realpath
因为pandoc
特别想看pdflatex
pandoc myfile.md --to=pdf -t latex -o myfile.pdf --latex-engine=/Library/TeX/texbin/pdflatex
小智 5
截至 2020 年(MacOS Catalina),JL Peyret 的回答是最适用的。它应该稍微更新一下,因为--latex-engine
pandoc 中的选项已被弃用而支持新--pdf-engine
选项:
$ brew install --cask basictex
$ pandoc myfile.md --to=pdf -t latex -o myfile.pdf --pdf-engine=/Library/TeX/texbin/pdflatex
Run Code Online (Sandbox Code Playgroud)