4

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?

lockstep
  • 250,273
  • See http://tex.stackexchange.com/questions/472/how-can-i-have-2-or-more-distinct-indexes-in-latex – Martin Schröder Jan 02 '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? –  Jan 02 '12 at 14:58

2 Answers2

7

multind is not the package of choice for multiple indexes: it's almost featureless and too simplistic. The 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.

egreg
  • 1,121,712
  • Thanks for that. Unfortunately, I need the information for multind. Does automatically running makeindex require enabling write18? –  Jan 02 '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 02 '12 at 10:55
  • Yes, I remember I just read that two days ago:) Funny how easy you (well, I) forget things like this. –  Jan 02 '12 at 10:57
5

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). –  Jan 02 '12 at 09:56