Possible bug in makexindex

Frank Mittelbach frank.mittelbach at latex-project.org
Thu Aug 8 08:23:53 CEST 2024


Am 08.08.24 um 01:43 schrieb Ulrike Fischer:
> Remark the difference between \subitem (item\_1) and \subitem (item\_01) 
> in the aaa entry, while the xxx entry is the same for both.

good WME. Yes the first subentry according to documentation should be 
either index_01 or index_x1 but never index_1

perhaps even clearer therefore if you add a few more entries:

\indexentry{aaa}{1}
\indexentry{aaa!bbb}{1}
\indexentry{aaa!ccc}{5}
\indexentry{aaa!ddd}{6}
\indexentry{aaa}{2}
\indexentry{aaa!bbb}{2}

\indexentry{xxx}{1}
\indexentry{xxx!yyy}{1}
\indexentry{xxx!zzz}{3}
\indexentry{xxx!zzzz}{4}

\indexentry{foo!aaa}{1}
\indexentry{foo!bbb}{2}
\indexentry{foo!ccc}{2}
\indexentry{foo!ddd}{3}

and then use

item_1 "\n    \\subitem (item\\_1) "
item_01 "\n    \\subitem (item\\_01) "
item_x1 "\n    \\subitem (item\\_x1) "

item_2 "\n     \\subsubitem (item\\_2) "
item_12 "\n     \\subsubitem (item\\_12) "
item_x2 "\n     \\subsubitem (item\\_x2) "

as simple.ist file.

That shows clearly the difference with upmendex  being correct and 
makeindex being wrong on the first "aaa" subentry.

-----------

However, if we test the index_12 index_x2 cases we can see that both 
upmendex and makeindex fail in some cases:

\indexentry{foo!bar!aaa}{1}
\indexentry{foo!bar!bbb}{2}
\indexentry{foo!bar!ccc}{2}

\indexentry{bar!bar}{1}
\indexentry{bar!baz}{2}
\indexentry{bar!baz}{5}
\indexentry{bar!baz!aaa}{1}
\indexentry{bar!baz!bbb}{2}
\indexentry{bar!baz!ccc}{3}

\indexentry{baz!baz}{2}
\indexentry{baz!baz!aaa}{1}
\indexentry{baz!baz!bbb}{2}
\indexentry{baz!baz!ccc}{3}

------------

with that as input we get with makeindex

   \item bar
     \subitem (item\_x1) bar, 1
     \subitem (item\_1) baz, 2, 5
      \subsubitem (item\_2) aaa, 1  % <-- wrong
      \subsubitem (item\_2) bbb, 2
      \subsubitem (item\_2) ccc, 3
   \item baz
     \subitem (item\_x1) baz, 2
      \subsubitem (item\_12) aaa, 1 % <-- correct
      \subsubitem (item\_2) bbb, 2
      \subsubitem (item\_2) ccc, 3

   \indexspace

   \item foo
     \subitem (item\_x1) bar
      \subsubitem (item\_x2) aaa, 1 % <-- correct
      \subsubitem (item\_2) bbb, 2
      \subsubitem (item\_2) ccc, 2
      \subsubitem (item\_2) ddd, 3


and with upmendex

   \item bar
     \subitem (item\_x1) bar, 1
     \subitem (item\_1) baz, 2, 5
      \subsubitem (item\_2) aaa, 1   % <-- wrong
      \subsubitem (item\_2) bbb, 2
      \subsubitem (item\_2) ccc, 3
   \item baz
     \subitem (item\_x1) baz, 2
      \subsubitem (item\_2) aaa, 1   % <-- wrong
      \subsubitem (item\_2) bbb, 2
      \subsubitem (item\_2) ccc, 3

   \indexspace

   \item foo
     \subitem (item\_x1) bar
      \subsubitem (item\_x2) aaa, 1 % <-- correct
      \subsubitem (item\_2) bbb, 2
      \subsubitem (item\_2) ccc, 2
      \subsubitem (item\_2) ddd, 3

so here upmendex fails in two cases makeindex only one.

Bottom line both programs need corrections

frank


More information about the tex-live mailing list.