oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

LaTeX: It's Not Just for Academia, Part 1

by Kevin O'Malley

"Don Knuth's Tau Epsilon Chi (TeX) is potentially the most significant invention in typesetting in this century. It introduces a standard language in computer typography, and in terms of importance, could rank near the introduction of the Gutenberg press."
--Gordon Bell, forward to Tex and metafont, New Directions in Typesetting

A new year is upon us and you've finally decided it's time to take the plunge and write the next great American (French, German, Japanese?) novel. Or maybe you just need to update your resume, compose some letters, or write some project documentation. If you're like most Macintosh users, you probably use a word processor like MS Word or Nisus Writer Express for your daily writing needs.

This article suggests an alternative to commercial word processors--a program called LaTeX. It provides as much, if not more, utility as commercial word processors. It's rock solid, has a long history of use, a large user base, and best of all, it's free. It may not be right for everyone or for every writing situation, but LaTeX is worth exploring and testing out. You may find it really enhances your writing process and offers some key advantages over word processors.

This is the first of two articles that cover the LaTeX document preparation system. It introduces you to LaTeX, and details the various versions of LaTeX available for Mac OS X, including Aqua-based versions, as well as versions used under Unix. It also shows you how to install a LaTeX implementation and demonstrates how to use it. (The second article will introduce you to writing in LaTeX by showing examples of common writing needs.)

Advantages and Disadvantages of Commercial Programs

The main advantage to using commercial word processors is that you can see the end result of your document as you work--a concept known as WYSIWYG (What You See Is What You Get). Another advantage is that word processors provide many of the tools writers count upon to support the writing process.

For example, when writing anything nontrivial, having a program that automatically creates and maintains a table of contents and index, has a good quality spell checker, and counts the number of words and lines in a document, is indispensable. Program like MS Word, AppleWorks, and Nisus Writer Express provide these features.

The fact is, most of us have used word processors for so long we have ignored other writing tools and techniques that offer some real benefits. For example, being able to see the final document as you work is great, but it can get in the way of the writing process. As you write, you are forced to think simultaneously about the form of the document, as well as its content.

For most users, this process is so ingrained that they don't even notice it anymore. As an experiment, try this test. For a few weeks, use a text editor like BBEdit or Emacs as your main writing tool. Forget about formatting (fonts, font styles, and so forth); just concentrate on the writing. What you may find is that your writing improves because you're concentrating on writing and not worrying about the appearance of the document.

Another result of this process is that many documents are formatted according to personal preferences, as opposed to more established conventions. I'm not sure about you, but I'm no typesetter and don't always make the right choices for producing the best looking, most readable documents. Styles, like those in MS Word, can be a help, but they are not a substitute for a real typesetter.

Also consider that most word processors save files in proprietary, non-text, formats. Heck, I'm mainly a Unix guy and I like having my files stored as text (ASCII), where I can access and manipulate them using the tools of my choice. I'm willing to bet that any file saved as ASCII today will be readable for many years to come, on many different systems.

Related Reading

Running Linux
By Matt Welsh, Matthias Kalle Dalheimer, Terry Dawson, Lar Kaufman

You can always save word processor documents as text, but this is just one more step, and may not be possible if you don't have access to the version of the program that you used to create the document. A current movement is for word processors to save documents in XML, which is a step in the right direction.

Finally, consider the cost factor. Most users have no problem shelling over some money for a program that makes them more productive. However, sometimes you're paying a lot for a full program and only using a small subset of its features. Consider MS Word--why should we have to pay so much for the program, not to mention the upgrades, when we only want to use a very small number of its features?

Once you consider all these factors, I think you'll see that using an alternative like LaTeX for your document preparation needs makes sense.

What Is LaTeX?

Before getting started, let's look at what LaTeX is all about. First and foremost, LaTeX is not a word processor. It's a document preparation and typesetting system that excels in producing high-quality documents. This is the main attraction of LaTeX--its output is both fantastic and printer ready. In fact, LaTeX is the standard document preparation system in academia. It's mainly used by scientists and mathematicians, and is the accepted submission format for most journals in these fields. As you will see, LaTeX is also very useful for your daily writing needs.

LaTeX is composed of two main systems: TeX and a macro package that sits on top of it called LaTeX. In this article, I will use LaTeX to refer to the entire system.

