19

How can i change formatting of the table of contents to avoid section numbering and section title to overlap?

Document:

\documentclass[10pt,oneside,notitlepage]{book}

% Use Heuristica Font
\usepackage{heuristica}
\usepackage[heuristica,vvarbb,bigdelims]{newtxmath}
\renewcommand*\oldstylenums[1]{\textosf{#1}}


\begin{document}

\tableofcontents

\part{Part one}

\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}


\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}

\end{document}

Example output: Output example

5
  • 1
    Please provide the minimal code that generates this wrong output. I assume that a wrong \thesection etc. command is applied or a misused of tocloft features
    – user31729
    Commented Feb 29, 2016 at 13:46
  • 1
    Also, Welcome to LaTeX! Welcome to TeX.SX!
    – JP-Ellis
    Commented Feb 29, 2016 at 13:53
  • 1
    potentiial duplicate: Roman numerals become “too wide” in table of contents. (arabic numerals are no different from roman numerals in this respect.) Commented Feb 29, 2016 at 17:12
  • @ChristianHupfer I have added code and a new example screenshot. It looks like the heuristica font/package is causing the issue.
    – Nichlas H.
    Commented Mar 1, 2016 at 12:12
  • @NichlasH.: Thanks -- see the (possible) answer please.
    – user31729
    Commented Mar 1, 2016 at 12:16

1 Answer 1

21

The space needed by the section number(s) is too small. Using tocloft this spacing can be controlled by the length register \cftsecnumwidth, adding some value with \addtolength{\cftsecnumwidth}{10pt} will improve the spacing.

The value of 10pt can be changed of course.

\documentclass[10pt,oneside,notitlepage]{book}

% Use Heuristica Font
\usepackage{heuristica}
\usepackage[heuristica,vvarbb,bigdelims]{newtxmath}
\renewcommand*\oldstylenums[1]{\textosf{#1}}
\usepackage{tocloft}

\addtolength{\cftsecnumwidth}{10pt}

\begin{document}

\tableofcontents

\part{Part one}

\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}
\chapter{Chapter Oh}


\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}
\section{Chapter Hi}

\end{document}

enter image description here

5
  • Thank you! That will work well into the third and fourth digit chapter numbers (i hope to end the document well before that!). Also thanks for hinting tocloft, looks like it has some interresting options.
    – Nichlas H.
    Commented Mar 1, 2016 at 12:19
  • @NichlasH.: You can change the value of 10pt to 'anything' -- as you wish.
    – user31729
    Commented Mar 1, 2016 at 12:21
  • Yes, I'll test it out and find what works for my document. I'm sorry that I don't have anough points (yet) to upvote your answer.
    – Nichlas H.
    Commented Mar 1, 2016 at 12:23
  • @NichlasH.: That's alright. You can accept it later on anyway ;-)
    – user31729
    Commented Mar 1, 2016 at 12:24
  • Doesn't work for me. Above like 10-20pt it stops changing the width Commented Jul 28, 2022 at 15:47

You must log in to answer this question.

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