Chapter 4. Macro Packages

$Revision: 1.1 $

$Date: 2002/08/23 14:31:13 $

Everyone who uses TeX uses a macro package (also called a “format”). A macro package extends TeX to provide functionality that is suited to a particular task or set of tasks.

This chapter provides a summary of TeX macro packages. General-purpose packages designed to typeset a wide range of documents---articles, books, letters, and reports---are examined first. The general-purpose packages described are Plain TeX, Extended Plain TeX, LaTeX2e, LaTeX, AMSTeX, AMSLaTeX, Lollipop, and TeXinfo. After surveying the general-purpose packages, several special-purpose packages designed to handle specific tasks---typesetting transparencies, music, chemistry or physics diagrams, etc.---are described. The special-purpose packages surveyed are SliTeX, FoilTeX, Seminar, MusicTeX, ChemStruct, and ChemTeX.

There are a lot of overlapping features and similar commands in the general-purpose packages. To understand why this is the case, consider how a new macro package comes into existence. An ambitious person, who is very familiar with TeX, decides that there are some things she would like to express in her documents that are difficult to express with existing formats. Perhaps, for example, no existing format produces documents that match the precise specifications required for publishing in her field, or perhaps she has in mind a whole new document structuring paradigm. A more mundane possibility is simply that she has been customizing an existing format for some time and now feels it has enough unique features to be useful to others.

In any event, a new format is born. Now, if this format is designed for a very specific task, writing multiple-choice mathematics exams, for example, it might not have very many general-purpose writing features. On the other hand, if it is designed for writing longer, more general documents (e.g., history textbooks or papers to appear in a particular journal) then there are a number of features that it is likely to include; provisions for numbered lists, cross references, tables of contents, indexes, and quotations are all examples of features common to many documents.

To support these common features, many macro packages have similar control sequences. This stems from the fact that they are all built on top of a common set of primitives and that macro package authors tend to copy some features of other packages into their own.

You may find that you'd like to use the features of several different packages in the same document. Unfortunately, there is no provision for using multiple formats to process a single document. The features required to process most documents are shared by all of the general-purpose formats, however. You are more likely to need multiple macro packages if you want to use a special format to construct a diagram or figure and incorporate it into a document. Chapter Chapter 6, Chapter 6, describes several ways to take “electronic snippets” of one document and insert them into another, which is one possible solution to this problem.

If you're beginning to feel a little lost, have no fear. Most general-purpose formats are sufficient for most documents. And there's no reason why every document you write has to be done with the same format. Many people find LaTeX and Plain TeX sufficient, but if you're writing an article for a particular journal and someone has written a format specifically for that journal's documents, by all means use it. It is more likely, however, that someone has written a style file which tailors LaTeX to the requirements of the journal.

In addition to describing some common macro packages in this chapter, I'll describe how to build format files for them. If the packages that you want to use have already been installed at your site, you can ignore the installation sections.

The packages that you find most convenient will depend on the tasks you perform and how well each package suits your work style. The list of packages in this chapter is not meant to be all-inclusive, nor is it my intention to suggest which packages are best. Use the ones you like, for whatever reasons.

I can hear some of you already, “I don't really need a macro package,” you say, “I can roll my own with just TeX.”

And you are absolutely correct.

I don't recommend it, however. It's akin to using your compiler without any of the built-in functions. Most TeX primitives offer little support by themselves for writing documents.

Installation: Making Format Files

A format file, as described in Chapter Chapter 3, Chapter 3, is a special “compiled” version of a macro package. The iniTeX program interprets all of the control sequences in a macro package and writes the corresponding memory image into a file. Loading a format file is much faster than loading individual macro packages in your document because TeX does not have to interpret any of the control sequences while it is also processing text.

In general, all format files should be stored in the same directory.[40] If you install TeX in a directory called tex, then formats typically go in a directory called formats in the tex directory. This is not universally the case because you need separate format directories for big and small TeXs.[41]

Usually, an environment variable indicates where the format files are located. Environment variables are a common way of customizing your interaction with programs. They are usually set in your AUTOEXEC.BAT file for MS-DOS, CONFIG.SYS for OS/2, or the rc-file for a shell (i.e., .cshrc, .kshrc) on unix systems. Any good reference book for your operating system or shell will describe how to use environment variables.