TeX (pronounced Tech) was written by Donald Knuth in the late 1970s. If you are not familiar with Donald Knuth's work, stop now and check out his web site. Knuth is considered one of the pioneers of computer science and his books have influenced generations of programmers and computer scientists. TeX came to life because of Knuth's frustration with the quality of typesetting for his books.

As Knuth writes in the foreword of The TeX book, "TeX is a new typesetting system intended for the creation of beautiful books--and especially for books that contain a lot of mathematics. By preparing a manuscript in TeX format, you will be telling a computer exactly how the manuscript is to be transformed into pages whose typographic quality is comparable to that of the world's finest printers."

The TeX software is basically a macro processor, with an accompanying macro package called Plain TeX. TeX is exceedingly stable. In fact, Donald Knuth offers a reward if you're the first person to report a new error.

LaTeX (pronounced Lah-tech) is a macro package written by Leslie Lamport. This macro package uses the typesetting functionality of TeX, but adds high-level abstractions that simplify the creation of documents. According to the TeX FAQ, "LaTeX allows markup to describe the structure of a document, so that the user need not think about presentation. By using document classes and add-on packages, the same document can be produced in a variety of different layouts."

To sum up, TeX provides typesetting facilities, and LaTeX provides the high-level macros that make TeX easier to use, and it simplifies the creation and production of documents.

To use LaTeX, you first compose a LaTeX source file. A LaTeX source file is a text file with a .tex extension, which consists of your writing content and LaTeX control sequences. Next, you pass the document to the LaTeX system, where it reads the document, processes the file, or files, and produces its output files. In practice, the process is more complex. For more information see the "Introduction" in The LaTeX Companion, which is listed in the resources section.

The primary strength of LaTeX is its typesetting quality. It effectively enforces a consistent and professional layout and typographical convention for your document. As such, it provides structure to your document and makes it far more professional and readable. Additionally, it relieves you from thinking about the visual aspects (form) of the document and making ad hoc decisions concerning the document's appearance. This enables you to think about the substance of your writing and let LaTeX worry about the form of the document, and it allows you to produce the highest quality output.

Another nice feature of LaTeX is that it renders your source document in many output formats. For example, imagine writing your resume in LaTeX and producing a PDF, Postscript, HTML, and RTF version--all from a single source file and rendered in the highest quality output.

I won't lie to you, LaTeX does have a learning curve, both technically and conceptually, and it is not right for all users or purposes. This is especially true if you have primarily used word processors. That said, I think much of the complexity has been masked by more advanced LaTeX writing environments such as those discussed in this article. In the end, your decision, like life, is simply a tradeoff. You can get a lot from LaTeX, but there is a time investment; one that I feel is justified.

Aqua-Based LaTeX Implementations

Now that you know something about LaTeX, let's look at the most popular Aqua-based implementations for Mac OS X. In this category, there are several players, including TeXShop, iTeXMac, and OzTex. I will also cover BibDesk, a bibliography manager for Mac OS X. This list focuses on programs that are freely available or are shareware--commercial implementations such as ScientificAssistant are not discussed.

Also, my comments focus on each program's usability and highlight some of their features. My comments are intended to give you a flavor of the applications rather than a complete review of their features. For this information, go directly to the program's web site.

Integrated LaTeX Environments

TeXShop is an integrated writing environment for composing LaTeX documents. Accordingly, it's a front end for TeX, and includes an editor, previewer, and many other features to support composing LaTeX.

TeXShop is available in a compiled version (.dmg file), or as source code. It can also use other programs that support the writing process, including spell checking, bibliography management, and equation editing. The TeXShop distribution does not come with TeX itself, but uses the TeXLive-teTeX distribution of Tex, which you need to install yourself.

TeXShop uses Apple's built-in spell checker (like TextEdit), but can also use the Mac OS X port of Aspell, called cocoAspell. Another useful feature is that TeXShop contains menus that hold LaTeX macros and it documents navigation features. Using the macro menu enables you to easily insert common LaTeX commands into your document without remembering their syntax. TeXShop supports many more features than described here, as well as an excellent PDF document previewer. These features are well documented in its online help.

For many Macintosh users, TeXShop is a good solution that offers many advantages over the other packages. It's written in Cocoa so it feels like a Mac OS X program and using it requires very little work. It also contains plenty of features, customization options, and online help.

(click for larger image)

Pages: 1, 2, 3

Next Pagearrow