LaTeX users online

In total there are 4 users online :: 0 registered, 0 hidden and 4 guests (based on users active over the past 5 minutes)
Most users ever online was 1327 on Tue Nov 05, 2013 7:11 pm

Users browsing this forum: No registered users and 4 guests

Heading Numbers overlap Heading Titles in ToC Topic is solved

LaTeX Forum: Page Layout

spacingtable-of-contentsAdd tags Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).

Postby jgomez2 on Sun Jan 20th, 2013

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 3872 times
Last edited by localghost on Sun Jan 20th, 2013, edited 1 time in total.
Reason: Image cut to the relevant content.
jgomez2
 
Posts: 6
Joined: Sat Jan 5th, 2013

Postby mas on Sun Jan 20th, 2013

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 2014; Editor : Vim
mas
 
Posts: 186
Joined: Thu Dec 4th, 2008

Postby jgomez2 on Sun Jan 20th, 2013

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

Postby mas on Sun Jan 20th, 2013

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  •  Open in online LaTeX editor
\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 2014; Editor : Vim
mas
 
Posts: 186
Joined: Thu Dec 4th, 2008

Postby jgomez2 on Sun Jan 20th, 2013

Code: Select all  •  Open in online LaTeX editor
%\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 20th, 2013, edited 1 time in total.
Reason: added code markup
jgomez2
 
Posts: 6
Joined: Sat Jan 5th, 2013

Postby Stefan_K on Sun Jan 20th, 2013

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  •  Open in online LaTeX editor
\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 3861 times


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

Code: Select all  •  Open in online LaTeX editor
\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother


The problem is gone:

toc2.png
toc2.png (21.88 KiB) Viewed 3861 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_K on Sun Jan 20th, 2013, edited 1 time in total.
Reason: MWE explanation shortened
LaTeX Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 7439
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany

Postby jgomez2 on Sun Jan 20th, 2013

understood, will do better next time
jgomez2
 
Posts: 6
Joined: Sat Jan 5th, 2013

Postby Stefan_K on Sun Jan 20th, 2013

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  •  Open in online LaTeX editor
    \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 Community Administrator
User avatar
Stefan_K
Site Admin
 
Posts: 7439
Joined: Mon Mar 10th, 2008
Location: Hamburg, Germany


Topic Tags

spacingtable-of-contents

Return to Page Layout

LaTeX users online

Users browsing this forum: No registered users and 4 guests