2.9 Index
Currently the index is only supported for LaTeX/PDF output. To print an index after the book, you can use the LaTeX package makeidx in the preamble (see Section 4.1):
\usepackage{makeidx}
\makeindex
Alternatively, you can also use the imakeidx package:
\usepackage{imakeidx}
This packages offers additional features for formatting the index. For example:
\makeindex[intoc=true,columns=3,columnseprule=true,
options=-s latex/indexstyles.ist]
In the above example, intoc=true
will include an entry for the index into the table of contents, columns=3
will format the index into three columns, and columnseprule=true
will display a line between index columns. Finally, options=-s latex/indexstyles.ist
will use additional formatting options from an index-style file located at latex/indexstyles.ist
. Many other features are available in the imakeidx package. Please refer to its documentation for further details.
2.9.1 Inserting Entries
An index entry can be created via the \index{}
command in the book body, e.g.,
\index{Version Control} is an
Version Control important component of the SDLC.
Likewise, to insert a subentry for an item:
Git\index{Version Control!Git} is a
popular version control system.
The above example will add a “Git” entry underneath “Version Control” in the index.
To create a “see also” entry that appears at the bottom of an item’s subentries (with no page number), first add the following beneath the call to \makeindex
in your preamble file:
% to create a "see also" that appears at the bottom of the
% subentries and with no page number, do the following:
% \index{Main entry!zzzzz@\igobble|seealso{Other item}}
\newcommand{\ii}[1]{{\it #1}}
\newcommand{\nn}[1]{#1n}
\def\igobble#1{}
Then, use the \index{Main entry!zzzzz@\igobble|seealso{Other item}}
syntax in your book. As an example:
\index{Version Control!zzzzz@\igobble|seealso{backups}}
Backups should be part of your version control system.