LaTeX, TextMate, and Skim

By Andrej Kastrin

First, to sketch out the background. Generally, you need three essential pieces of software to produce and view LaTeX document:

  1. text editor for editing your LaTeX source file,
  2. the LaTeX program for compiling your LaTeX source file into PDF document, and
  3. a PDF viewer for previewing and printing your document.

There is a plethora of LaTeX distributions available for Mac OS X platform. An overview of some well known distributions can be found on TeX on Mac OS X wiki.

If you are using Fink (or MacPorts) for installing packages under Mac OS X, you can install LaTeX using this excellent package manager. Fink users install LaTeX with

$ sudo fink selfupdate
$ sudo fink install tetex

One very useful component of Fink is Fink Commander, which provides friendly GUI front-end to Fink. Find the package “tetex-base” and highlight it. Then press the blue “plus sign” button in the menu bar to install it as a binary package. During the installation Fink Commander will pop up a window asking for you answer; you can continue by simply accepting the default answer. You can find further details addressing Fink (or MacPorts) issues here.

If you are not using Fink, I recommend to install MacTex which is a precompiled TeX Live LaTeX distribution for OS X. By the way, TeX Live is the most popular LaTeX distribution developed by the TeX user groups. At the moment of this writing, MacTeX consist of two parts: MacTeX-2008 and MacTeXtras. MacTeX-2008 is an install package which install everything you need to run LaTeX on Mac OS X. MacTeXtras is a collection of optional extras. The package is huge, so take a cup of coffee (or two) during the download.

Skim is notably the first free PDF viewer for Mac OS X. It’s open-source application, of course. It provides tight interaction with LaTeX and is highly customizable. Download and install Skim.app in the Application folder. Then open Skim’s Preferences dialog, select the Sync tab and make sure that the “Check for file changes” option is disabled and that “PDF-TeX Sync support” is set to the “TextMate” preset.

TextMate is a general-purpose GUI text editor for Mac OS X. TextMate has emerged as the new baseline for what a text editor should be capable of. Actually, it’s not open-source. You can download 30 day trial or purchase a license for €48.75. What makes TextMate so excited for me, is the open-source developer community that provides extensions (bundles) which provide additional functionality to TextMate. At the time of this writing the Subversion repository contains exactly 160 bundles. By default, TextMate comes with integrated LaTeX bundle, so it’s LaTeX-ready.

However, to configure TextMate we should use a LaTeX Preferences dialog which is available under “Bundles -> LaTeX -> Preferences”. Make sure that “Default Engine” is set to “pdflatex” and the “Use Latexmk.pl” option is enabled. Latexmk.pl script automatically runs latex, bibtex, and makeindex as many times as needed to resolve all cross-references and citations in your source file. Finally, you should set “View in” option to “Skim” and ensure that “Show pdf automatically” option is enabled.

LaTeX environment is now ready. To compile your document with LaTeX press ⌘R. You could also select “Typeset & View (PDF)” in the LaTeX bundle menu. TextMate shows the log messages, warnings and errors generated during the compilation in a popup window. Skim opens automatically if the LaTeX compilation was successful.

2 Responses to “LaTeX, TextMate, and Skim”

  1. running Says:

    Thank you, thank you, thank you. I cannot get LaTeX in TextMate running for two days. If only I read this article. Thanks

  2. Richard Says:

    Thanks, Andrej! I thought I had it all figured out, but wasn’t as happy with Skim as the rest of the world. Your guide helped me get it dialed in. Thanks — your blog just found its way into my Google Reader.

    – Richard

Leave a Reply