The following MWE shows 4 index entries, with 2 different wordings, and 2 in ordinary text, and 2 in \pagenote. 2 are normalfont, the other 2 are emphasized. The result should be 2 indexes, 1 with normalfont and the other emphasized. But the result are 3 indexes: 1 normalfont, 2 emphasized.

How could be made 1 index out of the 2 emphasized?




A sentence with words 
and emph index.\index{emph Words@\emph{emph Words}}

Some other words with pagenote 
and emph index.\pagenote{A pagenote with emph words.\index{emph Words@\emph{emph Words}}}

Further words and ordinary index.\index{Words}

Further words with pagenote 
and ordinary index.\pagenote{Further pagenote with ordinary index\index{Words}}




I still searched for solution, but could not find one. How could this be resolved?

  • (1) Use \index{emph Words@\emph {emph Words}}. Note there are two additional spaces there. (2) Use xindy?
    – cfr
    Commented Nov 28, 2023 at 0:20

1 Answer 1


The problem can be observed in the .idx file:

\indexentry{emph Words@\emph{emph Words}}{1}
\indexentry{emph Words@\emph  {emph Words}}{2}

When \emph is used inside the \pagenote two additional spaces are inserted afterwards. TeX takes no notice of these because they follow a control sequence immediately, but makeindex is more particular. It regards the two entries as distinct.

The easiest and possibly most satisfactory approach is to switch indexing programmes and use texindy rather than makeindex. All this requires is an option to \makeindex (or you can specify when loading imakeidx) such as


Then you need to run

texindy <basename-of-file>.idx

If you want split indices or something like that, you may find it easier to run with shell-escape. (imakeidx's documentation says you have to do this just to use the xindy option, but that's not true.)

index with texindy

The quickest, if extremely kludgey, alternative solution is to add two spaces after \emph when not inside a \pagenote.

A sentence with words 
and emph index.\index{emph Words@\emph  {emph Words}}

Some other words with pagenote 
and emph index.\pagenote{A pagenote with emph words.\index{emph Words@\emph{emph Words}}}

output from makeindex with manual anti-normalisation of spaces

A third option would be to track down and address the source of the erroneous spaces or to automate some kind of intervention to ensure the .idx file is written one way or the other (either by normalising the input inside the \pagenote or by anti-normalising the input elsewhere - or perhaps it is the other way around).

A fourth would be to post-process the .idx file before having makeindex post-post-process it.

A fifth would be to write a new indexing tool for the twenty-first century ;).

  • Thank you so much for your expertise. In my MWE I added \makeindex[program=xindy] and this solved the problem. And I did not add two spaces! This seems the most elegant of functional way to get the indexes right. Thank you.
    – Thomkrates
    Commented Nov 28, 2023 at 19:12
  • @Thomkrates It isn't a straight substitute in all cases but, where it can work as a drop-in replacement, it is definitely the best option I'm aware of. makeindex's space-thing is a complete pain.
    – cfr
    Commented Nov 28, 2023 at 20:10
  • Ok, I will work on my 440 pages book with 15 pages general index. If I will detect some further problem with this kind of error I will surely come back and ask for support. All the best.
    – Thomkrates
    Commented Nov 28, 2023 at 21:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .