3

I would like to increasing the space between section number and title in the toc. I tried to solve the problem using \setlength\cftsectionnumwidth{ } but this does not work with the class scrbook.

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}

\usepackage{tocloft}

\renewcommand\thesection{\arabic{section}}
\cftsetindents{section}{0pt}{15pt}
\cftsetrmarg{2cm}
\renewcommand{\cftdot}{}

\begin{document}
\tableofcontents
\chapter*{Chapter 1}
\section{Section 1}
\section{Section 2}
\section{Section 3}
\section{Section 4}
\end{document}
1

1 Answer 1

2

With tocloft (not recommended with a KOMA-Script class) the number width for the entries in TOC is set by the third argument of \cftindents. Assumnig the number width should be 50pt

\cftindents{section}{0pt}{50pt}

But you will get the same result using

\setlength\cftsecindent{0pt}
\setlength\cftsecnumwidth{50pt}

enter image description here

Code:

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}

\usepackage{tocloft}

\renewcommand\thesection{\arabic{section}}
\cftsetindents{section}{0pt}{50pt}% <- changed
\cftsetrmarg{2cm}
\renewcommand{\cftdot}{}

\begin{document}
\tableofcontents
\addchap*{Chapter 1}
\section{Section 1}
\section{Section 2}
\section{Section 3}
\section{Section 4}
\end{document}

Suggestion without tocloft:

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\renewcommand\thesection{\arabic{section}}

\RedeclareSectionCommand[
  tocindent=0pt,
  tocnumwidth=50pt,
]{section}

\RedeclareSectionCommands[
  toclinefill=\hfill
]{section,subsection,subsubsection,paragraph,subparagraph}
\makeatletter
\renewcommand{\@tocrmarg}{2cm}
\makeatother

\begin{document}
\tableofcontents
\addchap*{Chapter 1}
\section{Section 1}
\section{Section 2}
\section{Section 3}
\section{Section 4}
\end{document}

Because of a comment below: The headings of TOC, LOF and LOT are chapters by default (with a book class). So if you want to modify the font of the TOC title and the skip below the TOC title, you can use eg.

\BeforeTOCHead[toc]{%
  \addtokomafont{chapter}{\normalsize}
  \RedeclareSectionCommand[afterskip=1sp]{chapter}%
}

If you remove the optional argument, then the the titles of the lists (LOF and LOT) will change in the same way.

4
  • Is there also a command for \cfttoctitlefont and \cftaftertoctitleskip without tocloft?
    – user123937
    Mar 26, 2018 at 11:45
  • See my updated answer.
    – esdd
    Mar 26, 2018 at 12:03
  • the "without tocloft" part of this answer does not seem to change anything in the LOF. How would it have to be modified?
    – lucidbrot
    Oct 1, 2023 at 9:18
  • 1
    @lucidbrot Use \DeclareTOCStyleEntry oder \DeclareTOCStyleEntries, eg. \DeclareTOCStyleEntries[linefill=\hfill]{tocline}{figure,table}
    – esdd
    Oct 7, 2023 at 18:23

You must log in to answer this question.

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