Next: , Up: Ending a File   [Contents][Index]

4.1 Printing Indices and Menus

To print an index means to include it as part of a manual or Info file. This does not happen automatically just because you use @cindex or other index-entry generating commands in the Texinfo file; those just cause the raw data for the index to be accumulated. To generate an index, you must include the @printindex command at the place in the document where you want the index to appear. Also, as part of the process of creating a printed manual, you must run a program called texindex (see Hardcopy) to sort the raw data to produce a sorted index file. The sorted index file is what is actually used to print the index.

Texinfo offers six separate types of predefined index, which suffice in most cases. See Indices, for information on this, as well defining your own new indices, combining indices, and, most importantly advice on writing the actual index entries. This section focuses on printing indices, which is done with the @printindex command.

@printindex takes one argument, a two-letter index abbreviation. It reads the corresponding sorted index file (for printed output), and formats it appropriately into an index.

The @printindex command does not generate a chapter heading for the index, since different manuals have different needs. Consequently, you should precede the @printindex command with a suitable section or chapter command (usually @appendix or @unnumbered) to supply the chapter heading and put the index into the table of contents. Precede the chapter heading with an @node line as usual.

For example:

@node Variable Index
@unnumbered Variable Index

@printindex vr
@node Concept Index
@unnumbered Concept Index

@printindex cp

If you have more than one index, we recommend placing the concept index last.

Next: , Up: Ending a File   [Contents][Index]