LaTeX forum ⇒ Page Layout ⇒ Heading Numbers overlap Heading Titles in ToC Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am

Heading Numbers overlap Heading Titles in ToC

Hi folks,

I am currently have some issue with the table of contents looking clinched (please see attachment).

Is this a common problem? It used to be that I just had to hit "PDFLaTeX" like four times and then hit "View PDF" and it would look fine, that trick is not working anymore.

Does anyone know what is the problem?
Attachments
ToC-overlapping.png (30.86 KiB) Viewed 4631 times
Last edited by localghost on Sun Jan 20, 2013 1:21 pm, edited 1 time in total.
Reason: Image cut to the relevant content.

mas
Posts: 189
Joined: Thu Dec 04, 2008 4:39 am
It looks like a spacing issue with the ToC. It would be better if you posted a minimal working example.

I would suggest that you look at the package tocloft to fine tune the spacing issues.

Regards.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim

jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am
Does that mean you want to see my like \usepackage declarations? I would rather not post the whole TeX document on here.

mas
Posts: 189
Joined: Thu Dec 04, 2008 4:39 am
No, people are not interested in the whole document You can remove all the text matter and prune others to such an extent that it just reproduces the problem. Unless you show that code, people will not be able to help you completely.

In your case, it could have been a piece of code similar to this
\documentclass{book}\usepackage{lipsum} \begin{document}\tableofcontents \chapter{Introduction}\lispum[1-2] \chapter{Hadrons}\lipsum[5-6] \chapter{Leptons}\lipsum[50-55] \end{document}

Of course, you can also add section and subsections to exhibit the problem you are facing.

OS: Debian/GNU Linux; LaTeX System : TeXLive; Editor : Vim

jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am
Last edited by cgnieder on Sun Jan 20, 2013 6:05 pm, edited 1 time in total.
Reason: added code markup

Stefan Kottwitz
Posts: 7875
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
jgomez2, would you be so kind to visit the link given by mas? I mean this one: minimal working example, with a focus on minimal, such as

\documentclass{revtex4-1} \begin{document}\tableofcontents\listoffigures\section{Brief Review of Necessary Quantum Mechanics}\subsection{Dirac Notation}\subsection{Quantum Mechanical Vector Projections}\subsubsection{Vector Addition}\subsection{Heisenberg Uncertainty Principle}\subsection{Feynman Diagrams}\end{document}

It still shows the problem:

toc1.png (21.27 KiB) Viewed 4620 times

It's much easier to fix then. In this case, just insert this right after \tableofcontents:

\makeatletter\let\toc@pre\relax\let\toc@post\relax\makeatother

The problem is gone:

toc2.png (21.88 KiB) Viewed 4620 times

The reason is, that RevTeX computes dimensions in the TOC lines(width of section numbers) but following lists of figures or tables change this calculation. The code above simply disables this faulty behavior.

Stefan
Last edited by Stefan Kottwitz on Sun Jan 20, 2013 7:47 pm, edited 1 time in total.
Reason: MWE explanation shortened

jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am
understood, will do better next time

Stefan Kottwitz
Posts: 7875
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:
Great! So I shortened my explanation above, to stay focused. Btw. very good that your example was compilable.

As you already showed more code, a few further tipps:

• \usepackage{color} can be removed since you load xcolor.
• You don't need to load amsmath too, as RevTeX does it for you already.
• chngcntr could be omitted if you use \numberwithin of amsmath, such as \numberwithin{equation}{section}.
• This chapter line doesn't match the meaning of LaTeX:
\begin{center}\chapter{{\Huge \textbf{CHEM 705 Section 1: Particle Physics}}}\end{center}
Better don't use font commands in heading commands, just the text. Instead, format your headings document-wide. It would be better structured and consistent, and note that the heading text may be used in the table of contents and in headers, which should not be huge for sure. Even if it's not visible here with RevTeX - just a general remark.
Stefan