W3cubDocs

/LaTeX

Indexes

This document has an index.

\documentclass{article}
\usepackage{makeidx} \makeindex
  ...
\begin{document}
  ...
Recall Wilson's Theorem: \index{Wilson's Theorem}
a number \( n>1 \) is prime if and only if the factorial of \( n-1 \)
is congruent to \( -1 \) modulo~\( n \).
  ...
\printindex
  ...

The \usepackage{makeidx} and \makeindex in the preamble bring in the relevant commands.

Producing an index is a three stage process. First, in the document body you declare index entries with the \index command (see \index). When you run LaTeX, the \index writes its information to an auxiliary file root-name.idx. Next, to alphabetize and to do other manipulations you run an external command, typically makeindex or xindy (see makeindex). These output a file root-name.ind. Finally, you bring the information back into your document and typeset it with the \printindex command (see \printindex).

There are many packages that apply to indexing commands. The showidx package causes each index entries to be shown in the margin on the page where the entry appears. This can help in preparing the index. The multind package supports multiple indexes. See also the TeX FAQ entry on this topic, https://www.texfaq.org/FAQ-multind.

© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Indexes.html