A common name for the environment variable that indicates where TeX formats are located is TEXFORMATS. Implementations that provide big and small TeXs need another variable to indicate the directory that contains formats for big TeX.

IniTeX is not always a separate program. Some implementations of TeX combine the functionality of TeX and iniTeX into a single program and use a special switch at runtime to determine which function to perform. In this chapter, all of the examples use the program name initex to identify iniTeX. If you use an implementation that doesn't provide a separate iniTeX program, you should use the TeX program with the iniTeX switch instead. For example, for emTeX, use tex /i instead of initex when you build a format.

Like TeX, iniTeX needs to be able to find input files. Usually, this is accomplished by searching the directories listed in the TEXINPUTS environment variable. Place the input files that iniTeX needs in a directory on the TEXINPUTS path before running iniTeX unless otherwise directed. The TEXINPUTS environment variable is discussed in the “the section called “User Files”” section of Chapter Chapter 3.

Hyphenation Patterns

In order for TeX to correctly hyphenate words, every format file must contain a set of hyphenation patterns. The patterns are part of an algorithmic solution to the problem of breaking a word into syllables for hyphenation.

The details of the hyphenation algorithm (given in Appendix H of The TeXbook [kn:texbook]) are too complex to describe here, but two aspects of this solution deserve particular emphasis. First, using patterns means that a dictionary of hyphenated words is not necessary.[42] This saves a lot of space and time. Second, by loading different sets of patterns, TeX can achieve equal success at hyphenating any language---even English ;-). There are actually at least two sets of hyphenation patterns for English, one for British English and one for American English. Chapter  Chapter 7, Chapter 7, describes how to load multiple sets of hyphenation patterns for typesetting multilingual documents.

General-purpose Formats

This section describes several macro packages that are designed for formatting standard documents like articles or books. In order to provide some form of comparative measure, each macro package is used to create the same document, a one-page report that looks like Figure Figure 4.1. I constructed this example to demonstrate a few common elements in a document: several sizes of headings, a paragraph of text, inline and displayed mathematics, and a few fonts. There are lots of other things that aren't shown (tables, figures, footnotes, etc.), and these elements vary as much as any other in the different macro packages.

Figure 4.1. Sample page

Observant readers will notice that the examples are shown in the Computer Modern fonts while the rest of this book uses different fonts.[43] There are a number of reasons why the example is shown in Computer Modern. For one thing, all of the formats discussed here use the Computer Modern fonts by default. Using a different set of fonts would only add more complexity to each example. A more subtle problem is that I do not have appropriate mathematics fonts for Garamond. There are a number of complex issues involving the use of fonts in TeX. They are discussed in Chapter Chapter 5, Chapter 5.

Plain TeX

Plain TeX is the format written by Donald Knuth during the development of TeX. It is described fully in The {TeX}book [kn:texbook].

Plain TeX ties together the TeX primitives in a way that makes it practical to work in TeX. If you do not have a computer programming background, you may find Plain TeX a little bit intimidating. It is definitely a “roll your own” environment. Although it demonstrably contains all of the functionality required to write everything from letters to books, there is very little “user-friendly” packaging around the internals of TeX.

Aside from user interface considerations, which are highly subjective, Plain TeX lacks some functionality when compared to other formats. There is no provision in Plain TeX for automatically numbered sections, labelled figures, tables of contents, indexes, or bibliographies. Any of these functions can be constructed in Plain TeX if you are willing to invest the time and energy required to write your own macros, but they are not built into Plain TeX.

If you enjoy writing your own macros or plan to produce novel types of documents, a firm grasp of Plain TeX will allow you to write anything in TeX. A firm grasp of Plain TeX also makes it easier to understand and modify other formats (like LaTeX) that are built on top of Plain TeX.

In addition, Plain TeX is the only format that is always distributed with TeX. The other formats discussed in this chapter are freely available but do not come with TeX.

The Plain TeX input that produces the report in Figure Figure 4.1 is shown in Example Figure 4.2.

Figure 4.2. Plain TeX Input

Building the Plain TeX format

