Index Formatting

Two key issues in this last step are support for multiple styles and formatting independence. First, the formatting style macros used in Step III output must be defined. In our example, the global environment (\begin{theindex}...\end{theindex}) tells LATEX to use a two-column page layout. Each \item is left justified against the column margin and each \subitem is indented by 20 points, \subsubitem by 30, etc. There is a vertical space bound to \indexspace inserted before the beginning of a new letter (e.g., before beta).

The formatting independence problem refers to whether or not the final index can be formatted independently of the entire document. Indexing is typically the last step of document preparation, and is attempted only when the entire document is finalized. It is desirable to be able to generate the index without reformatting the entire document. To be able to format the index separately, the global context must be known, which is made possible by the extensible style facility in our design. One can redefine preamble and postamble to invoke a style consistent with the original document.

The other information needed to perform effective separate formatting is the starting page number for the index. Some styles require that the index start on an even or odd page number. In either case, there must be provisions for including the correct starting page number in the pre-formatted version of index.