bmv
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.
```
\documentclass{article}
\begin{filecontents}{myindexstyle.ist}
item_0 "\n\n {\\item} "
delim_0 "\\dotfill "
delim_1 "\\dotfill "
delim_2 "\\dotfill "
indent_space "\t"
indent_length 20
\end{filecontents}
\usepackage{indextools}
\usepackage{imakeidx}
\makeindex[options= -l -s myindexstyle.ist]
\makeatletter
\renewcommand*\@idxitem{\par\hangindent 20\p@}
\renewcommand*\subitem{\@idxitem \hspace*{0\p@}}
\renewcommand*\subsubitem{\@idxitem \hspace*{10\p@}}
\makeatletter
\newif\iffirst@subsubitem
\def\@idxitem{%
\par\hangindent 20\p@
\first@subsubitemtrue
}
\def\subsubitem{%
\par\hangindent 20\p@
\iffirst@subsubitem
\nobreak
\first@subsubitemfalse
\fi
}
\makeatother
\usepackage{ifthen}
\usepackage{amsmath}
\begin{document}
\newcounter{int}
\setcounter{int}{1}
\loop
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
\addtocounter{int}{2}
\ifnum \value{int}<30
\repeat
\printindex
\end{document}
```