This question extends the one recently posed in How to Selectively Remove the Comma in an Index Entry
In the above post, it was answered that by inserting \newcommand\textbfnocomma[2]{\textbf{#1}}
into the preamble, an index entry comma can be removed with the command \textbfnocomma
.
I am presently working on producing an index of quotations where the said comma seems to be a little out of place; and so, I would like to see what the index looks like with all such commas removed.
Consider the code,
\documentclass{book}
\usepackage{imakeidx}
\let\cleardoublepage\clearpage
\makeindex
\usepackage{idxlayout}
\usepackage{xcolor}
%\newcommand\textbfnocomma[2]{\textbf{#1}}
\begin{document}
\large
Some words. %\index{HEADING@\textbf{HEADING}!01@\textbfnocomma{\color{red}{\textit{So entfernen Sie das Komma?---}}}}
\index{HEADING@\textbf{HEADING}!02@\textbf{\color{red}{\textit{How to universally remove the comma?}}}}
\index{HEADING@\textbf{HEADING}!03@\textbf{\color{red}{\textit{How to universally remove the comma?}}}}
\index{HEADING@\textbf{HEADING}!04@\textbf{\color{red}{\textit{How to universally remove the comma?}}}}
\index{HEADING@\textbf{HEADING}!05@\textbf{\color{red}{\textit{How to universally remove the comma?}}}}
\index{HEADING@\textbf{HEADING}!06@\textbf{\color{red}{\textit{How to universally remove the comma?}}}}
\idxlayout{columns=1}
\printindex
\end{document}
which produces the Index:
QUESTION: Is it possible, and if so, how may I easily remove the comma from all index entries without resorting to removing them all individually with the preamble command described above? No textindy
please.
Thank you.
Best Answer
You need to adjust the
delim_1
field ofmakeindex
, since the page numbers you list is at level 1. Frommakeindex.hlp
:In short, include/change the following in your preamble:
The above code writes a file
\jobname.ist
- amakeindex
style file - and changes the default value ofdelim_1
to" "
- a regular space (from", "
). Then, to use this newly-created style file, pass the option-s \jobname.ist
to your call to\makeindex
. If you have page numbers at multiple levels, just adddelim_0
,delim_2
, ... to the.ist
.