[texhax] Bug in makeidx

Uwe Lück uwe.lueck at web.de
Tue Mar 28 00:07:24 CEST 2006


I bothered with indexes recently, so quite late:

At 10:41 17.11.05, Lars Madsen wrote:
>Rick Zaccone :
>
>>The following example illustrates what appears to be a bug in the
>>makeidx package.  The problem occurs if the index term contains a
>>tie. The \index command generates a different entry in the body and in
>>the footnote, resulting in two entries in the index.
>>
>>\documentclass{article}
>>\usepackage{makeidx}
>>\makeindex
>>\begin{document}
>>foo bar\index{foo~bar}\footnote{foo bar\index{foo~bar}}
>>\printindex
>>\end{document}
>>
>>Is this a bug, or am I missing something?
>
>a footnote is a moving entity, so you have to protect yourself
>
>\footnote{foo bar\index{foo\protect~bar}}
>
>worked in my test

Using the 'index' package instead of 'makeidx' should help as well.
Standard LaTeX \index tries to change category codes in its argument,
and this fails whenever \index appears in an argument of another macro
(provided that macro doesn't do the same changes of category codes
-- a general problem ["bug"!?] that many have encountered, with diacritical
marks in Classical Greek with older packages, e.g. ...).
The 'index' package makes \index so smart that those \catcode
changes work in those difficult situations as well
(using a version of \@onelevel at sanitize instead of \@sanitize).

Best,
   Uwe.



More information about the texhax mailing list