[Tex/LaTex] How create multiple indices with imakeidx

imakeidxindexing

The following source file was shown in: How to create multiple indices with imakeidx?

\documentclass{scrartcl}

\usepackage[splitindex]{imakeidx}
\makeindex
\makeindex[name=foo,title=Test]

\begin{document}
Test1\index{Test1}
Test2\index[foo]{Test2}
\newpage
Test3\index{Test3}
Test4\index[foo]{Test4}

\printindex
\printindex[foo]
\end{document}

That question was closed because, allegedly, an error in imakeidx was fixed.

However, when I process that source file by running pdflatex (twice, to be sure), then makeindex, and finally pdflatex again, I get no index whatsoever. In fact, there is a single .ind file, and that file is empty.

What am I doing wrong.

Best Answer

You get a warning:

Package imakeidx Warning: Remember to run (pdf)latex again after calling
(imakeidx)                `splitindex' and processing the indices.

which tells you exactly what you need to do.

Alternatively, run pdflatex with the -shell-escape option.

Explanation: splitindex is not in the “list of safe programs” allowed to be called from the restricted shell escape.

Another possibility, with just two indices, is to remove the splitindex option.

Related Question