2

I am currently stuck with a problem related to the indentation in the table of contents. Essentially, the numbering "eats into" the heading. This happens for "Chapter 7" and "Chapter 8" in the example. Unfortunately, I cannot change the type of numbering, as it is required by the professor.

Is there any method to increase indentation for chapters in the table of contents without changing indentation in the regular document?

Many thanks, your help is highly appreciated!

desp_user

\documentclass[12pt, a4paper, tocindentauto, bibliography=totoc, listof=totoc, final]{scrbook}

\renewcommand\thepart{\Alph{part}}
\renewcommand\thechapter{\Roman{chapter}}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\part{Part 1}
\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}
\chapter{Chapter 5}
\chapter{Chapter 6}
\chapter{Chapter 7 - issue}
\chapter{Chapter 8 - issue} 
\chapter{Chapter 9}

\end{document}
Marco Daniel
  • 95,681
  • Your redefinition of \thesection can be dangerous. The counter section starts at every chapter with 1. So you have a lot of section with the number 1 and so you can't reference to them. – Marco Daniel Apr 02 '17 at 12:30

1 Answers1

1

As esdd points out in the comments, recent versions of KOMA-Script offer the the option tocdynnumwidth. After adding the line

\RedeclareSectionCommand[tocdynnumwidth]{chapter}

to the preamble and running LaTeX three times, the maximally needed space required by any chapter number is reserved.

For older versions of KOMA-Script you have to set the maximal width manually by adding something like

\RedeclareSectionCommand[tocnumwidth=2.5em]{chapter}

to the preamble.

enter image description here

\documentclass[12pt, a4paper, tocindentauto, bibliography=totoc, listof=totoc, final]{scrbook}

\renewcommand\thepart{\Alph{part}}
\renewcommand\thechapter{\Roman{chapter}}
\renewcommand\thesection{\arabic{section}}
\renewcommand\thesubsection{\thesection.\arabic{subsection}}
\RedeclareSectionCommand[tocdynnumwidth]{chapter} % automatic, requires recent KOMA-Script
% \RedeclareSectionCommand[tocnumwidth=2.5em]{chapter} % manual adjustment
\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\part{Part 1}
\chapter{Chapter 1}
\chapter{Chapter 2}
\chapter{Chapter 3}
\chapter{Chapter 4}
\chapter{Chapter 5}
\chapter{Chapter 6}
\chapter{Chapter 7 - issue}
\chapter{Chapter 8 - issue} 
\chapter{Chapter 9}

\end{document}
gernot
  • 49,614
  • 1
    With an uptodate KOMA-Script version (3.22) it is also possible to use \RedeclareSectionCommand[tocdynnumwidth]{chapter}. Then it have to be run 3 times to get the desired result. – esdd Apr 02 '17 at 12:05
  • @esdd This is worth a separate answer, isn't it? Or do you want me to add it to my answer? – gernot Apr 02 '17 at 12:08
  • You can add it to your answer. – esdd Apr 02 '17 at 13:30