To build Plain TeX, you need only two files: plain.tex and hyphen.tex. These files are distributed with TeX so they should be available as soon as you have installed TeX. The hyphen.tex file is language-dependent. Readers who frequently work with non-English text should read Chapter  Chapter 7 for more information about obtaining non-English hyphenation patterns.

The command:

\$ initex plain \dump

will create the Plain TeX format. Move the resulting files, plain.fmt and plain.log, into your TeX formats directory.

Extended Plain TeX

Extended Plain TeX extends Plain TeX in a number of useful ways without forcing you to use any particular “style” of output. The argument is this: although Plain TeX really doesn't provide all of the features that you need (tables of contents, cross references, citations, enumerated lists, convenient access to verbatim input, etc), many of these features don't have any direct impact on the appearance of your document. Unfortunately, other general-purpose macro packages like LaTeX, which do provide these features, tend to force you to accept their notion of what the typeset page should look like.[44]

Extended Plain TeX is an attempt to solve that problem. It provides many behind-the-scenes features without providing any general page layout commands (like \chapter or \section), which means that these features can be used inside Plain TeX without much difficulty and without changing the layout of typeset pages.

Building the Extended Plain TeX format

To build the Extended Plain TeX format, you need the plain.tex and hyphen.tex files required to build the Plain format as well as the eplain.tex file distributed with Extended Plain TeX.[45] Make and install the Plain TeX format first, then change to the directory that contains the Extended Plain TeX distribution.

The command:

$ initex \&plain eplain \dump

will create the Extended Plain TeX format. Move the resulting files, eplain.fmt and eplain.log, into your TeX formats directory.

LaTeX2e Versus LaTeX

The tremendous popularity of LaTeX in the TeX community has had an unfortunate side effect: because it is a very familiar and flexible format, many people have used it as the basis for extensions of one sort or another. This has resulted in a wide range of (slightly) incompatible formats and a lot of frustration.

This situation is being rectified by a new release of LaTeX, currently called LaTeX2e. The new release replaces the existing dialects of LaTeX (LaTeX with and without NFSS, SliTeX, AMSLaTeX, etc.) with a single core system and a set of extension packages. LaTeX2e includes a compatibility mode which will allow it to continue to format existing documents without change (provided that they do not rely on local modifications to the LaTeX format, of course). Local modifications can also be incorporated into the LaTeX2e system as extension packages, making LaTeX2e a complete replacement for all existing versions of LaTeX and packages closely derived from LaTeX.

The most significant and least compatible difference between LaTeX and LaTeX2e is the font selection scheme. There are many control sequences for selecting fonts in LaTeX. Some control the typeface (\rm, \tt, \sc, etc.); some the size (\small, \normalsize, \large, etc.); and some the appearance (\it, \bf, \em, etc.). Under the Old Font Selection Scheme (OFSS), the control sequences for selecting a font completely override any font selection already in place. Consider, for example, the control sequences \it and \bf, which switch to italic and boldface. Using \bf\it produces italic text, and \it\bf produces boldface text, and neither produces boldfaced-italic text (which is probably what you wanted).

Under the New Font Selection Scheme, typeface (called family in NFSS parlance), appearance (called series and shape), and size are viewed as orthogonal components in font selection. Because these parameters are independent, selecting an italic appearance with the \it control sequence switches to italic in the current typeface and size. Under the NFSS, \bf\cs{it} does select boldface-italic in both the current typeface and size (if it is available).

LaTeX2e supports only the NFSS, version 2 (called NFSS2). For more than a year, the NFSS (initially version 1, and more recently version 2) has been available as an extension for LaTeX 2.09. However, in light of stable test releases of LaTeX2e, the NFSS2 package for LaTeX 2.09 has been withdrawn. The discussion of NFSS in this book applies equally well to LaTeX 2.09 with NFSS2, but it is described in terms of LaTeX2e in an effort to be more applicable in the future. The NFSS is discussed in more detail in Chapter Chapter 5.


Leslie Lamport's LaTeX format is probably the most commonly used TeX format. It is described in LaTeX: A Document Preparation System [ll:latexbook] and many other TeX books. LaTeX2e is the new standard LaTeX. It is described in {The LaTeX Companion} [latexcompanion]. The next edition of LaTeX: A Document Preparation System [ll:latexbook] will also describe LaTeX2e.

