1

In my table of contents, I observe that headings numbers nearly overlap titles of sections, as illustrated below.

enter image description here

What could I do to solve that? This is a MWE (a little bit long because I don't know exactly if I did not make any mistake) :

\documentclass[fontsize=12pt,%
               twoside=semi,%
               headings=small,%
               chapterprefix=true,%
               listof=flat]%
{scrbook}

\usepackage[utf8]{inputenc}
\usepackage [french]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}
%\addtokomafont{disposition}{\rmfamily}
\stepcounter{secnumdepth}
\stepcounter{tocdepth}
\usepackage{url}
\usepackage{chronosys}
\usepackage{setspace}
%\onehalfspacing


\usepackage{chngcntr}
\counterwithout{footnote}{chapter}
%\usepackage[titles]{tocloft}

\usepackage{lipsum}


\usepackage[marginparsep=8pt,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}


\newcounter{qcounter}


\usepackage{hyperref}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\AtBeginDocument{\renewcommand{\thepart}{\Roman{part}}}


\date{}


\begin{document}

\frontmatter



\pagestyle{scrheadings}

\tableofcontents

\mainmatter

\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}


\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum


\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}


\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum


\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum

\subsubsection{Une sous-sous-section}
\lipsum

\subsubsection{Une sous-sous-section}
\lipsum

\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum


\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum


\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum


\part{Une partie}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\chapter{Un chapitre}
\lipsum
\section{Une section}
\lipsum
\subsection{Une sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum
\subsubsection{Une sous-sous-section}
\lipsum





\end{document}
domi
  • 1,473
  • 4
    Your document is empty, there is nothing to overlap then ;-) –  Jun 11 '17 at 11:43
  • ... yes it is: I can't send you my whole thesis. Reason why I posted a picture. Isn't that enough? – domi Jun 11 '17 at 11:46
  • 1
    https://tex.stackexchange.com/questions/296545 or maybe https://tex.stackexchange.com/questions/7853 – Dr. Manuel Kuehner Jun 11 '17 at 11:46
  • 3
    @Dr.ManuelKuehner Bad idea. Do NOT use tocloft with KOMA. – TeXnician Jun 11 '17 at 11:47
  • 2
    @domi Well, typically people here expect that you provide a minimal and yet complete example code so that it's easy to help and that there is less chance of misunderstanding. See https://tex.stackexchange.com/questions/296545 for example. – Dr. Manuel Kuehner Jun 11 '17 at 11:47
  • 1
    @TeXnician Ok ok :): Another try: https://tex.stackexchange.com/questions/7415 (tocstyle). Actually, I didn't see the scrbook due to the formatting in the question code :). – Dr. Manuel Kuehner Jun 11 '17 at 11:48
  • 1
    @Dr.ManuelKuehner Also a bad idea. tocstyle is beta. There is tocbasic. – TeXnician Jun 11 '17 at 11:51
  • @TeXnician I give up :). – Dr. Manuel Kuehner Jun 11 '17 at 11:52
  • 1
    @domi: What's the point in posting the screenshot of your real code outcome and providing a document code that does not even generate output? –  Jun 11 '17 at 11:54
  • We recently had a similar question. take a look at tocindent or something like that in the manual. – Johannes_B Jun 11 '17 at 11:55
  • @Johannes_B: Where's tocindent from? It's not on TL 2017 –  Jun 11 '17 at 11:57
  • @Dr.ManuelKuehner 'tocloft' works and my problem is solved. – domi Jun 11 '17 at 11:58
  • Since all helpers here can surely reproduce that output, i don't think there is a real need to see a minimal working example here. The class in use is most important. Knowing the OP is unable to provide a MWE due to a lack of knowledge, why bother asking for one? – Johannes_B Jun 11 '17 at 11:59
  • 1
    You should NOT use tocloft with KOMA. Usually listof=flat already solves the issue. On the other hand there's tocbasic with \setuptoc{toc}{dynnumwidth=true}. – TeXnician Jun 11 '17 at 11:59
  • 2
    @Johannes_B: Sorry, I don't think you should support pure laziness –  Jun 11 '17 at 12:01
  • @Christian Hupfer Please, let me take some time to understand how that works and I'll come back to you with another mwe. I'm currently rebuilding my preamble. "Laziness"? I'll send you too both a mwe and my CV. – domi Jun 11 '17 at 12:25
  • 1
    Why do you remove the MWE that shows your problem with some useless junk of code? – Johannes_B Jun 12 '17 at 04:44
  • @Johannes_B: Did you mean replace instead of remove? –  Jun 12 '17 at 04:59
  • @ChristianHupfer Yes, i did. – Johannes_B Jun 12 '17 at 07:44
  • @Johannes_B I did it because I provided you a new mwe and because I was not sure that there was not some error in my preamble. – domi Jun 12 '17 at 08:53

