3

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`
  • Try deleting the pdf, and recompile. It worked with me before. If that doesn't work, delete all files except the .tex file and recompile. By the way, Sublime Text 3 is available, I don't remember the build now though. Let me know if it works. – Alenanno Jul 19 '15 at 0:38
  • @Alenanno Thank you. I forgot to mention that I already tried that; I'll edit the question. – Gal Jul 19 '15 at 2:14
  • 1
    What happens when you run latexmk from the console on the same file? Basically, in your console output, the 12 after the line "Finished normally" is the exit code of latexmk, which seems to indicate some sort of error in latexmk itself. – ig0774 Jul 20 '15 at 9:39
  • 1
    Have you tried running the exact command quoted in the log, /usr/local/texlive/2015/bin/x86_64-linux/latexmk -cd -e "$pdflatex = 'pdflatex -interaction=nonstopmode -synctex=1 %S %O'" -f -pdf test.tex ? – Federico Poloni Jul 21 '15 at 20:00
  • 1
    After looking at the latexmk manual... try /usr/local/texlive/2015/bin/x86_64-linux/latexmk -cd -e '$pdflatex = q/pdflatex -interaction=nonstopmode -synctex=1 %S %O/' -f -pdf test.tex and /usr/local/texlive/2015/bin/x86_64-linux/latexmk -cd -e '$pdflatex = q/pdflatex -interaction=nonstopmode -synctex=1 %O %S/' -f -pdf test.tex (changing quotes, reversing %O and %S). – Federico Poloni Jul 22 '15 at 7:59
2
+50

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.

  • @Gal: see my edit above – ig0774 Jul 24 '15 at 12:28
  • Beautiful! Thank you very very much! =) After running which pdflatex I've changed texpath from "$PATH:/usr/texbin" to "$PATH:/usr/texbin:/usr/local/texlive/2015/bin/x86_64-linux". – Gal Jul 24 '15 at 17:20

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.