TeXing with Textmate Changed my Life

I spend a lot of time writing in \LaTeX. Two years ago, I started typesetting of my homework assignments in it. Though I originally would do the problems on paper then type them, I now do a lot of my thinking right into \LaTeX code. During my spring break in the Spring 2010 semester, I discovered Textmate. This rocked my \TeXing world.

Textmate allows live syncing with the open source PDF-viewer Skim: I can “watch” a \LaTeX document so that every time I save it, the document quickly recompiles and Skim updates. The typesetting isn’t entirely real-time, but a quick ⌘-S will give me an updated view of the final product. This has a side benefit. If you save a watched document that has errors it in, it won’t compile and you get an annoying error message. This inspires the writing of cleaner code. I generally work with Textmate and Skim open side-by-side.1

Another way which Textmate improved my \LaTeX writing experience is its powerful keyboard shortcuts and customizable macros. For example, highlighting text and pressing Command-Control-Shift-W wraps the text in a \begin{}\end{} environment. Even better, the cursor goes straight to the {} after begin, and whatever you type there is automatically copied to the end.

Tab completion is a beautiful feature for writing \LaTeX quickly. Since starting grad school in operations research, I find myself typesetting a number of mathematical programming models. When I was taking linear programming, I wrote a snippet (macro) to do a lot of the work for me. In Textmate, I type “lp” and then press tab. Immediately inserted into my document is

The cursor is placed after “\qquad &” on the first row where I type my objective function. When I press tab, the cursor jumps to the space after the “&” on the third row where I type my first constraint. After finishing my contraints, ⌘-S cauess Skim to refresh with a nicely typeset linear program:

Textmate also includes basic editor features like auto completion of parenthesis and brackets. I suspect this has saved me hours in debugging time. (Incomplete brackets were my bane when writing \LaTeX without Textmate.) But Textmate’s modular setup also provides special completion for Textmate-specific things. For example, anyone who has typed more than a few pages of \LaTeX has probably type “x_12″ to get x_12 when you wanted to type “x_{12}” to get x_{12}. Textmate handles that for me: typing an underscore in math mode automagically adds the brackets and puts the cursor between them.

At this point, I’m fairly certain I can type math into Textmate faster than I can write it by hand. I honestly can’t imagine using anything else. I have more to say about my \LaTeX, but that homework document isn’t finishing itself . In a future post, I’ll discuss how I format, organize, and complete homework assignments.

For more information on setting up Textmate with \LaTeX and Skim see this site.

  1. A task completed by SizeUp []

8 Responses to “TeXing with Textmate Changed my Life”

  1. Ben January 20, 2012 at 2:50 PM #

    What? I’ve been using Textmate for LaTeX for three years and I didn’t know Skim could watch the TeX source and auto-update on save. I’ve been using ⌘-R. Is there anything special you have to do to set that up?

    Also, what type of style are you using to get the output shown in Skim above?

  2. Phil January 20, 2012 at 3:52 PM #

    Check LyX, a free Tex editor, and it is real time. They say, WYSIWYM.
    Though it doesn’t fit to my appetite that much, I am sure that it does for someone.

    http://www.lyx.org/

  3. Christopher Olah January 20, 2012 at 4:13 PM #

    For me, my LaTeX massively improved when I started using unicode in it. This lead to me having code like:


    \item Suppose not. Then $(∃S, μ(S)=ε>0)(∃δ>0)(∀x∈S)(∀n∈ℕ)(f_n(x)>δ)$. Then it must be the case that $∫f_n>εδ$. Then $∫f_n \not → 0$.

    Which was a lot nicer than the alternative…

  4. Dana Ernst January 20, 2012 at 4:40 PM #

    It seems that TeXShop for Mac has all of the same advantages that you describe. However, I think one advantage that Textmate has is that it does more than LaTeX, whereas, TeXShop is LaTeX/TeX-specific. Are there other advantages of Textmate over TeXShop that I’m not seeing?

  5. Paul A. Rubin January 20, 2012 at 10:25 PM #

    +1 to Phil’s comment. Been using LyX for years and swear by it. Bonus: math glyphs are rendered in real time, and matrices, equation arrays etc.are really easy to configure.

  6. John January 21, 2012 at 12:56 AM #

    Another poster has suggested TeXShop, and I’ll second that for this reason: it uses synctex to, well, synchronize the source and the output. So you can command-click on the source, and it jumps to that place in the pdf, and vice-versa. It is amazing. If Textmate can also do this, then great.

  7. Bill Meahan January 21, 2012 at 3:37 AM #

    TeXMaker also uses synctex if you like that. I don’t particularly care for it but I can see where many people would. I work on very large documents (novels) so real-time viewing is not necessarily an advantage. YMMV

Leave a Reply:

Gravatar Image

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>