2 Answers2

3

The KOMA-Script classes load package tocbasic automatically. So it should be used to format the ToC and its entries. (Do not use tocloft! And package tocstyle will never leave the beta status, AFAIK it is not developed anymore.)

There are different ways to avoid the overlapping.

You could use option toc=flat:

\documentclass[fontsize=12pt,%
               twoside=semi,%
               headings=small,%
               chapterprefix=true,%
               listof=flat,%
               toc=flat,% <- added
              ]%
{scrbook}[2017/01/03]

\usepackage[utf8]{inputenc}
\usepackage [french]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}

\usepackage{blindtext}% only for dummy text
\usepackage[marginparsep=8pt,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}

\usepackage{scrlayer-scrpage}

\usepackage{hyperref}

\setcounter{tocdepth}{\subsubsectiontocdepth}
\setcounter{secnumdepth}{\subsubsectionnumdepth}
\AtBeginDocument{\renewcommand{\thepart}{\Roman{part}}}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{Une partie}
\blindtext
\blinddocument
\setcounter{chapter}{33}% only for the example
\chapter{Un chapitre}
\blindtext
\setcounter{section}{17}% only for the example
\section{Une section}
\blindtext
\setcounter{subsection}{13}% only for the example
\subsection{Une sous-section}
\blindtext
\setcounter{subsubsection}{10}% only for the example
\subsubsection{Une sous-sous-section}
\blindtext
\end{document}

Run three times to get

enter image description here

Or you could use \RedeclareSectionCommands[tocdynnumwidth=true]{...}:

\documentclass[fontsize=12pt,%
               twoside=semi,%
               headings=small,%
               chapterprefix=true,%
               listof=flat,%
              ]%
{scrbook}[2017/01/03]
\RedeclareSectionCommands[tocdynnumwidth=true]
  {chapter,section,subsection,subsubsection}% <- added

\usepackage[utf8]{inputenc}
\usepackage [french]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}

\usepackage{blindtext}% only for dummy text
\usepackage[marginparsep=8pt,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}

\usepackage{scrlayer-scrpage}

\usepackage{hyperref}

\setcounter{tocdepth}{\subsubsectiontocdepth}
\setcounter{secnumdepth}{\subsubsectionnumdepth}
\AtBeginDocument{\renewcommand{\thepart}{\Roman{part}}}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{Une partie}
\blindtext
\blinddocument
\setcounter{chapter}{33}% only for the example
\chapter{Un chapitre}
\blindtext
\setcounter{section}{17}% only for the example
\section{Une section}
\blindtext
\setcounter{subsection}{13}% only for the example
\subsection{Une sous-section}
\blindtext
\setcounter{subsubsection}{10}% only for the example
\subsubsection{Une sous-sous-section}
\blindtext
\end{document}

Run three times to get

enter image description here

Or you can adjust numwidth manuelly using **\RedeclareSectionCommand[tocnumwidth=...]{...}:

\documentclass[fontsize=12pt,%
               twoside=semi,%
               headings=small,%
               chapterprefix=true,%
               listof=flat,%
              ]%
{scrbook}[2017/01/03]
\RedeclareSectionCommand[tocnumwidth=2em]{chapter}% <- added
\RedeclareSectionCommand[tocnumwidth=3em]{section}% <- added
\RedeclareSectionCommand[tocnumwidth=4.1em]{subsection}% <- added
\RedeclareSectionCommand[tocnumwidth=5.3em]{subsubsection}% <- added

\usepackage[utf8]{inputenc}
\usepackage [french]{babel}
\usepackage[T1]{fontenc}
\usepackage{mathptmx}

\usepackage{blindtext}% only for dummy text
\usepackage[marginparsep=8pt,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}

\usepackage{scrlayer-scrpage}

\usepackage{hyperref}

\setcounter{tocdepth}{\subsubsectiontocdepth}
\setcounter{secnumdepth}{\subsubsectionnumdepth}
\AtBeginDocument{\renewcommand{\thepart}{\Roman{part}}}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\part{Une partie}
\blindtext
\blinddocument
\setcounter{chapter}{33}% only for the example
\chapter{Un chapitre}
\blindtext
\setcounter{section}{17}% only for the example
\section{Une section}
\blindtext
\setcounter{subsection}{13}% only for the example
\subsection{Une sous-section}
\blindtext
\setcounter{subsubsection}{10}% only for the example
\subsubsection{Une sous-sous-section}
\blindtext
\end{document}

Run two times to get:

enter image description here

esdd
  • 85,675
2

As you're using a KOMA-Script class you should not use tocloft. tocloft should give you a warning if you load it with KOMA.

Usually you're done with toc=flat. But you should consider to compile multiple times.

Another option: tocstyle, which is currently (and probably forever) beta, is part of the KOMA bundle.

TeXnician
  • 33,589