Setting-up LaTeX Environment on Mac OS X

I recently switched from Linux to Mac OS X and one of the first things I needed to set up was LaTeX environment. In Ubuntu, I used to use gEdit with its LaTeX plugin, TeX Live distribution and Gnome PDF viewer, so the minimal requirements for my new environment were:

  • syntax highlighting
  • intelligent (i.e. ignoring LaTeX commands) spell-checking
  • code completion and snippets
  • integrated build system (i.e. building a PDF by a keyboard shortcut)
  • PDF viewer auto-reloading the file after each recompile
  • free

First thing I installed was a distribution of TeX Live for Mac — MacTeX. The installation was pretty straightforward so there’s no point to elaborate about it. This distribution directly contains editor called TeXShop. I cannot say that I don’t like it but it is rather simple, so the next one I tried was TeXMaker, which I had already tried couple of years ago and hadn’t used because of (for me) unintuitive user interface. I had hoped the new version is better. It is in terms of user friendliness but the document preview (compilation and opening of a PDF file) is unbelievably slow. Then I started to think about buying some editor, because it seemed there’s no good free one. So I tried Latexian. I opened a file which compiled in TeXMaker in it and it didn’t get compiled. Another unusable editor. Finally, I overcome my many-years long resistance to Emacs (I had always been a Vim user:-)) and installed Aquamacs.

After opening the first TeX file (a Beamer presentation), I was really impressed by the quality of syntax highlighting. For instance, sections have larger fonts, italics is really italics, bold is really bold. Auto-indentation and document re/formatting also works pretty well. Aquamacs is nice because it supports modern keyboard shortcuts, so you don’t have to press ctrl+foo, ctrl+foo, ctrl+bar, ctrl+foo to open a file:-). Instead, cmd+o, as it is usual on Mac, works. Aquamacs comes with Emacs package for LaTeX editing — AUCTeX. It very powerful and besides aforementioned code formatting, highlighting and compiling it also supports various macros for insertion of code snippets and in-line preview of figures, e.g. mathematical formulae. This feature is indeed very useful, but unfortunately it doesn’t work for me, so if you know how to fix it, I would be really grateful for any hint. The last thing I needed to change was a PDF viewer as the standard Preview doesn’t really work very well with files which are being recompiled (it crashes from time to time and it takes it long time to reload the file). I tried classic Acrobat Reader but it doesn’t work either. What really works very smoothly is Skim. Aquamacs provides a very good integration with this PDF viewer. The only two things I had to change was in Finder I had to change the association of PDF files to be opened in Skim by default and then in Skim’s preferences in Sync section I ticked Check for file changes and then I chose Aquamacs as a Preset. If you then include package preview in your document and recompile, you can then directly jump from the point where your cursor in Aquamacs is to the place in the compiled PDF by choosing menu Command->Jump to PDF. It works even the other way around! In Skim, try to press cmd+shift+left mouse click on any place and you will jump directly into the source!

With this combination, I have even better working environment than gEdit + Gnome PDF viewer, even though this combination was really good as well. The Aquamacs+Skim is better as it provides PDF Sync (jumping from/to source/PDF) and Skim provides higher quality of fonts (but this is probably rather a feature of Mac than solely Skim).

Leave a Reply