[Tex/LaTex] Get a preamble in index with makeindex

indexingsubdividing

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]} ?

Best Answer

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}%
    %%% ADDED
    \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.

Related Question