Go to the first, previous, next, last section, table of contents.


Color macro files

All the color macro commands are defined in `colordvi.tex' (or `colordvi.sty'). To access these macros simply add to the top of your plain TeX file the command:

\input colordvi

For (the obsolete) LaTeX 2.09, add the `colordvi' style option as in:

\documentstyle[12pt,colordvi]{article}

For LaTeX 2e, these examples are not applicable. Instead, please see the documentation for the graphics package, available from `CTAN:doc/latex/graphics/'. See also `CTAN:doc/epslatex.ps'.

These macros provide two basic kinds of color macros: ones for local color changes (a few words, a single symbol) and one for global color changes (the whole document). All the color names use a mixed case scheme to avoid conflicts with other macros. There are 68 predefined colors, with names taken primarily from the Crayola crayon box of 64 colors, and one pair of macros for the user to set his own color pattern (see section User-definable colors). You can browse the file `colordvi.tex' for a list of the predefined colors. The comments in this file also show a rough correspondence between the crayon names and Pantones.

A local color command has the form

\ColorName{this is the color ColorName}

where ColorName is the name of a predefined color, e.g., `Blue'. As shown, these macros take one argument, the text to print in the specified color. This can be used for nested color changes since it restores the original color state when it completes. For example:

This text is normal but here we are \Red{switching to red,
\Blue{nesting blue}, recovering the red} and back to original.

The color nesting level has no hard limit, but it is not advisable to nest too deeply lest you and the reader lose track of the color history. The global color command has the form

\textColorName

These macros take no arguments and changes the default color from that point on to ColorName. This of course can be overridden globally by another such command or locally by local color commands. For example, expanding on the example above, we might have

\textGreen 
This text is green but here we are \Red{switching to red, 
\Blue{nesting blue}, recovering the red} and back to 
original green.
\textCyan 
The text from here on will be cyan until
\Yellow{locally changed to yellow}. Now we are back to cyan.

The color commands will even work in math mode and across math mode boundaries. This means that if you have a color before going into math mode, the mathematics will be set in that color as well. In alignment environments like \halign, `tabular' or `eqnarray', local color commands cannot extend beyond the alignment characters. Because local color commands respect only some environment and delimiter changes besides their own, care must be taken in setting their scope. It is best not to have them stretch too far. At the present time there are no macros for color environments in LaTeX which might have a larger range. This is primarily to keep the TeX and LaTeX use compatible.


Go to the first, previous, next, last section, table of contents.