Tag Archives: sumatrapdf

LaTeXTools plugin: a slew of fixes

I finally got around to committing a bunch of fixes for my LaTeX plugin for the Sublime Text 2 editor. I describe the main changes below. First though I really want to give a shout-out to the outstanding Package Control plugin, which makes it trivially easy to install and update LaTeXTools and most other Sublime Text 2 plugins. If you have Package Control installed, getting LaTeXTools on your Mac or PC is just a matter of invoking Package Control: Install Package via either the Command Palette or the Preferences menu. See the aforelinked page for details. Incidentally, I didn’t have to do anything to make sure LaTeXTools was picked up by Package Control: it happened automagically, to my surprise and delight. Yay!

Now for the fixes. In no particular order:

  • I expanded the README file so it now covers most, if not all, of the current functionality. I also provide some ideas on how to troubleshoot issues. By the way, if you do find something is wrong, please let me know!
  • I finally understood that latexmk does not automatically force the TeX engine (e.g. pdflatex) to work in batch mode. Errors will cause latexmk to stop. You can check this by running it from the command line. However, on OS X, somehow invoking latexmk via subprocess.Popen still works, in the sense that all processes terminate regularly and the plugin can then look for errors in the TeX log file. On the other hand, on Windows, using TeXlive, this is not the case: the build command essentially hangs, and even if you terminate it, the pdflatex process keeps waiting for input in the background. This makes further compilations fail (because the synctex file is locked), and forces you to terminate the stray process with Task Manager. Ugly! Well, I hope I have fixed at least the most egregious causes of such inappropriate behavior by passing the -silent option to latexmk.
  • A user had a lot of trouble with on-the-fly conversion of EPS files to PDF on OS X, using the epstopdf package. Ends up the problem was path-related: epstopdf relies on Ghostscript, and MacTeX puts Ghostscript in /usr/local/bin rather than /usr/texbin. When compiling from the command line, everything worked–because MacTeX also helpfully fixes your $PATH; but, building from Sublime Text 2 always failed. Adding the former path in LaTeX.sublime-build fixed the issue. Thanks Jon and Sublimator for helping me track down this bug!
  • SumatraPDF, the supported PDF reader on Windows, only reloads recently changed files if they are local: it does not automatically reload files on network shares when they change. As a result, recompiling a file on a network share resulted in SumatraPDF not automatically showing the updated text. This was a problem for me when running Windows in a Parallels virtual machine: Mac directories are accessible are network drives, and there is no problem editing files with Sublime Text 2 on the virtual Windows side; however, I had to manually reload PDF files every time. Bottom line: I now explicitly force a reload before issuing the forward search DDE command.

Enjoy, and as usual report back any issues you may have!


LaTeXTools: updated SumatraPDF setup information

Just a quick heads-up: I just added detailed instructions in the README file on how to set up inverse search with SumatraPDF on Windows.

If you were using SumatraPDF with another text editor that supported inverse search, you probably didn’t have any trouble reconfiguring inverse search to work with Sublime Text. However, it turns out that a fresh install of SumatraPDF does not show a GUI for the inverse-search command, until you actually open a PDF file that has actual synchronization information in an accompanying .synctex.gz file.

The revised README file shows how to proceed. Basically, if you already have a PDF file with an attendant .synctex.gz file, open the PDF in SumatraPDF, and you’ll see the GUI when you select Settings|Options. Otherwise, you can either compile any latex document with pdflatex and sync information (i.e. compile with pdflatex -synctex=1 ), or else configure SumatraPDF from the command line. See the README file for details. As usual, you can read that file at Github (you may need to scroll down a bit).

I’m sorry things are not more straightforward. Good luck!