A LaTeX makeindex style with dashes to indicate subitems and subsubitems is desired. The posting Makeidx, Subentries and dashes here looked like the ticket. With the suggested additions, and a couple from elsewhere, here is the modified .ist

preamble "\\begin{theindex}\\thispagestyle{empty}\n"
quote '+'
headings_flag 1
heading_suffix ""
item_1  "\n \\subitem --- "
item_x1 "\n \\subitem --- "
item_2  "\n \\subsubitem --- --- "
item_x2 "\n \\subsubitem --- --- "
delim_0 ": "
delim_1 ": "
delim_2 ": "
delim_r "-"
suffix_2p "\\,f."
suffix_3p "\\,ff."

The following LaTeX MWE was tested with the style file above (the idxlayout package is used to kill the indents and get a multicolumn index)

\usepackage[subindent=0pt,subsubindent=0pt, totoc=true]{idxlayout}

ParentA\index{ParentA}, SubAA\index{ParentA!SubAA}, SubAB\index{ParentA!SubAB}, SubAC\index{ParentA!SubAC}

ParentB\index{ParentB}, SubBA\index{ParentB!SubBA}, SubsubBAA\index{ParentB!SubBA!SubsubBAA}, SubsubBAB\index{ParentB!SubBA!SubsubBAB}, SubBB\index{ParentB!SubBB}


The problem is that, in the output, the first subitem in a list of subitems does not get the preceding dash(es)

undesired index format

even though the second, third, etc. do. The desired index output is

desired index format

The undesired output only seems to happen when the parent item is itself indexed in the document (and so gets a page number in the index). How may I achieve the desired index format?


1 Answer 1


I did a bit more research, and I found the answer. Two more lines need to be added to the .ist file, namely

item_01 "\n \\subitem --- "
item_12 "\n \\subsubitem --- --- "

where, for example item_01 is the

Command to be inserted between a level 0 item and a level 1 item.

The command item_x1 is the

Command to be inserted between a level 0 item and a level 1 item, where the level 0 item does not have associated page numbers.

There is a similar distinction between item_12 and item_x2. Adding the two commands to the .ist file gives the desired effect, whether the parent index item has a page number or not.

The quoted descriptions come from the Overleaf web site, at https://www.overleaf.com/learn/latex/Indices.

You must log in to answer this question.

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