I am generating a very large number of index entries containing formatting in a LaTeX document, and some of them are in regions that affect the premature tokenisation of the argument (footnotes, optional argument to \item, etc) so that I get two identical-looking entries on the same page in the .idx file, one with spaces after the formatting (eg \textit␣␣{foo} as well as \textit{foo}).

This has been dealt with in a question on index entries in footnotes and a response link to a question on named indexes but only in the case of multiple indexes (with an optional parameter to the \index command).

Is there a way to solve this for a single index? I can't see from the two pages above how to generalize the solution.

[And, incidentally, I would be interested to know where the two bogus spaces actually come from, and why the tokenisation inserts them.]


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.