# How to add a space between a title and the dotted leader?

I need to put some horizontal space between a title (of chapter, section, subsection, etc.) and the dotted leader, as it is marked in the given figure by red rectangles. The space should be independent of the distance between dots. Moreover, I would rather not to apply a trivial solution, which consists in adding the space at the end of every title. Could anybody tell me, how to modify the tocloft commands in order to obtain the considered effect? I would very appreciate for any reply.

• Welcome! Please provide us with a Minimal Working Example - code for a small document which we can copy, paste and compile to reproduce your current results. (Not all of it, of course - we just need enough to see the problem.) The format of the ToC is highly dependent on your class and, if relevant, the use of other packages which modify it (e..g. titletoc, etoc etc.). Right now, we'd just be guessing and so our answers would as likely be useless to you as not. – cfr Apr 7 '16 at 2:09

You can put the space in \cftXleaders before the actual leaders:

\documentclass{book}
\usepackage[titles]{tocloft}

\begin{document}

\tableofcontents

\chapter{Title}

\section{First}

\section{The Next}
\subsection{A test}

\end{document}


Here, just by way of example, I used three different values for the added space.

• Touche! I never made it to p.18 of the documentation. – Steven B. Segletes Apr 7 '16 at 12:10
• Thank you very much, this is it! You really helped me a lot. – Adam Apr 8 '16 at 0:35

For the tocloft package (tagged by the OP's question), after turning dots on with \cftsecdotsep, the gap between section title and the dot leader can be adjusted by redefining \cftsecfillnum to add a \hspace at the very beginning.

\documentclass{article}
\usepackage{tocloft}
\renewcommand\cftsecdotsep{\cftdotsep}
\makeatletter
\renewcommand{\cftsecfillnum}[1]{\hspace{30pt}% H<--- HERE IS WHAT TO ADD

Of course, this change is just for section leaders. It will have to be repeated for other sectioning units, as desired. I looked in the style file itself, in order to determine the extant definition for \cftsecfillnum.