rmarkdown: pandoc: pdflatex not found

后端 未结 7 1293
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 06:58

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.

相关标签:
7条回答
  • 2021-01-31 07:50

    This might help a bit, in case you don't have any Latex stuff installed yet.

    env: macOS Sierra

    1. from https://tex.stackexchange.com/questions/307483/setting-up-basictex-homebrew

    brew cask install basictex

    1. Now you need to figure out where pdflatex is hiding...

    (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 is what we need, you can't refer to the pdftex symlink and/or use realpath because pandoc specifically wants to see pdflatex

    1. update your command line to point to the appropriate file.

    pandoc myfile.md --to=pdf -t latex -o myfile.pdf --latex-engine=/Library/TeX/texbin/pdflatex

    0 讨论(0)
提交回复
热议问题