1

Consider the MWE

\documentclass{book}
\usepackage{imakeidx}
\let\cleardoublepage\clearpage
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}

\begin{document}
\large

A sentence.\index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!1@\textbf{\color{red}{Wagner}}!{Alack"! when a poor wight is so confined Amid his books, shut up from all mankind, And sees the world scarce on a holiday, As through a telescope and far away---}}
\index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!1@\textbf{\color{red}{Wagner}}!{How may he hope, with nicely tempered skill, To bend the hearts he knows not to his will?}}

Another sentence.\index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!2@\textbf{\color{red}{Faust}}!{Be thine to seek the honest gain, No shallow-tinkling fool"! Sound sense finds utterance for itself, Without the critic's rule.}}
\index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!2@\textbf{\color{red}{Faust}}!{If clear your thought, and your intention true, What need to hunt for words with much ado? The trim orations your fine speaker weaves, Crisping light shreds of thought for shallow minds, Are unrefreshing as the foggy winds That whistle through the sapless autumn leaves.}}

\idxlayout{columns=1}
\printindex
\end{document}

which produces the Index

enter image description here

As you can see, (1) there is not much default space between the heading (VON GOETHE'S FAUST) and the first subheading (Wagner); Nor, (2) is there much vertical spacing between the subheading {Wagner} and the beginning of the index entries under that subheading; Nor, (3) is there any appreciable space between the two entries under each of the two subheadings.

QUESTION: How may I automatically specify how much vertical space the index displays (i) between the heading and the subheading; (ii) between the subheading and the beginning of the subheading entries; (iii) between the subheading entries? (I know I can do this using multiple vspace commands within each index entry---but this would be a laborious task for an entire index.)

Thank you.

1 Answer 1

1

Try this code. Use \beforeheadspace and \beforesubheadspace to control the vertical spaces inserted before the heading (like Wagner) and the subheadings: items (ii) and (iii) of the question have the same value.

n

\documentclass{book}
\usepackage{imakeidx}
\let\cleardoublepage\clearpage
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}

\newcommand{\beforeheadspace}{3ex}% <<<<<<<<<<<<<<<<<
\newcommand{\beforesubheadspace}{1ex}% <<<<<<<<<<<<<<<<<

\renewcommand\subitem{\vspace*{\beforeheadspace}\par\hangindent 40pt \hspace*{20pt}} % added <<<<<
\renewcommand\subsubitem{\vspace*{\beforesubheadspace}\par\hangindent 40pt \hspace*{30pt}} % added <<<<<

\begin{document}
    \large
    
    A sentence.\index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!1@\textbf{\color{red}{Wagner}}!{Alack"! when a poor wight is so confined Amid his books, shut up from all mankind, And sees the world scarce on a holiday, As through a telescope and far away---}}
    \index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!1@\textbf{\color{red}{Wagner}}!{How may he hope, with nicely tempered skill, To bend the hearts he knows not to his will?}}
    
    Another sentence.\index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!2@\textbf{\color{red}{Faust}}!{Be thine to seek the honest gain, No shallow-tinkling fool"! Sound sense finds utterance for itself, Without the critic's rule.}}
    \index{VON GOETHE@\textbf{VON GOETHE'S \textit{FAUST}}!2@\textbf{\color{red}{Faust}}!{If clear your thought, and your intention true, What need to hunt for words with much ado? The trim orations your fine speaker weaves, Crisping light shreds of thought for shallow minds, Are unrefreshing as the foggy winds That whistle through the sapless autumn leaves.}}
    
    \idxlayout{columns=1}
    \printindex
\end{document}
1
  • I apologize for the delay in clicking the check mark. Thank you for this answer.
    – DDS
    Nov 27, 2021 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .