[Tex/LaTex] How to fix symbol index entry

indexingsymbols

All my entries in the symbol index involving $\|\cdot\|$ get rejected. For instance
{\index{symbol}{normx@{$\|\cdot\|_X$}}}.

How can I fix this?

Best Answer

The symbol | is special within the \index command as it deals with special page ranges. You need to hide this from TeX using something like

\newcommand{\norm}{\|}

Also note that \index takes only one argument which is the index entry. If you want to also print this entry in text, you need to use the following format:

...blah blah symbol\index{symbol} blah blah...

virtually duplicating the typeset component and index entry. Here's your MWE with a the above modifications:

enter image description here

\documentclass{article}
\usepackage{makeidx}% http://ctan.org/pkg/makeidx
\newcommand{\norm}{\|}
\makeindex
\begin{document}
See $\|\cdot\|_X$\index{normx@$\norm\cdot\norm_X$} and the norm\index{norm}.

\printindex
\end{document}

Consider reading through Leslie Lamport's MakeIndex : An Index Processor For LaTeX.

Related Question