Next: Combining Indices, Previous: Index Entries, Up: Indices [Contents][Index]
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 the other parts of this chapter for information on this,
as well as advanced indexing commands, 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.
@printindex
produces a traditional
two-column index, with dot leaders between the index terms and page
numbers.
@printindex
produces a special menu containing
the line number of the entry, relative to the start of the node. Info
readers can use this to go to the exact line of an entry, not just the
containing node. (Older Info readers will just go to the node.)
Here’s an example:
* First index entry: Top. (line 7)
The actual number of spaces is variable, to right-justify the line number; it’s been reduced here to make the line fit in the printed manual.
@printindex
produces the same menu, but
the line numbers are relative to the start of the file, since that’s
more convenient for that format.
@printindex
produces links to the index
entries.
Next: Combining Indices, Previous: Index Entries, Up: Indices [Contents][Index]