How to apply Sublime Text 2 and Skim to MacTeX on Mountain Lion

LaTeX is a very powerful platform for creating/writing professional documents. It is widely used in scientific context for writing papers and exams mostly because of it’s robustness when it comes to typesetting large documents. This is a short abstract on my experiences setting up LaTex with my favorite text editor Sublime Text 2 on Mac.

The first task is to download and install the MacTeX Package. The download is available on the MacTeX Users Group website under http://www.tug.org/mactex/. The regular MacTeX download file is about 2 GB big. After completing the download, just run the installer and follow the regular instructions to install the package. I strongly recommend to always install the latest or 2nd to latest version of MacTeX.

Next step is to choose an editor to work with. There’s tons of software out there to create full LaTeX documents. The MacTex package includes the open source program TeXShop. Others, like Latexian, LaTeXiT, or TexMaker are easily find and freely downloadable. This tutorial, however, focuses on the editor Sublime Text 2 (ST2) available under http://www.sublimetext.com/2. ST2 is available for free as a test-version without functional limitations or a time limit. If you start using ST2 on a regular basis, I recommend to purchase a license in order to support further development of ST2. Download ST2 and run the installer. ST2 supports all major syntaxes including LaTeX, BibTeX, etc.

In order to enjoy the full power of ST2 you need to install a couple of extra tools.

Strongly recommandable is the open source extension Package Control. Will Bonds “full featured package manager” enables users to find and install available add-ons directly in ST2. It also keeps everything up to date installing new versions automatically. It is important to read the instructions available at Package Control’s website carefully. In my humble opinion, an awesome package!

To open Package Control in ST2 hit cdm+shift+p. The Sublime Command Palette will open and you can browse all options including the newly installed Package Control items like ‘Install Package’. There you will find lots of add-ons like iTodo, jQuery bundle, WordCount, or LaTeXTools.

Package Control

ST2 Command Palette - Package Control options

In order to see the result of your LaTeX code you need to have a PDF viewer. There’s tons of good stuff out there – for this tutorial please install Skim the usual way.

At the heart of this tutorial stands the installation of the LaTexTools package. To simplify working with LaTeX documents in ST2 LaTexTools is the main package you need to install. It enables, for example, compiling of your LaTeX source via hotkey, showing a logfile with warnings and errors, as well as launching the Skim PDF viewer at the current cursor position. Just find and install LaTexTools easily via Package Control.

Finally, you should now be able to compile your .tex code using hotkey cmd+b. The Skim editor will open and jump to the pdf spot of the corresponding cursor position in ST2.

Hint: Right after everything was set and seemed to work fine, I started trying to edited different existing .tex documents. Surprisingly, Skim would not open automatically when compiling (command + b) certain documents. My first thoughts were rotating about errors in the LaTexTools package or missing statements in the .tex file as the problem only occured in some documents. Turns out after consulting miscellaneous google hits it’s a language specific problem. I’m from Germany and we have those strange characters with two dots on top called “Umlaute”. Skim does not show up when compiling documents that are located in folders which contain one or more Umlaute (ä,ü,ö) in the folder name. After changing the folders everything just works great!