# Get a preamble in index with makeindex

First of all, I'm not very good with Ubuntu, and only ok with LaTeX.

I'm currently finishing to write my thesis, and have one big question. I made two indices using multind. But I can't figure out how to write a preamble to the index, i.e. something between the title Index and the beginning of the indexation.

I tried to install idxlayout, and imakeidx, but both of them do not work. I should somehow get new packages, but installing them in mu current tex folder do not work, and I don't know how to proceed in another way

So : Does anyone know how to write a preamble in multind ? I can give a MWE but I don't think this would help in this case ...

 \documentclass{article}
\usepackage{splitidx}
\makeindex
\newindex[General Index]{idx}
\newindex[Index of Animals]{ani}
\newindex[Index of Fruits]{fru}
\newindex[Index of Vegetables]{veg} % ... 4th index

\begin{document}
Apples\sindex[fru]{apple} and oranges\sindex[fru]{orange} are fruits\sindex{fruits}.
Tomatoes\sindex[veg]{tomato} are vegetables\index{vegetables}.
Cats\sindex[ani]{cat} are animals\sindex[idx]{animals}.
\printindex*
\end{document}


After this, when I run "splitidx.pl" as indicated, it's just not found ...

I works perfectly now !

It still have one question left : My text is something like 600 pages, with thousands of index references, and I fear a simple replacement of \index{} by \sindex[] could destroy stuff. I saw in another answer you made that you suggested :

\let\imkiindex\index
\renewcommand\index[1]{\imkiindex[#1]}


but that would only affect the "[]" -> "{}" and not the sindex part ? Would this work :

\let\imkiindex\index
\renewcommand\sindex[1]{\imkiindex[#1]} ?

-
The package idxlayout allows for index prologues; imakeidx both for multiple indices and index prologues. Try providing a MWE anyway. – egreg Jan 30 '13 at 16:05
The script to call is splitindex – egreg Jan 30 '13 at 16:22
Thank you very much ! I had no idea I needed that ... Kile is currently downloading and installing some 207 mb. I tell you ASAP if this works ... – Thoms Morel Jan 30 '13 at 16:25

There are several ways to add prologues. One that works with the splitidx package is to slightly change the definition of the theindex environment for accommodating the prologue:

\documentclass{article}
\usepackage{splitidx}

\makeatletter
\renewenvironment{theindex}
{\if@twocolumn
\@restonecolfalse
\else
\@restonecoltrue
\fi
\twocolumn[\section*{\indexname}%
\this@index@prologue\global\let\this@index@prologue\relax
%%%
]%
\@mkboth{\MakeUppercase\indexname}%
{\MakeUppercase\indexname}%
\thispagestyle{plain}\parindent\z@
\parskip\z@ \@plus .3\p@\relax
\columnseprule \z@
\columnsep 35\p@
\let\item\@idxitem}
{\if@restonecol\onecolumn\else\clearpage\fi}
\newcommand{\indexprologue}[1]{\gdef\this@index@prologue{#1\par\bigskip}}
\let\this@index@prologue\relax
\makeatletter

\makeindex
\newindex[General Index]{idx}
\newindex[Index of Animals]{ani}
\newindex[Index of Fruits]{fru}
\newindex[Index of Vegetables]{veg} % ... 4th index

\begin{document}

Apples\sindex[fru]{apple} and oranges\sindex[fru]{orange} are fruits\sindex{fruits}.
Tomatoes\sindex[veg]{tomato} are vegetables\index{vegetables}.
Cats\sindex[ani]{cat} are animals\sindex[idx]{animals}.

\indexprologue{General index}
\printindex[idx]

\indexprologue{This is the index of animals}
\printindex[ani]

\indexprologue{This is the index of fruits}
\printindex[fru]

\printindex[veg] % no prologue for vegetables

\end{document}


If you compile this with pdflatex, run the splitindex program and then rerun pdflatex, you'll have the prologues in the first three indices, but not in the fourth.

-
@ThomsMorel I'd go with \sindex. – egreg Jan 30 '13 at 16:53
I'll follow your advice, and write back when it's done ! Once again, thanks. – Thoms Morel Jan 30 '13 at 17:00
Ok, everything is fine, I even managed to add some space in the prologue, and add both indices in the ToC. Thank you @egreg – Thoms Morel Jan 30 '13 at 17:43