Next: , Previous: , Up: LaTeX   [Contents][Index]


10.1.3.5 LaTeX’s index.

The Index should be the last section of the code, and should be begun by the command ‘@* \INDEX.’. For more information, see S_index.

The challenge of typesetting the Index is to get it into two-column mode in the best possible way. In the original Plain-TeX FWEB, special code was provided for this. With LaTeX, however, one wants to use standard features.

The best solution is to use the user package multicol. If that is loaded by means of the style-file statement ‘LaTeX.package "multicol"’, then any text typed by the user following the ‘@* \INDEX.’ command will be typeset in single-column mode, after which two-column mode is entered. If it is not loaded, a ‘\twocolumn’ command is issued before the index section is begun (in order to get the Index started on a new page).

More precisely, what happens is the following. When the ‘@* \INDEX.’ command is recognized, essentially the following operations are performed, where the results are bracketed in the form ‘[multicol : nomulticol]’:

\beforeindex [\newpage : \twocolumn]
[print INDEX section heading]
\startindex  [\begin{multicols}{2} : \medskip]
\Wfin        [\end{multicols} : \relax]

(Use of the asymmetrical name ‘\Wfin’ is for historical reasons.)

The positioning of ‘\beforeindex’ suggests a way of printing the entire document in two-column mode. If one enters multi-column mode in the limbo section, then ‘\beforeindex’ can be used to terminate it. It is best to do this at the end of the limbo section; otherwise user macro definitions in the limbo section must be made \global in order that they remain defined in the Index. The relevant commands can be placed in the style file:

LaTeX.package "multicol"

doc.preamble "\\secpenalty=0"

limbo.end "\\def\\beforeindex{\\end{multicols}\\newpage}\n\
\\begin{multicols}{2}\n\
\\raggedcolumns"

Just to repeat, use only the first command to get just the Index printed in two-column format; use the second and third ones to make the entire document two-column.


Next: , Previous: , Up: LaTeX   [Contents][Index]