Stuart Robinson -- Making an Index in LaTeX

Making an Index in LaTeX

This page will explain the basics of creating an index for a document written in LaTeX. It assumes that you are working in a Unix environment (e.g., Linux, BSD, etc.).

The Basics

  1. Include the makeidx package with a \usepackage command.
  2. Put a \makeindex command in the document preamble.
  3. Put a \printindex command where the index it to appear---usually at the end, before the \end{document} command.
  4. Run LaTeX on your .tex file to generate a .idx file.
  5. Run makeindex on main.idx.
  6. Rerun LaTeX on your .tex file to create a document with an index.

Do It Yourself

The easiest way to run through the process is to download this file, main.tex and run the following commands:
  1. latex main.tex
  2. makeindex main.idx
  3. latex main.tex
Running these 3 commands on main.tex will generate main.dvi, which can either be viwed/printed or converted to another format (e.g., Postscript/PDF) for viewing/printing. For sanity-checking, the output of the 3 above-listed commands looks something like this:
$ latex main.tex
This is TeX, Version 3.14159 (Web2C 7.3.1)
(main.tex
LaTeX2e <2000/06/01>
Babel  and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/book.cls
Document Class: book 2000/05/19 v1.4b Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/bk11.clo))
(/usr/share/texmf/tex/latex/base/makeidx.sty)
Writing index file main.idx
No file main.aux.
[1] [2]
No file main.ind.
[3] (main.aux) )
Output written on main.dvi (3 pages, 728 bytes).
Transcript written on main.log.
$ makeindex main.idx
This is makeindex, version 2.13 [07-Mar-1997] (using kpathsea).
Scanning input file main.idx....done (2 entries accepted, 0 rejected).
Sorting entries....done (2 comparisons).
Generating output file main.ind....done (9 lines written, 0 warnings).
Output written in main.ind.
Transcript written in main.ilg.
$ latex main.tex
This is TeX, Version 3.14159 (Web2C 7.3.1)
(main.tex
LaTeX2e <2000/06/01>
Babel  and hyphenation patterns for american, french, german, ngerman, i
talian, nohyphenation, loaded.
(/usr/share/texmf/tex/latex/base/book.cls
Document Class: book 2000/05/19 v1.4b Standard LaTeX document class
(/usr/share/texmf/tex/latex/base/bk11.clo))
(/usr/share/texmf/tex/latex/base/makeidx.sty)
Writing index file main.idx
(main.aux) [1] [2] (main.ind [3] [4]) (main.aux) )
Output written on main.dvi (4 pages, 940 bytes).
Transcript written on main.log.
  

Diagram

This process is summarized diagramatically below:

[Taken from Goosens, Mittelbach, and Samarin (1994) The LaTeX Companion, Figure 12.1, p. 346]


Back to Main Page   Friday, 24-Oct-2014 09:31:49 UTC