5

Can one change the size of the dots in the table of contents, those that run between the section name and the page?

Eilon

2
  • 4
    Do you mean the radius of the dot or dot separation?
    – user11232
    Commented Feb 12, 2014 at 8:44
  • The tocstyle package should be able to do that: \settocfeature{dothook}{…} or \settocstylefeature{leader}{…} or similar.
    – Crissov
    Commented Feb 12, 2014 at 11:13

1 Answer 1

5

In standard classes, the dots between ToC entries and their page numbers are given by the kernel's \@dottedtocline; the dots are produced using \leaders to typeset copies of \hbox{.}; the separation between dots is controlled by \@dotsep mu, were \@dotsep is a number with default value of 4.5. To change those settings, you can patch \@dottedtocline to replace \hbox{.} with whatever you want (a scaled dot, as in my example) and/or redefine \@dotsep to the desired value (I chose 12 in my example). The argument of \mydot controls the scaling factor of the default . used in the original definition (in my example I chose 2 for this factor)

\documentclass{article}
\usepackage{graphicx}
\usepackage{etoolbox}

\makeatletter
% scale dots
\newcommand\mydot[1]{\scalebox{#1}{.}}
\patchcmd{\@dottedtocline}
  {\hbox{.}}
  {\hbox{\mydot{2}}}
  {}
  {}
% change separation between dots
\renewcommand\@dotsep{12} %default: 4.5
\makeatother

\begin{document}


\tableofcontents

\section{Test section}
\subsection{Test subsection}
\subsubsection{Test subsubection}
\subsubsection{Test subsubection}
\subsection{Test subsection}
\subsubsection{Test subsubection}
\subsubsection{Test subsubection}
\subsubsection{Test subsubection}

\end{document}

The resulting document:

enter image description here

Of course, there's a number of packages that help you to achieve the same without having to know the originals definitions. For example, the same modifications can be achieved with a redefinition of \cftdot and \cftdotsep provided by the tocloft package:

\documentclass{article}
\usepackage{graphicx}
\usepackage{tocloft}

\newcommand\mydot[1]{\scalebox{#1}{.}}
\renewcommand\cftdot{\mydot{2}}
\renewcommand\cftdotsep{12}

\begin{document}


\tableofcontents

\section{Test section}
\subsection{Test subsection}
\subsubsection{Test subsubection}
\subsubsection{Test subsubection}
\subsection{Test subsection}
\subsubsection{Test subsubection}
\subsubsection{Test subsubection}
\subsubsection{Test subsubection}

\end{document}

Another packages that could also be used to achieve the same redefinitions include:

0

You must log in to answer this question.

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