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):


Alternatively, you can also use the imakeidx package:


This packages offers additional features for formatting the index. For example:

           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.,

Version Control\index{Version Control} is an
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}}


Then, use the \index{Main entry!zzzzz@\igobble|seealso{Other item}} syntax in your book. As an example:

Backups\index{Version Control!zzzzz@\igobble|seealso{backups}}
should be part of your version control system.

2.9.2 Building the Index

To build the index, insert \printindex at the end of your book through the YAML option includes -> after_body.