## Generating an Index

If you are writing a reference document, a book, or a report, it's sometimes useful to include an index section at the end of the document. An index is a list of key words in the document and the page, or pages, where they occur. You add an index to your document with the makeinx package.

To create an index, you first include and enable the makeinx package in the document preamble. Next, add the index command to each word you wish to include in the index.

...
\usepackage{makeidx}
\makeindex
...
\begin{document}
As you learned in the first article, in LaTeX\index{LaTeX}, you can manage your bibliographic citations using BibTeX\index{BibTeX}.
...
\end{document}
end{verbatim}

Finally, you generate the index by running the following
programs (do not add the extension, just the file name).

\begin{verbatim}
% latex latex-file
% makeindex latex-file
% latex latex-file

or

% pdflatex latex-file
% makeindex latex-file
% pdflatex latex-file


Here's how it works. First, LaTeX processes the file and writes each index entry to a file, with a .idx extension. Next, makeindex creates the sorted index, which it stores in a file with a .ind extension. Finally, you run LaTeX again to place the index into the document.

You can create many different index formats by changing the syntax of the index command. See a LaTeX reference for more information.

Kevin O'Malley 2004-03-05