## Background

A manual with chapters, sections, subsections, and sub-subsections. Using KOMA Script v2.

## Problem

The spacing between the heading title and its number is too close to the number in some cases:

After reading the tocloft package, I do not see how to adjust the spacing between the heading title and the number.

## Question

How do you increase the space before the section title a consistent amount?

## Ideas

Tried including the following package:

\usepackage[tocindentauto]{tocstyle}


Tried setting linewidth:

\setlength{\linewidth}{15em}


Tried setting the dottedtocline:

\makeatletter
\renewcommand*{\l@section}{\@dottedtocline{1}{4.5em}{5.3em}}
\makeatother


The last attempt looks promising, but it is tricky to adjust the margins correctly.

## References

-

\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{1.5em}{2.6em}}
\renewcommand{\l@subsection}{\@dottedtocline{2}{4.0em}{3.6em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{3}{7.4em}{4.5em}}
\makeatother


If there was a way to do this relative to the old values (by adding spacing), rather than writing over the old values, that would be nice to know. The result:

-
By all means, it's encouraged that you answer your own question, but it's also encouraged to wait a bit longer with that. –  Hendrik Vogt Mar 17 '11 at 8:49

For me, tocstyle produces correct horizontal spacing with both standard and KOMA-script classes. Try to compile my example with three or even four LaTeX runs -- maybe the makefile you use doesn't recognize that tocstyle needs yet another LaTeX run to calculate the ToC spacing.

\documentclass{scrreprt}

\usepackage{tocstyle}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\begin{document}

\tableofcontents

\setcounter{chapter}{100}
\chapter{bla}
\setcounter{section}{200}
\section{blubb}
\setcounter{subsection}{300}
\subsection{foo}
\setcounter{subsubsection}{400}
\subsubsection{bar}

Some text.

\end{document}

-
Thanks for this. I'm not sure if this is an exact reproduction of the problem, though. The preamble for this manual is 1000 lines long. Inside I have set different fonts. Also, I'm using tocloft, not tocstyle (if that matters). –  Dave Jarvis Mar 17 '11 at 0:27
@Dave: Yes, it matters. My suggestion boils down to use tocstyle instead of tocloft. –  lockstep Mar 17 '11 at 0:33
@Dave: One of the features of tocstyle is automatic calculation of ToC spacing instead of using fixed pre-set values. –  lockstep Mar 17 '11 at 0:37
Substituting tocstyle for tocloft results in a lot of "Undefined control sequence" errors that I have neither the time nor inclination to resolve. One day, perhaps, latex will generate errors that are a bit more meaningful to the lay person. I do appreciate you taking the time to suggest an alternative, though! –  Dave Jarvis Mar 17 '11 at 0:45