# Multiple indexes in LaTeX

I am familiar with the creation of multiple indexes using the `multind` package. One of the required steps is to run the `makeindex` executable for each generated `.idx` file. A typical solution would be do do something along the following lines (this is `unix`; `windows` users look the other way):

``````for file in *.idx; do
makeindex \${file}
done
``````

A disadvantage of this approach is that it may process too many `.idx` files. Is there an easy way to determine which `.idx` files are really required?

-
– Martin Schröder Jan 2 '12 at 14:04
@martin Thanks for the link. I want to have a solution where I don't need to know about the names of the index files. They should be detected automatically. Why do you think the link is relevant? – Marc van Dongen Jan 2 '12 at 14:58

Just use a Makefile (or a utility such as `latexmk`, `latexmake`, `latex-make`).

For example, create a `Makefile` file: (`<TAB>` stands for a tabulation character):

``````indexes := \$(patsubst %.idx,%.ind,\$(wildcard *.idx))
all: \$(indexes) # and other stuff
%.ind: %.idx
<TAB>   makeidx \$^
``````

Then, just issue a `make` command. This can be obviously enhanced, but `make` is really a good starting point.

-
Dubac Thanks. I'll have a look at the `Makefile` option. I had tried `latexmk` but that didn't work (unless I did something wrong). – Marc van Dongen Jan 2 '12 at 9:56

`multind` is not the package of choice for multiple indexes: it's almost featureless and too simplistic. The UK TeX FAQ entry Multiple indexes lists some other possibilities

`amsmidx`
`index`
`splitidx`
`imakeidx`

The last one (of which I'm one of the authors) frees you from the problem, as it executes automatically `makeindex`.

-
Thanks for that. Unfortunately, I need the information for `multind`. Does automatically running `makeindex` require enabling `write18`? – Marc van Dongen Jan 2 '12 at 10:50
@MarcvanDongen If you have a recent TeX Live (2010 or later) or MiKTeX 2.9, `makeindex` is listed in the allowed programs for the "restricted shell-escape" that's enabled by default. – egreg Jan 2 '12 at 10:55
Yes, I remember I just read that two days ago:) Funny how easy you (well, I) forget things like this. – Marc van Dongen Jan 2 '12 at 10:57