[Tex/LaTex] SublimeText2 LaTeXTools won’t produce pdf

compilingsublime-text

I'm using SublimeText2 with LaTeXTools on Ubuntu 14.04LTS and TeXLive 2015.

When I press ctrl+b, it generates the .aux and dfb_latexmk file but no pdf. My problem was described in a previous post here. The suggested solution does not work for me (changing the builder to simple).

I've also tried to delete everything except the .tex file and recompile, with the same result. I tried Tools–>Build System–>LaTeX, but I get the same results. I tried the platform-specific recommendations in the LaTeXTools recommendations (i.e., removing the space in = 'E and quoting $pdflatex command); but they didn't seem to work.

The problem is not with a specific file. When I ran ctrl+b on a TeX file I wrote a while ago, it shows the pdf; but if I try to change the file, it shows the same pdf (i.e. the pdf is not changed to reflect the changes I made in the file). I assume it uses the already-complied pdf and does not compile a new one.

Running latexmk test.tex -pdf from command line works without a problem.

Here is a snippet from the console of ST2:

    <class 'traditionalBuilder.TraditionalBuilder'>
    Welcome to thread Thread-4
    2
    [u'/usr/local/texlive/2015/bin/x86_64-linux/latexmk', u'-cd', u'-e', u"$pdflatex = 'pdflatex -interaction=nonstopmode -synctex=1 %S %O'", u'-f', u'-pdf', u'test.tex']
    Finished normally
    12
    Exception in thread Thread-4:
    Traceback (most recent call last):
      File ".\threading.py", line 532, in __bootstrap_inner
      File "./makePDF.py", line 164, in run
    IOError: [Errno 2] No such file or directory: u'/home/.../test.log'

EDIT In response to ig0774 suggestion, here is the output of latexmk

`Stdout:

Latexmk: This is Latexmk, John Collins, 5 February 2015, version: 4.43a.
Latexmk: Changing directory to './'
Rule 'pdflatex': Rules & subrules not known to be previously run:
   pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
  'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'q/pdflatex -interaction=nonstopmode -synctex=1  -recorder  "test.tex"/'
------------
Latexmk: applying rule 'pdflatex'...
sh: 1: q/pdflatex: not found
Failure to make 'test.pdf'
Collected error summary (may duplicate other messages):
  pdflatex: (Pdf)LaTeX failed to generate the expected log file 'test.log'
Latexmk: Did not finish processing file 'test.tex':
   (Pdf)LaTeX failed to generate the expected log file 'test.log'
Latexmk: Undoing directory change
Latexmk: Errors, in force_mode: so I tried finishing targets`

Changing back to "command" : ["/usr/local/texlive/2015/bin/x86_64-linux/latexmk", "-cd", "-e", "$pdflatex = '%E -interaction=nonstopmode -synctex=1 %S %O'", "-f", "-pdf"] I get the following stdout:

`Stdout:

Latexmk: This is Latexmk, John Collins, 5 February 2015, version: 4.43a.
Latexmk: Changing directory to './'
Rule 'pdflatex': File changes, etc:
   Non-existent destination files:
      'test.pdf'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -interaction=nonstopmode -synctex=1 "test.tex"  -recorder '
------------
Latexmk: applying rule 'pdflatex'...
sh: 1: pdflatex: not found
Failure to make 'test.pdf'
Collected error summary (may duplicate other messages):
  pdflatex: (Pdf)LaTeX failed to generate the expected log file 'test.log'
Latexmk: Did not finish processing file 'test.tex':
   (Pdf)LaTeX failed to generate the expected log file 'test.log'
Latexmk: Undoing directory change
Latexmk: Errors, in force_mode: so I tried finishing targets`

Best Answer

This is a comment not a question, but it's too long to fit into the comment field.

Let's try to get the output from latexmk when its run through Sublime Text since it seems to be different from running latexmk from the console. To do this we'll need to modify your local copy of makePDF.py.

To find this file:

  • In Sublime Text, run the Preferences: Browse Packages command
  • Find the LaTeXTools folder
  • Open makePDF.py in Sublime Text (or an editor of your choice)

To edit this file:

  • Go to line 164. It should be data = open(self.caller.tex_base + ".log", 'rb').read()
  • Replace line 164 with this block of code:

    content = ['']
    if out is not None:
        content.extend(['Stdout:', '', out.decode('utf-8')])
    if err is not None:
        content.extend(['Stderr:', '', err.decode('utf-8')])
    self.caller.output(content)
    
    try:
        data = open(self.caller.tex_base + ".log", 'rb').read()
    except IOError:
        self.caller.finish(False)
        return
    

NB: all the spacing should be tabs and the code should be indented to line up with the comments.

After doing this, re-run the compilation. It will give you the output from latexmk. Post that here and we might be able to better diagnose the issue.


So it seems as if there's a mismatch between the $PATH on your console and the $PATH visible to Sublime Text, so that pdflatex is not visible to the Sublime Text path. (I'm assuming that, since it works from the console, that pdflatex is actually installed on your machine and that you haven't touched the texpath setting to remvoe $PATH from it). So:

  • From the console, run which pdflatex
  • Add the folder containing pdflatex to the texpath setting in platform settings bit of LaTeXTools.sublime-settings.

Try re-compiling and see what happens.

Related Question