Page LayoutHeading Numbers overlap Heading Titles in ToC

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

Heading Numbers overlap Heading Titles in ToC

Post by jgomez2 »

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
ToC-overlapping.png (30.86 KiB) Viewed 14696 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.

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

mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Heading Numbers overlap Heading Titles in ToC

Post by mas »

It looks like a spacing issue with the ToC. It would be better if you posted a Infominimal 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

Heading Numbers overlap Heading Titles in ToC

Post by jgomez2 »

Does that mean you want to see my like \usepackage declarations? I would rather not post the whole TeX document on here.
mas
Posts: 226
Joined: Thu Dec 04, 2008 4:39 am

Heading Numbers overlap Heading Titles in ToC

Post by mas »

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

Code: Select all

\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

Heading Numbers overlap Heading Titles in ToC

Post by jgomez2 »

Code: Select all

%\documentclass[12pt]{revtex4-1}
\documentclass[showpacs,preprintnumbers,amsmath,amssymb, nofootinbib]{revtex4-1}
%\usepackage{tocloft}
\usepackage{color}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{float}
\usepackage{url}
\usepackage{chngcntr}
\usepackage{hyperref}
\counterwithin{equation}{section}
\counterwithin{figure}{section}
\counterwithin{table}{section}
\usepackage{amsmath}
\usepackage{lineno}
\usepackage{etex}
\usepackage{bm}
%%%%%%%%%%%FEYNMAN STUFF
\usepackage{feynmp}
\DeclareGraphicsRule{.1}{mps}{.1}{}
%\usepackage{pst-pdf}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\hypersetup{colorlinks,
 linkcolor=blue,
 filecolor=black,
 urlcolor=blue,
 citecolor=black
}
\usepackage{varioref}
\usepackage{graphicx}
\newcommand{\dirac}[1]{\vert #1 \rangle}
\newcommand{\bra}[1]{\langle #1}
\newcommand{\vecbf}[1]{\vec{\textbf{#1}}}
    \makeatletter
    \def\endfmffile{%
      \fmfcmd{\p@rcent\space the end.^^J%
      end.^^J%
      endinput;}%
      \if@fmfio
        \immediate\closeout\@outfmf
      \fi
      \ifnum\pdfshellescape=\@ne
        \immediate\write18{mpost \thefmffile}%
      \fi}
    \makeatother
\begin{document}
\begin{center}
\chapter{{\Huge \textbf{CHEM 705 Section 1: Particle Physics}}}
\end{center}
\tableofcontents
\newpage
\addcontentsline{toc}{chapter}{Contents}
\listoffigures
\addcontentsline{toc}{chapter}{List of Figures}
\listoftables
\addcontentsline{toc}{chapter}{List of Tables}
\linenumbers

\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}

\section{Leptons}


\section{The Gauge Bosons}


\subsubsection{Weak Bosonic Decays}

\section{Hadrons}

\subsection{Quarks}

\subsection{Mesons}

\subsubsection{Pion Decays}

\subsection{Baryons}


\subsubsection{Beta Decay}

\subsubsection{The $\Delta$ Particle}

\section{Heavier Quarks} 

\subsection{Heavy Mesons}


\subsection{Strange Baryons}

\subsection{2nd Generation Strange Baryons}


\subsection{3rd Generation Strange Quarks}


\section{Reactions and Isospin}

\subsection{Isospin}

\section{Color Charge}

\subsection{Mesons...in Color}

\subsubsection{Gluons}

\section{Summary Problems} 


\end{document}
Last edited by cgnieder on Sun Jan 20, 2013 6:05 pm, edited 1 time in total.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Heading Numbers overlap Heading Titles in ToC

Post by Stefan Kottwitz »

jgomez2, would you be so kind to visit the link given by mas? I mean this one: Infominimal working example, with a focus on minimal, such as

Code: Select all

\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
toc1.png (21.27 KiB) Viewed 14685 times
It's much easier to fix then. In this case, just insert this right after \tableofcontents:

Code: Select all

\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother
The problem is gone:
toc2.png
toc2.png (21.88 KiB) Viewed 14685 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.
LaTeX.org admin
jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am

Re: Heading Numbers overlap Heading Titles in ToC

Post by jgomez2 »

understood, will do better next time
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Heading Numbers overlap Heading Titles in ToC

Post by Stefan Kottwitz »

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:

    Code: Select all

    \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
LaTeX.org admin
Post Reply