First an MWE and its output:
\documentclass[a4paper, 10pt]{book}
\usepackage{hyperref}
\usepackage{imakeidx}
\makeindex
\newcommand{\AddIndexLetterToTOC}[1]{\textbf{#1}\phantomsection\addcontentsline{toc}{section}{#1}}
\usepackage{filecontents}
\begin{filecontents*}[overwrite]{\jobname.mst}
headings_flag 1 %
heading_prefix "\\AddIndexLetterToTOC{"
heading_suffix "}\\nopagebreak\n"
delim_0 "\\dotfill"
delim_1 "\\dotfill"
delim_2 "\\dotfill"
\end{filecontents*}
\begin{document}
\tableofcontents
\chapter{Test chapter}
\index{And}
\index{Book}
\index{Summer}
\index{Latex}
\pagebreak
\addcontentsline{toc}{chapter}{Index}
\printindex
\end{document}
As you see, the dot spaces in Contents and Index are different, so
(question 1) is there any way to make the dot space in Index be the same as that in Contents, and to keep the dot space in Contents be unchanged?
I know an answer with the help of the tocloft
package which I don't want to use since it will change some other setting in my .tex
files. Or
(question 2) is there any way to make the dot space in Contents be the same as that in Index, and to keep the dot space in Index be unchanged?
By the way, the definition of \@dottedtocline
for Contents is as follows:
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus .2\p@
{\leftskip #2\relax \rightskip
\@tocrmarg \parfillskip -\rightskip \parindent #2\relax
\@afterindenttrue \interlinepenalty \@M \leavevmode
\@tempdima #3\relax
\advance \leftskip \@tempdima \null \nobreak
\hskip -\leftskip {#4}\nobreak
\leaders \hbox {$\m@th \mkern \@dotsep mu\hbox {.}\mkern \@dotsep mu$}
\hfill \nobreak
\hb@xt@ \@pnumwidth {\hfil \normalfont \normalcolor #5}\par }
\fi
and the definition for \dotfill
for Index is also as follows:
\def\dotfill{\leaders\hbox to.6em{\hss .\hss}\hskip\z@ plus 1fill\kern\z@}%
But I don't know how to get the desired result after reading them.