Lesson 13

Making an index

Depending on the type of document you are writing, you might want to include an index. This is a bit like making a bibliography, as it uses auxiliary files. Luckily, this is all automated by the imakeidx package. We need three instructions to LaTeX:

Some text about Foo\index{foo}.
More text\index{baz!bar}.
Even more text\index{alpha@$\alpha$}.
More text about a different part of baz\index{baz!wibble}.

Some text about Foo\index{foo} again, on a different page.
Even more text\index{beta@$\beta$}.
Even more text\index{gamma@$\gamma$}.

We’ve shown two features of indexing here: subdivision using !, and printing something different from the ‘sort text’ of an index entry using @. There is a lot of customisation possible with an index; try out the example and see how it works.