索引エントリ間のギャップを指定する方法

索引エントリ間のギャップを指定する方法

コード

\documentclass{book}
\usepackage{imakeidx}
\let\cleardoublepage\clearpage
\makeindex
\usepackage[itemlayout=singlepar]{idxlayout}

\begin{document}
\LARGE

This is the first paragraph.\index{AA! first}\index{AA! second}\index{AA! third}

This is the second paragraph.\index{AAB! an entry}

This is the third paragraph.\index{AAC! another entry}

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

次のインデックスを生成します:

ここに画像の説明を入力してください

AA と AAB の間、AAB と AAC の間のギャップ (たとえば、5pt、10pt、12pt など) を事前に指定するにはどうすればよいでしょうか。

答え1

\@idxitem垂直方向のスペースを追加するように再定義します。

\documentclass{book}
\usepackage{imakeidx}
\usepackage[itemlayout=singlepar]{idxlayout}

\makeindex

\makeatletter
\renewcommand{\@idxitem}{\par\addvspace{\medskipamount}\hangindent40\p@}
\makeatother

\begin{document}

This is the first paragraph.\index{AA! first}\index{AA! second}\index{AA! third}

This is the second paragraph.\index{AAB! an entry}

This is the third paragraph.\index{AAC! another entry}

\idxlayout{columns=1}

\printindex

\end{document}

ここに画像の説明を入力してください

関連情報