The central theme of LaTeX is “structured document preparation.” An ideal LaTeX document is described entirely in terms of its structure: chapters, sections, paragraphs, numbered lists, bulleted items, tables, figures, and all the other elements of a document are identified descriptively. For example, you enclose figures in a figure environment identified by the control sequences \begin{figure} and \end{figure}.

When you are ready to print your document, select an appropriate document class, and LaTeX formats your document according to the rules of the selected style. In the case of the ideal document, it might first be printed in a magazine or newsletter using the article class. Later, when it is incorporated into a book, selecting the book class is all that is required to produce appropriate output; the document itself is unchanged.

LaTeX is written on top of Plain TeX. This means that almost any control sequence or macro that you learn about in Plain TeX can also be used in LaTeX. Of course, LaTeX insulates you from many Plain TeX commands by wrapping a much more user-friendly interface around them.

The LaTeX2e input that produces the sample page in Figure Figure 4.1 is shown in Example Figure 4.3. The only difference between this document and an old LaTeX document is the use of the \documentclass declaration instead of the \documentstyle declaration.[46] For more complex documents, other minor changes may also be necessary.

Figure 4.3. LaTeX2e Input

Building the LaTeX2e format

The LaTeX2e distribution is available from the directory macros/latex2e/core in the CTAN archives.

The following steps will build the LaTeX2e format. For more complete installation instructions, read the file install.l2e in the LaTeX2e distribution.

  1. Place the LaTeX2e distribution in a temporary directory and make that directory the current directory. After the installation is complete, you will need to move only selected files into the standard places.

  2. Restrict to only the current directory the directories that TeX searches for input files

    This can usually be accomplished by setting the environment variable TEXINPUTS[47] to a single period or the absolute path name of the current directory.

  3. Copy the hyphen.tex file from the Plain TeX distribution into the current directory.

  4. Issue the command:

    \$ initex unpack2e.ins

    This will unpack all of the distribution files.

  5. Build the format file by issuing the command:

    \$ initex latex2e.ltx

    Move the resulting files latex2e.fmt and latex2e.log into the TeX formats directory.

  6. In addition to the files needed to build the format, unpacking the LaTeX2e distribution creates many files that are needed for formatting documents. These files must be placed in a location where TeX will find them. However, in order to maintain a functioning LaTeX 2.09 system, you must not place the new files in the same input directory as the existing files.[48]

    Create a new directory (or folder) for the new files. On the unix system that I use, where existing input files are stored in a directory called /usr/local/lib/tex/inputs, I created /usr/local/lib/tex/latex2e to store the new files. You will have to add the new directory to the front of the list of directories that TeX searches for input files whenever you format a document with LaTeX2e.

    Move the files that the installation script produces into the new directory. Move the files docstrip.tex, latexbug.tex, sfontdef.ltx, slides.ltx, testpage.tex, and all of the files that end in .cfg, .cls, .clo, .def, .fd, and .sty. You should also move the files and someplace where MakeIndex can find them. (MakeIndex is described in Chapter  Chapter 12, Chapter 12.)

    One of the aspects of the test releases that continues to change is the exact list of files that must be moved. Consult the install.l2e file in the distribution for the exact list. The list above is from the test version of January 28, 1994.


This section briefly covers LaTeX version 2.09. This version of LaTeX is still very widely used but it is being phased out.

The LaTeX input to produce the sample page in Figure Figure 4.1 is shown in Example Figure 4.4.

Figure 4.4. LaTeX Input File

Support for the NFSS in LaTeX 2.09 has been withdrawn. If you need to build a format with support for NFSS, consult the “the section called “LaTeX2e”” section of this chapter.

Building the LaTeX format with the OFSS

The LaTeX distribution[49] includes three subdirectories, sty, doc, and general. All of the LaTeX files required to build the format file are in the general subdirectory. You will also need the hyphen.tex file required to build the Plain format.

In the general subdirectory, the command:

\$ initex lplain

will create the LaTeX format. Move the resulting files, lplain.fmt and lplain.log, to the TeX formats directory. In order to complete the installation, copy the files from the sty directory in the LaTeX distribution into a directory where TeX searches for input files.


When the American Mathematical Society selected TeX as a document preparation system, they decided to extend it in a number of ways to make the creation of papers and journals easier. They had two goals: to make it easier for authors to write mathematical papers in TeX and to make the resulting papers conform to a particular set of style specifications. AMSTeX is described completely in The Joy of TeX [ms:joyoftex].

AMSTeX provides many commands that resemble LaTeX environments. These have the form \environment … \endenvironment. In addition, AMSTeX provides the notion of a document style to control style-related formatting issues.

Another important contribution made by the American Mathematical Society when creating AMSTeX was the construction of a large number of new fonts. The American Mathematical Society provides fonts with many more mathematical symbols than the fonts that come with TeX. These fonts are available as a separate package and can be used with any TeX macro package, not just AMSTeX.

The AMSTeX input required to produce the document in Figure Figure 4.6 is shown in Example Figure 4.5. The result of formatting this document does not appear exactly like Figure Figure 4.1 because AMSTeX uses the style conventions of the American Mathematical Society.

Figure 4.5. AMSTeX Input File

Figure 4.6. AMS sample page

Building the AMSTeX format

In order to build the AMSTeX format, you need the plain.tex and hyphen.tex files from Plain TeX and the amstex.ini and amstex.tex files from the AMSTeX distribution.

The command:

\$ initex amstex.ini

will create the AMSTeX format. Move the resulting files, amstex.fmt and amstex.log, into your TeX formats directory.


AMSLaTeX, like AMSTeX, provides many features to make typesetting mathematics convenient while meeting the standards of the American Mathematical Society for publication. However, AMSTeX lacks many of the features that are present in LaTeX, like automatically numbered sections and tools for creating tables of contents and indexes.

When LaTeX gained popularity, many authors requested permission to submit articles to the American Mathematical Society in LaTeX. In 1987, the American Mathematical Society began a project to combine the features of AMSTeX with the features of LaTeX. The result is AMSLaTeX.

AMSLaTeX provides all of the functionality of LaTeX because it is an extension of LaTeX. It also provides the functionality of AMSTeX in LaTeX syntax and access to additional mathematical constructs and math symbols not present in LaTeX. .

The input required to produce Figure Figure 4.1 is not shown because they do not differ significantly from the LaTeX sample. Because the sample document doesn't use any of AMSLaTeX's additional features, it is exactly the same as the LaTeX document.

Building the AMSLaTeX format

The AMSLaTeX macros are embodied entirely in style files for LaTeX. It is not necessary to build a special format file. However, the AMSLaTeX macros require the New Font Selection Scheme (NFSS). Consult the section on LaTeX, above, for instructions on building the LaTeX format with NFSS.


It can be argued that LaTeX has the following deficiency: although there are many different style options available, it is not easy for a novice user to change a style option. Changing the internals of most LaTeX style options requires a deep understanding of TeX.

The Lollipop format is very different from the other formats. The central thrust of Lollipop is that it should be easy to change and customize document styles. All Lollipop documents are built from five different generic constructs: headings, lists, text blocks, page grids, and external items.

The Lollipop input required to produce a document like the sample page in Figure Figure 4.1 is shown in Example Figure 4.7.

Figure 4.7. Lollipop Input File

Building the Lollipop format

To make the Lollipop format, you need the Lollipop distribution and the file hyphen.tex from the Plain TeX distribution.

This command will create the Lollipop format:

\$ initex lollipop \dump

It should be performed in the directory where you installed the Lollipop distribution so that all of the Lollipop files can be located. Move the resulting files lollipop.fmt and lollipop.log into your TeX formats directory.


The TeXinfo format is a general-purpose format, but it was designed to support a particular application: to produce both online documentation and professional quality typeset documentation from the same source file. It is discussed in more detail in Chapter Chapter 10, Chapter 10.

The input file shown in Example Figure 4.8 produces the typeset output shown in Figure Figure 4.9. The input file for this example is complicated by the fact that it contains mathematics. None of TeX's sophisticated mechanisms for handling mathematics are applicable to plain ASCII online documentation. The online documentation produced by the example in Example Figure 4.8 is shown in Figure  Figure 4.10.

The TeXinfo format is the official documentation format of the Free Software Foundation (FSF). Although less commonly used, a LaTeX variant called LaTeXinfo is also available.

Figure 4.8. TeXinfo Input

