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

Color subtleties

Color macros are defined via \special keywords. As such, they are put in the `.dvi' file only as explicit message strings to the driver. The (unpleasant) result is that certain unprotected regions of the text can have unwanted color side effects. For example, if a color region is split by TeX across a page boundary, then the footers of the current page (e.g., the page number) and the headers of the next page can inherit that color. To avoid this effect globally, users should make sure that these special regions of the text are defined with their own local color commands. For example, to protect the header and footer in plain TeX, use

\headline{\Black{My Header}}
\footline{\Black{\hss\tenrm\folio\hss}}

This warning also applies to figures and other insertions, so be careful!

Of course, in LaTeX, this is much more difficult to do because of the complexity of the macros that control these regions. This is unfortunate but inevitable, because TeX and LaTeX were not written with color in mind.

Even when writing your own macros, much care must be taken. The macros that `colorize' a portion of the text work prefix the text work by outputting one \special command to turn the color on before the text, and outputting another \special command afterwards to restore the original color. It is often useful to ensure that TeX is in horizontal mode before the first special command is issued; this can be done by prefixing the color command with \leavevmode.


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