I'm using the packages imakeidx and idxlayout (the latter with "singlepar" layout) and I'm trying to customize the default delimiters.
My aim is to obtain different delimiters for subitem and subsubitem.
For example, my idea is that the following entries within the text
\index{Author!Work1!1,15}
\index{Author!Work1!9,32}
\index{Author!Work2!2,24}
\index{Author!Work2!5,11}
should give this entry in the index (I added random page numbers):
Author, Work1, 1,15: 9 — 9,32: 16 — 1,15: 27 — Work2, 2,24: 57 — 5,11: 98
However, I added these lines in order to substitute the default idxlayout delimiters (which is semicolon)
\renewcommand{\indexsubsdelim}{, }
\newcommand*{\indexsubsdelimb}{ — }
\renewcommand{\subitem}{\unskip\indexsubsdelim}%
\renewcommand{\subsubitem}{\unskip\indexsubsdelimb}%
but the result is as follows (what is wrong is the line just after the subitem and the comma after the subsubitem):
Author, Work1 — 1,15: 9 — 9,32: 16 — 1,15: 27, Work2 — 2,24: 57 — 5,11: 98
Is it possible to obtain the desired layout? Thank you for your help.
Here is the MWE:
\begin{filecontents*}{colon.ist}
delim_2 ": "
\end{filecontents*}
\documentclass{article}
\usepackage{lipsum}
\usepackage{imakeidx}
\usepackage[itemlayout=singlepar]{idxlayout}
\renewcommand{\indexsubsdelim}{, }
\newcommand*{\indexsubsdelimb}{ — }
\renewcommand{\subitem}{\unskip\indexsubsdelim}%
\renewcommand{\subsubitem}{\unskip\indexsubsdelimb}%
\makeindex[options=-s colon]
\begin{document}
\lipsum[1]
\index{Author!Work1!1,15}
\index{Author!Work1!9,32}
\index{Author!Work2!2,24}
\index{Author!Work2!5,11}
\printindex
\end{document}