Figure 4.9. TeXinfo sample page

Figure 4.10. Online documentation produced by MakeInfo

Other Formats

There are a number of other macro packages available for TeX. Some of them are summarized below. The fact that they are not discussed more fully here (or listed below, for that matter) is not intended to reflect on the quality of the format. The formats discussed above are examples of the ways in which TeX can be extended. All of the formats below extend TeX in a way similar to one of the formats already mentioned. For any particular application, one of these macro packages might be a better choice than the formats discussed above.


Provides support for typesetting critical editions of texts in a format similar to the Oxford Classical Texts with marginal line numbers and multiple series of footnotes and endnotes keyed by line number. EDMAC is available from the CTAN archives in the directory macros/plain/contrib/edmac.


Provides support for multilingual documents in French and English. INRSTeX is available from the CTAN archives in the directory macros/inrstex.


Extends AMSTeX with LaTeX-like features and improved support for commutative diagrams. LamSTeX is available from the CTAN archives in macros/lamstex.


Extends LaTeX to provide support for typesetting articles for journals of the American Physical Society, the Optical Society of America, and the American Institute for Physics. REVTeX is available in the directory macros/latex/contrib/revtex of the CTAN archives.


Provides facilities for typesetting articles, papers, and theses. It is particularly tuned for physics papers. TeXsis also provides support for other kinds of documents, such as letters and memos. It is based upon Plain TeX. TeXsis is available from the CTAN archives in the directory macros/texsis.

In addition to REVTeX and TeXsis, there are several other packages in the macros directory on CTAN that were designed for typesetting documents about physics: PHYSE, PHYZZX, and PSIZZLE.


Supports interactive use of Mathematica on unix workstations running GNU emacs. Mathematica explorations can be annotated with TeX/LaTeX, and Mathematica graphics can be incorporated into documents. TeX/Mathematica is available from the CTAN archives in the directory macros/mathematica.


Supports typesetting screenplays in TeX. ScriptTeX is available from the CTAN archives in the directory macros/scripttex.


Supports typesetting articles for economic journals. VerTeX is available from the CTAN archives in the directory macros/plain/contrib/vertex.

Special-purpose Formats

In addition to the general-purpose packages discussed above, there are dozens, if not hundreds, of extensions to TeX that are designed for very specific tasks. Many of the extensions are LaTeX style files; they provide styles for many academic journals, university theses, resum\'es, diagrams of various sorts, PostScript interfaces, linguistics, multinational language support, unix “man” pages, program listings, and countless other tasks.

To give you a feel for the range of tasks that TeX can perform, I've selected a few packages to highlight the latitude of customization that is possible. Figure Figure 4.11 shows the chemical structure of caffeine (a molecule dear to my heart) rendered with the ChemTeX package. The source is shown in Example  Figure 4.12. Another chemistry package, ChemStruct, was used to draw Figure  Figure 4.13. Its source is shown in Example  Figure 4.14. Taking TeX in another direction, the MusicTeX package was used to typeset the first two bars of Mozart's K545 sonata in C-major in Figure Figure 4.15. The MusicTeX input is shown in Example  Figure 4.16. Several more examples are presented in Chapter Chapter 7 where formats for typesetting non-English languages are described.

Figure 4.11. Caffeine by ChemTeX

Figure 4.12. The ChemTeX Source for Caffeine

Figure 4.13. A lithium cation rendered by ChemStruct

Figure 4.14. The ChemStruct Source for the Lithium Cation

Figure 4.15. A little Mozart…

Figure 4.16. The MusicTeX Source for Figure Figure 4.15

Another popular special-purpose application of TeX is the production of transparencies, also called foils or slides. There are a few different options for this application.


SliTeX is part of the standard LaTeX distribution. Input to SliTeX consists of a main file and a slides file. Individual slides are composed in a slide environment.

SliTeX has provisions for black-and-white slides, color slides, and overlays. Unlike the other slide-making formats, which rely on \special printer commands[50] to incorporate color, SliTeX produces separate output pages for each color. For example, if you use red to highlight words on an otherwise black-and-white slide, SliTeX will produce two output pages for the slide: one with all the black text (excluding the words in red) and one with just the red words. Both of these pages will be printed in black. You must construct the colored slide by copying the pages onto colored transparencies and overlaying them. Producing slides with overlays in the same color is accomplished with a special “invisible” color. This method of producing colored transparencies has been made obsolete by modern color printers. Of course, nothing prevents you from using the \special extensions of your DVI driver in SliTeX to produce colored transparencies directly on a color printer.

