view raw
KcFnMi KcFnMi - 6 months ago 55
LaTeX Question

Sublime Text Build LaTex, issue with minted package

Minted is used add beauty to code in LaTex, like in:

int main() {
printf("hello, world");
return 0;

I've installed it and it works fine if I call, from the command line:

pdflatex -shell-escape minimal.tex

But I'm using Sublime Text Build System to make the PDF, here is the build script:

"cmd": ["/Library/TeX/texbin/pdflatex","-shell-escape","$file"],
"selector": "text.tex.latex"

For some reason when I hit
, it doesn't work as in the Terminal. In the output panel I see:

This is pdfTeX, Version 3.14159265-2.6-1.40.17 (TeX Live 2016) (preloaded format=pdflatex)
\write18 enabled.
entering extended mode
LaTeX2e <2016/03/31>
Babel <3.9r> and hyphenation patterns for 83 language(s) loaded.
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix
<2008/02/07> (tvz))
(./_minted-minimal/default.pygstyle)system returned with code 256

! Package minted Error: You must have `pygmentize' installed to use this packag

See the minted package documentation for explanation.
Type H <return> for immediate help.

l.3 \begin{document}


isn't found via Sublime Text?


As much as I love OS X - this whole path story is just a pain and at least to me it seems that it changes again in every major release. Now, when launching Sublime Text, it inherits the $PATH variable (which basically tells Sublime Text where it should look for external programs like pdflatex or pygmentize) from the launchctl tool - and not from the shell. Thus, even if everything works perfectly fine in a shell, it won't work from Sublime Text (or most other editors).

You can try to fix this yourself, as described in this question on AskDifferent.SE. This has the advantage that it "fixes" the path for all applications, i.e. even if you switch to another editor. To do that, you will have to add the following to your .bash_profile :

export PATH=some_path:another_path
launchctl setenv PATH $PATH

Taken from this answer

Note, you probably won't need the first line, if everything works in the terminal. Just make sure to call launchctl after setting all paths.

Another possibility, if you prefer a Sublime Text way, is to use the SublimeFixMacPath plugin for Sublime Text 2 or 3, which adds all paths from your shell to the Sublime Text path. That way, anything that works in the shell also works in Sublime Text.