In one of my previous articles, I wrote about LyX, an easy way to produce documents in TeX without any prior knowledge of the typesetting language. However, for anyone with a knowledge of TeX, LyX can seem a little limited in its functionality and can, sometimes, be complicated to use. To really appreciate the power of TeX and what it can really do (especially if you do a lot of writing), it is worth taking some time out and learning the typesetting language (which is a lot simpler than it actually seems!).

There are quite a few TeX editors out there for the Mac however most of them are simply ports of native Windows or Linux editors and don’t really make use of OS X’s design and functionality. However, this has now changed. Independent developers Valleta Ventures have come up with TexPad, a native TeX editor for OS X with some handy features that make TeX editing a breeze. Let’s take a closer look.

## Getting Started

TexPad is available exclusively from the Mac App Store and works on all Macs running OS X 10.6 and upwards. Before you start running TexPad, you will need a TeX distribution installed on your Mac which helps process and render the documents. A good free one is MacTex, which is available here, however leave some time for downloading and installing it (the file size is roughly 2 GB).

MacTex is a great, free TeX distribution for OS X

Once you’ve installed MacTex and run TexPad for the first time, you are greeted by the splash screen, which gives you the option of starting a new .tex file or continue working on a previous one. If your TeX distribution installed successfully, then you should see a little green tick and the location of the distribution on the splash screen as well (if not, try reinstalling the distribution again).

## Creating A Document

To start creating a new document in TexPad, simply click on New .tex file and the editor pops up, where you can start creating your document.

In TeX, before you start writing your document, you have to define the type of document that you are writing, which helps the TeX system define the formatting (such as titles). You can either do this via typing it out or clicking on File > New From Template, which gives you the choice between an article, book, letter, report or presentation; the most commonly used templates. If you are going to type it out, the TeX command which would create an article (a standard document with a title and author), would look something like this:

\documentclass[11pt]{article}
\begin{document}
\end{document}

All of your TeX code for the document you are writing should lie in between \begin{document} and \end{document}. Any commands in TeX (known as control sequences) start with a backslash (\) and TexPad makes it easy to see commands by highlighting them in a different color.

TeX commands are highlighted in blue, making them a lot easier to see

## Auto-Complete

TexPad features a built-in library of most TeX commands and when you type in a control sequence, a little menu pops up giving you a list of commands possible. This can save you a lot of time in the long run as it avoids you typing out the same commands over and over again.

## Error Correction

One of the most frustrating features about typing in TeX is any errors are not flagged up straight away, and most TeX editors do not explain what the problem is or where it is. This can be a real pain when you have been typing away at a document for 3 hours then having to spend an extra hour going through the document finding all the errors. TexPad makes this a thing of the past. Any errors are flagged up before the rendering process (i.e., turning the TeX document from meaningless code into a formatted document) and you can easily correct them before you carry on.

Any errors in your TeX coding are flagged up during the rendering process

In the above example, I deliberately inserted the command (line 36) \usebox without any definition after it, for example: \usebox{cmd} thereby causing an error. TexPad flagged up the error during the rendering process, allowing it to be corrected.

## Typeset View

Once you’ve rendered (or, in TeX-speak, typeset) your document (hopefully without any errors), it will be displayed in a separate window on the right of your TeX code.

Once a document has been rendered (or, alternatively, typeset) a preview of it appears to the right of your code

After your document has been typeset, you can either carry on editing it further or you can e-mail, save or print it as a PDF if you have pdfLaTeX installed (this is included in most TeX distributions, including MacTex). Bear in mind that before you typeset a document, you have to save it onto your hard disk first.

## Final Thoughts

TexPad is a great, native Mac OS X TeX editor and works really well. The simple interface and helpful built-in features (such as auto-completion of TeX commands) make it a worthy candidate as a fantastic TeX editor on OS X and one that you don’t really mind parting with fourteen dollars for.

There are free alternatives out there, but they don’t perform with the flair of TexPad (the program is even optimized for Lion with a full-screen view) and if you do a lot of writing in TeX, then it really will become an incredibly useful utility that you won’t want to be without.

## Summary

A native TeX editor for OS X featuring built-in templates and instant error correction.

9