In an index, I would like to be able to remove the comma that immediately precedes the page number for certain entries only.
Consider the MWE
\documentclass{book}
\usepackage{imakeidx}
\let\cleardoublepage\clearpage
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}
\begin{document}
\Large
Some words.\index{HEADING@\textbf{HEADING}!01@\textbf{\color{red}{\textit{So entfernen Sie das Komma?---}}}}\index{HEADING@\textbf{HEADING}!02@\textbf{\color{red}{\textit{But I want the comma to remain here.}}}}
\idxlayout{columns=1}
\printindex
\end{document}
which produces the output
QUESTION: How may I remove the comma following Komma?— in the first entry, while retaining the comma in the second entry?
Thank you.
Best Answer
Just uses a macro that discards it: