Page Layouttableofcontents, overfull \hbox, text over text problem

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
trip3131
Posts: 1
Joined: Mon May 24, 2010 1:47 pm

tableofcontents, overfull \hbox, text over text problem

Post by trip3131 »

What I did:

\renewcommand{\thesection}{{\sc Chapter \arabic{section}}}

to have other section styles and names.
The command \tableofcontents, creates a warning overfull \hbox.

Normally you get
1 Title section 1
etc.

Now I get:
(both on the same line, thus over each other)

Chapter 1
Title section 1

Thus it looks like:
Cha%$%$%$ection 1

It seems that the hbox for the sectionnumber 1 etc is not changed, so the "Chapter 1" does not fit.

Can you help me?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

tableofcontents, overfull \hbox, text over text problem

Post by gmedina »

Hi,

switch to a class implementing chapters (book, scrbook, memoir) and use the titlesec/titletoc packages to customize the headings and the ToC entries. A little example:

Code: Select all

\documentclass{book}
\usepackage{titlesec}
\usepackage{titletoc}

\titleformat{\chapter}[hang]
  {\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titlespacing*{\chapter} 
 {0pt}{20pt}{20pt}
\titlecontents{chapter}[0pt]
  {}{\contentspush{Chapter\hspace*{10pt}}\thecontentslabel\hspace*{1em}}
  {}{\titlerule*[1pc]{.}\contentspage}

\begin{document}
\tableofcontents
\chapter{Test chapter}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply