UK TeX FAQ -- question label multind

### Multiple indexes

LaTeX's standard indexing capabilities (those provided by the makeidx package) only provide for one index in your document; even quite modest documents can be improved by indexes for separate topics.

The multind package provides simple and straightforward multiple indexing. You tag each `\``makeindex`, `\``index` and `\``printindex` command with a file name, and indexing commands are written to (or read from) the name with the appropriate (`.idx` or `.ind`) extension appended. The `\``printindex` command is modified from the LaTeX standard so that it doesn't create its own chapter or section heading; you therefore decide what names (or sectioning level, even) to use for the indexes, and `\``indexname` is completely ignored.

To create a "general" and an "authors" index, one might write:

>     \usepackage{multind}
>     \makeindex{general}
>     \makeindex{authors}
>     ...
>     \index{authors}{Robin Fairbairns}
>     ...
>     \index{general}{FAQs}
>     ...
>     \printindex{general}{General index}
>     \printindex{authors}{Author index}

To complete the job, run LaTeX on your file enough times that labels, etc., are stable, and then execute the commands

>     makeindex general
>     makeindex authors

before running LaTeX again. Note that the names of the index files to process are not necessarily related to the name of the LaTeX file you're processing, at all. (There's no documentation that comes with the package: what you see above is as good as you will get...)

The index package provides a comprehensive set of indexing facilities, including a `\``newindex` command that allows the definition of new styles of index. `\``newindex` takes a 'tag' (for use in indexing commands), replacements for the `.idx` and `.ind` file extensions, and a title for the index when it's finally printed; it can also change the item that's being indexed against (for example, one might have an index of artists referenced by the figure number where their work is shown).

Using index, to create an author index together with a "normal" index, one would start with preamble commands:

>     \usepackage{index}
>     \makeindex
>     \newindex{aut}{adx}{and}{Name Index}

which load the package, define a "main" (original-style) index, and then define an author index. Then, in the body of the document, we might find commands like:

>     \index[aut]{Robin Fairbairns}
>     ...
>     \index{FAQs}

Which place an entry in the author index, and then one in the main index. At the end of the document, we have two commands:

>     \printindex
>     \printindex[aut]

Which will print the main index and then the author index. Supposing this lot to be in myfile.tex, after enough runs through LaTeX that labels are stable, execute the following commands (Unix-style shell commands shown here, but the principle is the same whatever system you're using):

>     makeindex myfile
>     makeindex myfile.adx -o myfile.and

and rerun LaTeX. The makeindex commands process myfile.idx to myfile.ind (the default action), and then myfile.adx to myfile.and, the two files needed as input by the two `\``printindex` commands in myfile.tex.

The splitidx package can operate in the same way as the others: load the package with the `split` option, and declare each index with a `\``newindex` command:

> `\``newindex[<index name>]{<shortcut>}`

and splitidx will generate a file `\``jobname``.<shortcut>` to receive index entries generated by commands like `\``sindex[<shortcut>]{<item>}`. As with the other packages, this method is limited by TeX's total number of output files. However, splitindex also comes with a small executable splitindex (available for a variety of operating systems); if you use this auxiliary program (and don't use `split`), there's no limit to the number of indexes. Apart from this trick, splitidx supports the same sorts of things as does index. An example of use appears in the documentation.

The memoir class has its own multiple-index functionality (as well as index layout options, which other packages delegate to the index style used by makeindex.

`index.sty`
  macros/latex/contrib/index (zip, browse)
`makeidx.sty`
  Part of the LaTeX distribution
`memoir.cls`
  macros/latex/contrib/memoir (zip, browse)
`multind.sty`
  macros/latex209/contrib/misc/multind.sty
`splitidx.sty and splitindex`
  macros/latex/contrib/splitindex (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=multind