SliTeX has always been a separate macro package, distinct from and not 100\% compatible with LaTeX. With the introduction of LaTeX2e, SliTeX is simply an extension package to the LaTeX2e core format. Support for a separate SliTeX format is being phased out.


FoilTeX is an extension of LaTeX for producing slides. The primary advantage of FoilTeX over SliTeX is that it is completely compatible with LaTeX.[51] Note, however, that the defaults in many cases are not precisely the same as LaTeX because of the radically different goal of FoilTeX.

FoilTeX provides support for running headers and footers, modified theorem environments for better mathematics in slides, support for AMS and PostScript fonts, and colors.

Color slides in FoilTeX are handled by DVI driver \special commands (most commonly dvips \specials). However, FoilTeX includes a number of new and extended features for better handling of color. See the section “the section called “AMSTeX”” later in this chapter for a detailed discussion of using color in TeX.


The Seminar style is another alternative for producing slides and notes. Like FoilTeX, the Seminar style is designed to work on top of LaTeX. (Seminar also works with AMSLaTeX.) \ The Seminar style is designed to produce output for a PostScript printer. It isn't strictly necessary to produce PostScript output, but if you do not, many of Seminar's features will be unavailable to you.

Seminar provides for a mixture of portrait and landscape styles and can support color using either a color-separation technique (similar to SliTeX's method) or direct use of PostScript color. In either case, the PSTricks macro package is required. (Consult the section “the section called “PSTricks”” in Chapter Chapter 6, Chapter 6, for more information.)

The Seminar style has support for a number of interesting options (including two-up printing of slides), automatic resizing by changing a magnification parameter, instructions for converting your SliTeX slides, and several extensive demonstration files. Also included are explicit instructions for placing Encapsulated PostScript drawings in your slides.

TeX in Color

With color printers and copiers becoming more common, the application of color, especially in transparencies, is more important than ever. Unfortunately, TeX knows nothing about color.

A little reflection about the design of TeX will make it clear why this is the case. TeX produces device-independent output. Even when color printers are as common as “regular” printers, if that ever becomes the case, it will always be true that color is an inherently device-dependent attribute. It does not make sense for TeX to understand color. However, this does not prevent TeX from using color.

At the lowest level, all that is required to use color in TeX is some way of telling the printer “start printing in <color> here.” This is easily accomplished with a \special command. In the discussion that follows, the dvips \special commands are used as concrete examples, but conceptually, any color printer can be used in this way.

Setting Up Color

Color support at the DVI driver level is provided by \special commands, but these are not typically convenient to enter directly into your document. Frequently, these commands are specified in terms of percentages of red, green, and blue (RGB color) or cyan, magenta, yellow, and black (CMYK color).

Higher-level support is provided by a collection of color control sequences. These sequences are loaded either by inputting the file colordvi.tex (in Plain TeX, for example) or using the colordvi style file (in LaTeX).

dvips defines the colors in terms of “crayon names.” If you need very precise control of the colors, you can adjust the precise mix of CMYK values in the file colordvi.tex after comparing the output of your printer with a standard scale (typically, the PANTONE scale). The following color names are standard in dvips.

Apricot Emerald OliveGreen RubineRed
Aquamarine ForestGreen Orange Salmon
Bittersweet Fuchsia OrangeRed SeaGreen
Black Goldenrod Orchid Sepia
Blue Gray Peach SkyBlue
BlueGreen Green Periwinkle SpringGreen
BlueViolet GreenYellow PineGreen Tan
BrickRed JungleGreen Plum TealBlue
Brown Lavender ProcessBlue Thistle
BurntOrange LimeGreen Purple Turquoise
CadetBlue Magenta RawSienna Violet
CarnationPink Mahogany Red VioletRed
Cerulean Maroon RedOrange White
CornflowerBlue Melon RedViolet WildStrawberry
Cyan MidnightBlue Rhodamine Yellow
Dandelion Mulberry RoyalBlue YellowGreen
DarkOrchid NavyBlue RoyalPurple YellowOrange

Using Color

After dvips has loaded colordvi, typesetting text in color is simply a matter of using the appropriate color control sequence. For example, to typeset something in red, use the \Red control sequence in your document, like this:

\Red{something in red}

Alternatively, you can change the default text color with the \text\texttt{color} control sequences. To make default color for all text blue, enter:


To change the background color, use the \background macro. For example, to make the current and all future pages yellow, enter:


You can enter a precise color by specifying it in terms of its CMYK components. The \Color and \textColor macros exist for this purpose. To typeset some text in a color that is 25\% cyan, 35\% magenta, 40\% yellow, and 10\% black,[52] enter:

\Color{.25 .35 .4 .1}{some text}

Now I've Got Color, but I Need Black and White!

If you have reason to print a colored TeX document on a black and white printer, you don't have to tear out all of the color commands. dvips includes a blackdvi file (analogous to colordvi---an input file or style file depending on your macro package), which translates all color commands into black and white.

Alternatively, “good” implementations of PostScript in a black and white printer should translate all colors into shades of grey. This can be an inexpensive way to preview a color document. Most screen previewers simply ignore color commands so they print in black and white even if the document is colored.

Color Under LaTeX2e

At the time of this writing, the LaTeX2e team has not officially adopted a standard for using color. However, it is likely to follow a slightly different model than the one described above. The final design should provide color selection commands that are device-independent at the DVI driver level (in other words, the color commands will not insert device-specific commands, like snippets of PostScript, into the DVI files).

Color Is Subtle

Color commands implemented as \special commands may introduce occasional problems. For example, if TeX introduces a page break in a paragraph that you have typeset in yellow (\Yellow{This is a long paragraph...}), the resulting output may print the page footer (and even the header) in yellow, although that was not intended.

Circumventing these problems may require careful use of color commands in front of text that you want to appear black. For example, in Plain TeX the difficulty described above can be avoided by specifying that the page number should be printed this way:


This definition guarantees that the page number will be set in black, and because it is a local color change, colored text can flow across the page around it.

You may want to make sure that other typographic elements are printed in the current global color (which may vary). dvips provides a local color macro called \globalColor for that purpose. Every time the text color is changed globally (with a \text\texttt{Color} command), \globalColor is redefined to print text in that color.

Further Reading

Read the documentation for your DVI driver carefully with respect to color. Because it is device-dependent, there is a lot of room for interpretation, and it may not always be obvious why some things appear the way they do. And DVI drivers are free to implement color in any way they choose.

[39] At the time of this writing, it's actually still in test-release, but it may be available as a standard release by the time you read this.

[40] On Macintosh systems and other environments that don't have directories, format files are typically stored in their own folders (or other metaphorically appropriate place ;-).

[41] The distinction between big and small TeX is described in the section called “the section called “What Do You Run?”” in Chapter Chapter 3.

[42] {A small set of exceptions is maintained because the algorithm isn't perfect.}

[43] {Really observant readers may have noticed that it's a version of Garamond ;-)}

[44] {Of course, that's not strictly true. You can change the page layout of LaTeX (and most other packages) to be almost anything, but it does require learning a lot about the macro package. If you are already familiar with Plain TeX (or some other Plain TeX-derived package), you probably have a set of macros that produce documents in the style you like. Why reinvent the wheel?

[45] {Extended Plain TeX is available in the macros/eplain directory in the CTAN archives.}

[46] {LaTeX2e will process documents that use \ documentstyle in LaTeX 2.09 compatibility mode.}

[47] {Under emTeX, this variable is called TEXINPUT. On the Macintosh, file searching is frequently controlled by a configuration file or dialog box.}

[48] {Strictly speaking, this is only true for files that have the extension .sty because the old version of LaTeX will not attempt to use the other files.}

[49] {LaTeX is available in the macros/latex/distribs/latex directory in the CTAN archives.}

[50] {The $\$special mechanism is a way of passing arbitrary information through TeX to the DVI driver that will ultimately print the document.}

[51] {With the caveat that it still uses the Old Font Selection Scheme.}

[52] {I made these numbers up. I take no responsibility for the artistic merits (or lack thereof) of the resulting color.}