I use the index
package, and in particular its starred variant of the \index
command: \index*{word}
both typesets word
and adds it to the index.
When indexing a phrase, the spaces are typeset as character 32 in the current font, instead of being spaces. For example I get a stroke with CM fonts, or a ␣ with T1 fonts. This is only a problem in the running text, the index contains a normal space (unsurprisingly as a single space is written to the .idx
file).
\documentclass{report}
\usepackage{index}
\makeindex
\begin{document}
\index*{hello world}
\printindex
\end{document}
If the source contains multiple spaces, they're all typeset. I presume that \index*
is overenthusiastically changing catcodes but I don't know how to fix that.
Is there a way to fix this without ditching the index
package? If not, what other package(s) provide \index*
and supports multiple indexes with \index[things]{word}
?
\imakeidx
supports multiple indexes, but has no\index*
, but this should be possible to obtain.index
itself does only change the catcodes for_
and^