[Tex/LaTex] Adding a chapter title for indices (multind) on the same page as the first index is printed

indexingpage-breakingsubdividing

I am trying to add a chapter title 'Indices' before the first multind index is printed. However, printindex flushes the page so if I do it, I will get the title, rest of the page empty, and the first index. I would like to have the 'Indices' title and then the first index printed immediately below it, then the second index beginning normally with a flushed page.

So, instead of:

-------------    -------------    -------------    -------------
|           |    |           |    |           |    |           |
|  Indices  |    |  Names    |    | ---- ---- |    |  Places   |
|           |    | ---- ---- |    | ---- ---- |    | ---- ---- |
|           |    | ---- ---- |    | ---- ---- |    | ---- ---- |
|           |    | ---- ---- |    | ---- ---- |    | ---- ---- |
|           |    | ---- ---- |    |           |    | ---- ---- |
|    124    |    |    125    |    |    126    |    |    127    |
|-----------|    |-----------|    |-----------|    |-----------|

I want to achieve:

-------------    -------------    -------------    -------------
|           |    |           |    |           |    |           |
|  Indices  |    | ---- ---- |    | ---- ---- |    |  Places   |
|           |    | ---- ---- |    |           |    | ---- ---- |
|  Names    |    | ---- ---- |    |           |    | ---- ---- |
| ---- ---- |    | ---- ---- |    |           |    | ---- ---- |
| ---- ---- |    | ---- ---- |    |           |    | ---- ---- |
|    124    |    |    125    |    |    126    |    |    127    |
|-----------|    |-----------|    |-----------|    |-----------|

I am using book. Any help will be much appreciated.

MWE:

\documentclass{book}

\usepackage{multind}
\makeindex{names}
\makeindex{places}

\usepackage{lipsum}


\begin{document}


\chapter{Chapter one}
\index{names}{John}\index{places}{London}
\lipsum
\index{names}{Tim}\index{places}{York}


\chapter{Chapter two}
\index{names}{John}\index{places}{York}
\lipsum
\index{names}{Tim}\index{places}{London}

\chapter*{Indices}
\printindex{names}{Index of names}
\printindex{places}{Index of places}

\end{document}

Best Answer

multind.sty defines \printindex as

\def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
  \columnseprule \z@ \columnsep 35pt
  \newpage \twocolumn[{\Large\bf #2 \vskip4ex}]
  \markright{\uppercase{#2}}
  \addcontentsline{toc}{section}{#2}
  \@input{#1.ind}}

and both \newpage and \twocolumn force a new page. In the following example I redefined \printindex suppressing \newpage and the use of \twocolumn; I used the multicol package instead to produce a two-column layout; also, instead of simply {\Large\bf #2 \vskip4ex} I used \section* to typeset the titles.

\documentclass{book}
\usepackage{multind}
\usepackage{multicol}
\usepackage{lipsum}

\makeindex{names}
\makeindex{places}

\makeatletter
\def\printindex#1#2{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
  \columnseprule \z@ \columnsep 35pt
  \csname phantomsection\endcsname
  \section*{#2}
  \markright{\uppercase{#2}}
  \addcontentsline{toc}{section}{#2}
  \begin{multicols}{2}
  \@input{#1.ind}%
  \end{multicols}%
}
\makeatother

\begin{document}

\chapter{Chapter one}
\index{names}{John}\index{places}{London}
\lipsum
\index{names}{Tim}\index{places}{York}

\chapter{Chapter two}
\index{names}{John}\index{places}{York}
\lipsum
\index{names}{Tim}\index{places}{London}

\chapter*{Indices}
\printindex{names}{Index of names}
\newpage
\printindex{places}{Index of places}

\end{document}

An image of the firs page of the indices:

enter image description here

Perhaps you could consider using another more modern package to build your indices; splitindex seems a good option.

Related Question