rmarkdown: pandoc: pdflatex not found

后端 未结 7 1292
没有蜡笔的小新
没有蜡笔的小新 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:38

    For people that get stranded here because the same error is showing up in their Linux distribution. Get pdflatex in e.g. Ubuntu by installing

    sudo apt-get install texlive-latex-extra
    

    its too much software, but needed for example by knitr (rmarkdown-pdf-compilation)

    0 讨论(0)
  • 2021-01-31 07:39

    As of 2020 (MacOS Catalina) JL Peyret's answer is the most applicable. It should be slightly updated, since the --latex-engine option in pandoc has been deprecated in favor of the new --pdf-engine option:

    $ brew cask install basictex
    $ pandoc myfile.md --to=pdf -t latex -o myfile.pdf --pdf-engine=/Library/TeX/texbin/pdflatex
    
    0 讨论(0)
  • 2021-01-31 07:40

    For people using ubuntu who get stranded here a better option (because it is 1/5 the size) is to use:

    sudo apt-get install texlive-latex-base
    

    Which I found via https://tex.stackexchange.com/a/128309

    0 讨论(0)
  • 2021-01-31 07:41

    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

    enter code here
    

    install.packages("tinytex")

    tinytex::install_tinytex()

    0 讨论(0)
  • 2021-01-31 07:42

    This answer on TexExchange might help.

    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).

    1. Check that /usr/texbin exists.
      In terminal:

      cd /usr/texbin
      
    2. 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
      
    3. 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.

    If you find yourself having to mess with the PATH variable, installing the latest version of MacTex might be a better solution.

    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.

    0 讨论(0)
  • 2021-01-31 07:48

    For those using Dunk's answer(For people using UBUNTU) who get a Font <font> at <size> not loadable: Metric (TFM) file not found. error, you also need:

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

    This does unfortunately expand the size of the texlive install considerably, but it is still about half the size of a texlive-latex-extra install.

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