I'm attempting to use one of a few ST resources to build latex documents, but none of them are working. The initial attempt was to use pandoc from ST to do markdown/latex compilation. I was using this build script:

    "shell_cmd": "pandoc -o \"$file.pdf\" \"$file\" && open -a Preview \"$file.pdf\"",
    "selector": "text.html.markdown",
    "path": "/usr/texbin:$PATH"

which brings up the console box, says it is building, but doesn't create a pdf in my directory.


    "cmd": ["pandoc -o \"$file.pdf\" \"$file\" && open -a Preview \"$file.pdf\""],
    "shell": "true",
    "selector": "text.html.markdown",
    "path": "/usr/texbin:/usr/local/bin:/usr/bin:/bin"

I should mention that

> pandoc -o example.pdf example.md

works from the command line.

Next I tried just using latexTools and the usual latex build system. I created a latex file in ST, and tried to build. I got the exact same behavior, blank console box, no output into the directory.

So I thought maybe my pdfLatex was the issue:

> which pdflatex


> pdflatex --version
pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014)
kpathsea version 6.2.0
Copyright 2014 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.6.10; using libpng 1.6.10
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.03

and then I tried:

> pdflatex example.tex 

which also worked(output the pdf file as expected).

Edit: I am getting some output in the console:

    Writing file /Users/bbischof/Library/Application Support/Sublime Text 2/Packages/User/Markdown to PDF.sublime-build with encoding UTF-8
Writing file /Users/bbischof/Library/Application Support/Sublime Text 2/Packages/User/Markdown to PDF.sublime-build with encoding UTF-8
Traceback (most recent call last):
  File "./sublime_plugin.py", line 337, in run_
  File "./exec.py", line 154, in run
TypeError: __init__() got an unexpected keyword argument 'shell_cmd'

Edit 2: Removed "shell_cmd" and made it "cmd". If I run it like this with simply "cmd" I get:

    [Errno 2] No such file or directory
[cmd:  [u'pandoc -o "/Users/bbischof/Documents/LatexDocs/example.md.pdf" "/Users/bbischof/Documents/LatexDocs/example.md" && open -a Preview "/Users/bbischof/Documents/LatexDocs/example.md.pdf"']]
[dir:  /Users/bbischof/Documents/LatexDocs]
[path: /usr/texbin:/usr/texbin:/usr/texbin:/usr/texbin:/usr/texbin:/usr/texbin:/usr/texbin:/usr/texbin:/usr/bin:/bin:/usr/sbin:/sbin]

If I run it with cmd and "shell": "true", I get:

/bin/sh: pandoc: command not found
[Finished in 0.1s with exit code 127]
  • I forgot to mention, but I have tried restarting ST since installing these things and saving the build-scripts. – BBischof Feb 22 '16 at 23:20
  • Does anything appear in the Sublime console? (View|Console) – ig0774 Feb 25 '16 at 15:33
  • @ig0774 no, it's blank. – BBischof Feb 25 '16 at 15:57
  • LaTeXTools is pretty chatty on the console and may provide a clue... Maybe running pandoc with --verbose? – ig0774 Feb 25 '16 at 20:01
  • @ig0774 sorry, do you mean running pandoc in the ST console? I'm a bit confused. – BBischof Feb 25 '16 at 20:02

So lay out what's in the chat, the path to the pandoc executable, i.e., /usr/local/bin must be added to the path setting of your builder as well as /usr/texbin (to ensure pdflatex and friends can be found).

So your path setting should be:

"path": "/usr/texbin:/usr/local/bin:$PATH"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.