简体   繁体   中英

pandoc: xelatex not found. xelatex is needed for pdf output

I have just upgraded my Macbook Pro OS to El Capitan (v10.11.4).

My attempt to export a Markdown file (created using Sublime Text 2, v2.0.2, build 2221) to pdf using pandoc is now failing, and I receive the following error:

pandoc: xelatex not found. xelatex is needed for pdf output

My output command is as follows:

pandoc doc1.md -o doc1.pdf --toc -V geometry:margin=1in --variable fontsize=10pt --variable fontfamily=utopia --variable linkcolor=blue --latex-engine=xelatex -f markdown-implicit_figures -s

Above command worked like a charm prior to installing El Capitan.

FYI - in searching for questions here I have not found one that gives a suitable answer.

For my case, add one line into ~/.bashrc solved the error:

export PATH=/Library/TeX/texbin:$PATH

Of course, the environment variable should be activated in the current term:

$ . ~/.bashrc

then run: $ make

the error disappears.

El Capitan's security features disable and remove the old symlink /usr/texbin . If you have MacTeX 2015, they should've been installed in /Library/TeX/texbin as well. You'll have to update the PATH your using to launch pandoc to include that folder. If you have a pre-2015 distribution of MacTeX, there are instructions here .

Linux Ubuntu instructions:

Tested on Ubuntu 18.04:

If you see this error on Linux Ubuntu :

 pandoc: xelatex not found. xelatex is needed for pdf output

Then you need to install the texlive-xetex package like this:

sudo apt update
sudo apt install texlive-xetex

That solves it: Source where I learned this: TEX: XeLatex under Ubuntu .

In my particular case, I was trying to run this make_book.sh script to generate book.pdf , so I needed to do all of the following:

sudo apt update
sudo apt install pandoc
pip3 install MarkdownPP
sudo apt install texlive-xetex

cd path/to/repo
cd systemd-by-example
./make_book.sh
# You'll now have "book.pdf" inside directory "systemd-by-example"!

References:

  1. https://github.com/jreese/markdown-pp - instructions to install MarkdownPP
  2. https://tex.stackexchange.com/a/179811/168682 - instructions to install texlive-xetex

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM