0

I have marked index entries in a document and get the following when I run \makeindex:

This is makeindex, version 2.15 [TeX Live 2020] (kpathsea + Thai support).
Scanning input file 2023_scl_002 copy.idx....done (171 entries accepted, 26 rejected).
Sorting entries....done (1400 comparisons).
Generating output file 2023_scl_002 copy.ind....done (240 lines written, 0 warnings).
Output written in 2023_scl_002 copy.ind.
Transcript written in 2023_scl_002 copy.ilg.

Why were 26 entries rejected? How can I determine the reasons for rejection?

Edit: I looked at the *.ilg file and saw this:

!! Input index error (file = 2023_scl_002 copy.idx, line = 157):
   -- Extra `!' at position 46 of first argument.

So I went to the *.idx file and saw this entry:

\indexentry{Joint Stock Company!General Assembly!Meetings!Frequency}{81}

I don't see the problem. Are four levels prohibited? If so, how can I include them?

2nd Edit: Looks like 4 levels isn't permitted under \makeindex. Is there a package that permits 4 levels? Or five?

@egreg:

3rd Edit:

So to use xindex, you have to:

  1. Run LaTeX once.
  2. Run LaTeX again to get the ToC.
  3. Run xindex against the LaTeX file
  4. Run LaTeX again to get a pdf with the xindex-generated index.

4th Edit:

Running \makeindex in order to use xindex still rejects four level deep entries.

4
  • What is in 2023_scl_002 copy.ilg? Just a copy of this text? Otherwise you probably have to do some digging to figure out where the problems are. It can be that the index text contains incorrect use of special chars. Without example code we cannot say much.
    – daleif
    Sep 16, 2022 at 10:55
  • @daleif: Please see edit.
    – user26732
    Sep 16, 2022 at 10:59
  • 2
    It is probably a limitation in makeindex. I tend to use texindy/xindy and it does not have such limitations. Though do remember that having these very deep indices makes them hard to read.
    – daleif
    Sep 16, 2022 at 11:57
  • You can try xindex instead of makeindex, which supports four levels. Not more.
    – egreg
    Sep 16, 2022 at 12:49

1 Answer 1

1

If you really need four levels, you can try xindex instead of makeindex.

\documentclass{book}
\usepackage[imakeidx]{xindex}

\makeindex

\makeatletter
\providecommand{\subsubsubitem}{\@idxitem\hspace*{40\p@}}
\makeatother

\begin{document}

\chapter{Test}

Abc

\index{Joint Stock Company}
\index{Joint Stock Company!General Assembly}
\index{Joint Stock Company!General Assembly!Meetings}
\index{Joint Stock Company!General Assembly!Meetings!Frequency}

\printindex

\end{document}

Running this with pdflatex -shell-escape produces the four level index.

enter image description here

Five levels? It can be done.

\documentclass{book}
\usepackage[imakeidx]{xindex}

\makeindex

\makeatletter
\providecommand{\subsubsubitem}{\@idxitem\hspace*{40\p@}}
\providecommand{\subsubsubsubitem}{\@idxitem\hspace*{50\p@}}
\makeatother

\begin{document}

\chapter{Test}

Abc

\index{Joint Stock Company}
\index{Joint Stock Company!General Assembly}
\index{Joint Stock Company!General Assembly!Meetings}
\index{Joint Stock Company!General Assembly!Meetings!Frequency}
\index{Joint Stock Company!General Assembly!Meetings!Frequency!Gosh}

\printindex

\end{document}

enter image description here

4
  • Deleting the package \usepackage(makeidx) throws an Undefined control sequence.<argument> \imki@jobame @idxfile at the last line of the document. Keeping the makeidx package and adding \usepackage[imakeidx]{xindex} throws the same error.
    – user26732
    Sep 17, 2022 at 2:02
  • Looks like to run properly, \usepackage[imakeidx]{xindex} has to precede \makeindex. However, when running \makeindex, the fourth level entries continue to be rejected.
    – user26732
    Sep 17, 2022 at 2:08
  • BTW, if this needs calling an external shell (no terminal shell pops up) command, then the solution doesn't work under TexShop and TexLive 2020.
    – user26732
    Sep 17, 2022 at 2:11
  • \makeindex still identifies errors; these are not picked up by running pdflatex from the command prompt.
    – user26732
    Sep 20, 2022 at 11:25

You must log in to answer this question.

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