add tag
I would like to use dotfill between the index entries and the page numbers with the condition that the page numbers should start at the same column in each row, and there should be enough space (e.g. at least 3 dots) between the index entry and the page number.

At the same time, I would like to achieve that in the index the second level items should be shown only when they have an associated page number. I tried to set item_x2 to "" but it does not give the expected result.

    item_0 "\n\n {\\item} "
    delim_0 "\\dotfill "
    delim_1 "\\dotfill "
    delim_2 "\\dotfill "
    indent_space "\t"
    indent_length 20

\makeindex[options= -l -s]

\renewcommand*\@idxitem{\par\hangindent 20\p@}
\renewcommand*\subitem{\@idxitem \hspace*{0\p@}}
\renewcommand*\subsubitem{\@idxitem \hspace*{10\p@}}
\par\hangindent 20\p@
\par\hangindent 20\p@

Foo \index{Key1!item!subitem@{item:subitem}} bar \index{Key1!other} my \index{Key1!other!subitem@{other:subitem}}\clearpage aa\clearpage
Foo \index{Key1!item!subitem2@{item:subitem2}} bar \index{Key1!other} my \index{Key1!item!subitem3@{item:subitem3}}\clearpage aa\clearpage
\ifnum \value{int}<30


This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.