EDITED 3/26: fixed URLs to reflect the new ‘official’ SubimeText packages repo / organization.
I have been pretty quiet the last couple of weeks. The main reason is that I was working hard to meet a deadline (which I did, sort of). However, I have also finally begun porting my LaTeX plugin for Sublime Text to the new, awesome, cross-platform v. 2.0 of said amazing text editor. Mind you: Sublime Text 2 (ST2 for short) is still in the alpha stage, and so is my ported plugin. On the other hand, I have been using ST2 as my sole text editor for the past two weeks, tweaking and porting the essential features of the LaTeX plugin as I needed them. It has served me well.
Thus, if you like living on the edge, you can get the ST2 alpha version here; or, if you are really adventurous, grab the latest dev build here. Then, head over to the LaTeXTools public GitHub repository; hit the “Downloads” button to get a .zip file of the current version; you will get a silly name like
msiniscalchi-LaTeXTools-38ddb5f.zip (the final part of the file name will change: it’s part of the hash code of the latest commit I pushed to github). Expand this to a folder, which will be aptly called something like
msiniscalchi-LaTeXTools-38ddb5f. Rename this folder to something sane, such as
LaTeXTools but NOT just
LaTeX (read on), and drop it in ST2’s
Packages directory, which you can open from ST2 itself by selecting Preferences|Browse Packages (the exact location of these menu items varies by OS).
An important caveat: the new plugin is designed to coexist with, not replace, the existing snippets, language definitions, etc., that can be found in the
LaTeX folder that comes with ST2 (in the
Packages) directory. This is the reason why the plugin folder must be names something other than
LaTeX. Also, of course you must not erase the existing
I am pretty excited about the plugin! It’s certainly not complete, and must currently work around limitations imposed by the fact that the ST2 alpha still lacks certain features that ST1 had (for instance, quick panels). On the other hand, ST2 brings a lot to the table, and the plugin attempts to use the built-in features of ST2 whenever possible; the best example is the use of the Completions API to handle references and citations, and of
.sublime-completions files to handle quick LaTeX macro insertion. As a guiding principle, whereas the LaTeX plugin for ST1 tried to be very TextMatey, the LaTeX plugin for ST2 will be more… well, Sublime :-)
I will blog about specific features of the plugin later. However, if you want to kick the tires, so to speak, here’s the bare minimum you need to know.
- On Windows, the plugin uses MikTeX and the Sumatra PDF previewer, just like ST1. Both must be installed, and Sumatra must be on the
PATH. Check your environment variables.
- Recent versions of Sumatra allow you to set up inverse search from the GUI. You need to do so before you can use this feature. Go to Settings|Options, and under “Set inverse search command line”, enter
- Similarly, on the Mac, you use MacTeX and the Skim previewer. To set up inverse search, go to Preferences, select the Sync tab, choose Custom from the Preset drop-down menu, and enter
sublin the Command field and
"%file":%linein the Arguments field. Also make sure the Check for file changes box is not checked (same as for TextMate).
- To compile a tex file, use the ST2 build system, which you invoke with F7 on Windows and Cmd-B on the Mac. The build will start, and if there are n errors the PDF viewer will be shown.
- When you recompile (again, with the Build command), the PDF file will be automatically refreshed, but will stay in the background.
- To use forward search (i.e. jump from tex to pdf), use shift+alt+j on Windows and shift+cmd+j on the Mac. For inverse search, double-click (Sumatra) or shift-cmd-click (Skim) at the relevant position in the pdf file.
- For the time being, after compiling, the PDF file is either opened on page 1, or else refreshed; you do not automatically move to the page corresponding to the current position in the tex file. This is the same behavior as the ST1 LaTeX plugin, but it is different from TextMate’s behavior. I’ll fix this later.
- Two PDF-viewer caveats: on Windows, if you try to use forward search but haven’t installed Sumatra, ST2 will crash. On the Mac, if you have Skim running without any windows open, and you try to compile a file or view the current PDF file (with ctrl+opt+v), nothing will happen. Close Skim and try again. Again, it’s something I need to fix.
- Check the
.sublime-keymapfile for your platform (in the directory where the new LaTeX plugin lives) to figure out other key bindings, or change the existing ones.
- A quick primer on the new features: references are inserted by typing
refand then hitting ctrl+space (the ST2-standard long completion key combo). This shows a drop-down menu with all possible references. But, if you know the reference you are looking starts with, say, `sec’, you can type
ref_sec, then hit ctrl+space: now only references starting with `sec’ will be shown! Citations work similarly: e.g. type
cite_myerand all citations with `myer’ either in the key or the title will come up. There are many more features (and a couple of caveats): you can check the comments in the
latex-ref-completions.pyfiles to get an idea, but again, I’ll blog about them later.
- In math mode, you have access to many convenient shortcuts (completions): e.g. type
a, then hit TAB: you get
\alpha. In text mode, you get other completions: e.g.
\bigskip. Note that, for instance,
\mathitin math mode, and to
\textitin text mode. Also, you can cycle among certain LaTeX commands. Check the
LaTeX math.sublime-completionsfor a human-readable list of available shortcuts.
That’s about it for now. Again, it’s all alpha quality, but I have been using the ST2+Plugin combination as my sole LaTeX editing `solution’ (hate that word…) for a couple of weeks, and it is serving me well so far. How’s that for dogfooding?