Live Preview LaTeX Editing with TextMate
A while back I found an interesting GTK program on reddit called gummi which is a tex editor for linux which sports a really nice live-updating preview of your document which is generated as you type. I tried it out on a Ubuntu box and was really impressed, so much so that I decided I would have to try and replicate it on OS X.
At first I looked for a way to simply run Gummi on OS X, but this wasn’t really a viable option. I decided the next best thing would be to try and replicate the functionality using TextMate, my favourite text editor. TextMate already has nice support for .tex editing including a “Typeset & View” (CMD + R) command which works really nicely. The one big downside though was that when you re-typeset a document, you lose your position in the preview, which means you’re constantly scrolling down to find the point you want to check.
The next step is to set TextMate to typeset your documents without prompting. This can be done by rooting through the preferences. First you have to tell TextMate to auto-save documents when it loses focus, and also to use atomic-saving which protects against file corruption. Both of these options can be found in the Advanced tab in TextMate’s preferences.
The second part of the puzzle is to tell TextMate what to do with LaTeX files. Open the LaTeX bundle preferences in Bundles -> LaTeX -> Preferences and select Preview (not TextMate) as the default pdf viewer. Then open the tex document you would like to work on.
Once you have it opened select the “Watch Document” command in Bundles -> Latex -> Watch Document. Now when you save your tex file or switch to another application TextMate will automatically typeset it for you! To get a live preview all you have to do is open the document in Preview and work away. Once you save the file or switch away from TextMate PDFView will automatically load the fresh document. Voila! All the nice functionality of TextMate with live pdf previews on top!
Enjoy
Patrick

good man matey, great site, gonna pikey some of this.