4

I have a problem when I use \index to index a term with an accent in a footnote. The index key created is not the same as if I use \index to index the same term outside of the footnote. This causes the entries not to be combined in the resulting index.

Here is a MWE:

\documentclass{article}
\usepackage{imakeidx}
\makeindex

\begin{document}

\index{K\H{o}nig} \footnote{\index{K\H{o}nig}}

\printindex \end{document}

If I latex that and then inspect the idx file, I see

\indexentry{K\H{o}nig}{1}
\indexentry{K\H {o}nig}{1}

Is there any way to prevent this behavior? (Preferably other than moving the \index outside of the footnote.)

  • 2
    You can do \footnote{\index{K\string\H{o}nig}} to turn the control sequence \H into a list of character tokens, so it doesn't expand until later. – rbrignall Feb 07 '22 at 21:29
  • 1
    Also see https://tex.stackexchange.com/questions/105703/ and https://tex.stackexchange.com/questions/88354/ – marquinho Feb 07 '22 at 21:37

0 Answers0