Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

See MWE below. The symbol ! in the \index causes an error. This is only the case in align environments (not in equation). So it seems to have to do something with amsmath. If ! is put in an \mbox there is no error. But then of course the font size is not adjusted to subindices. Curiously enough, \index{$C_{K!!}$} (two exclamation marks) doesn't cause any error.


\documentclass{article}
\usepackage{amsmath}
\usepackage{imakeidx}
\makeindex
\begin{document}
\begin{align}
y\index{$C_{K!}$}
\end{align}
\printindex
\end{document}

Any solutions suggested?

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

For makeindex the symbol ! has a specific meaning.

The manual of makeindex (texdoc makeindex) has the following example / explanation:

To produce a subentry, the argument of the \index command should contain both the main entry and the subentry, separated by a ! character.

Page 7:  \index{gnat!size of}  || gnat, 32
Page 32: \index{gnat}          ||     anatomy, 35
Page 35: \index{gnat!anatomy}  ||     size of, 7
         \index{gnus!good}     || gnus
Page 38: \index{gnus!bad}      ||    bad, 38
                               ||    good, 35

To print out the symbol ! the manual shows

To put a !, @, or | character in an index entry, quote it by preceding the character with a ".

So the correct usage of your example is:

\begin{align}
y\index{$C_{K"!}$}
\end{align}

The quoted character can be changed my setting up the following line in the style file:

 quote '+'

Now the quoted character is +. E.g. for German language it's important than "a becomes ä.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.