LaTeX forum ⇒ Page LayoutHeading 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

Postby jgomez2 » Sun Jan 20, 2013 1:22 am

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 4531 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.

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby mas » Sun Jan 20, 2013 4:06 am

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

Link:
BBcode:
HTML:
Hide post links
Show post links

jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am

Postby jgomez2 » Sun Jan 20, 2013 7:35 am

Does that mean you want to see my like \usepackage declarations? I would rather not post the whole TeX document on here.

Link:
BBcode:
HTML:
Hide post links
Show post links

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

Postby mas » Sun Jan 20, 2013 10:37 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
  1. \documentclass{book}
  2. \usepackage{lipsum}
  3.  
  4. \begin{document}
  5. \tableofcontents
  6.  
  7. \chapter{Introduction}
  8. \lispum[1-2]
  9.  
  10. \chapter{Hadrons}
  11. \lipsum[5-6]
  12.  
  13. \chapter{Leptons}
  14. \lipsum[50-55]
  15.  
  16. \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

Link:
BBcode:
HTML:
Hide post links
Show post links

jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am

Postby jgomez2 » Sun Jan 20, 2013 5:29 pm

  1. %\documentclass[12pt]{revtex4-1}
  2. \documentclass[showpacs,preprintnumbers,amsmath,amssymb, nofootinbib]{revtex4-1}
  3. %\usepackage{tocloft}
  4. \usepackage{color}
  5. \usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
  6. \usepackage{float}
  7. \usepackage{url}
  8. \usepackage{chngcntr}
  9. \usepackage{hyperref}
  10. \counterwithin{equation}{section}
  11. \counterwithin{figure}{section}
  12. \counterwithin{table}{section}
  13. \usepackage{amsmath}
  14. \usepackage{lineno}
  15. \usepackage{etex}
  16. \usepackage{bm}
  17. %%%%%%%%%%%FEYNMAN STUFF
  18. \usepackage{feynmp}
  19. \DeclareGraphicsRule{.1}{mps}{.1}{}
  20. %\usepackage{pst-pdf}
  21. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  22. \hypersetup{colorlinks,
  23. linkcolor=blue,
  24. filecolor=black,
  25. urlcolor=blue,
  26. citecolor=black
  27. }
  28. \usepackage{varioref}
  29. \usepackage{graphicx}
  30. \newcommand{\dirac}[1]{\vert #1 \rangle}
  31. \newcommand{\bra}[1]{\langle #1}
  32. \newcommand{\vecbf}[1]{\vec{\textbf{#1}}}
  33. \makeatletter
  34. \def\endfmffile{%
  35. \fmfcmd{\p@rcent\space the end.^^J%
  36. end.^^J%
  37. endinput;}%
  38. \if@fmfio
  39. \immediate\closeout\@outfmf
  40. \fi
  41. \ifnum\pdfshellescape=\@ne
  42. \immediate\write18{mpost \thefmffile}%
  43. \fi}
  44. \makeatother
  45. \begin{document}
  46. \begin{center}
  47. \chapter{{\Huge \textbf{CHEM 705 Section 1: Particle Physics}}}
  48. \end{center}
  49. \tableofcontents
  50. \newpage
  51. \addcontentsline{toc}{chapter}{Contents}
  52. \listoffigures
  53. \addcontentsline{toc}{chapter}{List of Figures}
  54. \listoftables
  55. \addcontentsline{toc}{chapter}{List of Tables}
  56. \linenumbers
  57.  
  58. \section{Brief Review of Necessary Quantum Mechanics}
  59.  
  60.  
  61. \subsection{Dirac Notation}
  62.  
  63.  
  64. \subsection{Quantum Mechanical Vector Projections}
  65. \subsubsection{Vector Addition}
  66.  
  67.  
  68. \subsection{Heisenberg Uncertainty Principle}
  69.  
  70.  
  71. \subsection{Feynman Diagrams}
  72.  
  73. \section{Leptons}
  74.  
  75.  
  76. \section{The Gauge Bosons}
  77.  
  78.  
  79. \subsubsection{Weak Bosonic Decays}
  80.  
  81. \section{Hadrons}
  82.  
  83. \subsection{Quarks}
  84.  
  85. \subsection{Mesons}
  86.  
  87. \subsubsection{Pion Decays}
  88.  
  89. \subsection{Baryons}
  90.  
  91.  
  92. \subsubsection{Beta Decay}
  93.  
  94. \subsubsection{The $\Delta$ Particle}
  95.  
  96. \section{Heavier Quarks}
  97.  
  98. \subsection{Heavy Mesons}
  99.  
  100.  
  101. \subsection{Strange Baryons}
  102.  
  103. \subsection{2nd Generation Strange Baryons}
  104.  
  105.  
  106. \subsection{3rd Generation Strange Quarks}
  107.  
  108.  
  109. \section{Reactions and Isospin}
  110.  
  111. \subsection{Isospin}
  112.  
  113. \section{Color Charge}
  114.  
  115. \subsection{Mesons...in Color}
  116.  
  117. \subsubsection{Gluons}
  118.  
  119. \section{Summary Problems}
  120.  
  121.  
  122. \end{document}
Last edited by cgnieder on Sun Jan 20, 2013 6:05 pm, edited 1 time in total.
Reason: added code markup

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Jan 20, 2013 6:59 pm

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

  1. \documentclass{revtex4-1}
  2. \begin{document}
  3. \tableofcontents
  4. \listoffigures
  5. \section{Brief Review of Necessary Quantum Mechanics}
  6. \subsection{Dirac Notation}
  7. \subsection{Quantum Mechanical Vector Projections}
  8. \subsubsection{Vector Addition}
  9. \subsection{Heisenberg Uncertainty Principle}
  10. \subsection{Feynman Diagrams}
  11. \end{document}


It still shows the problem:

toc1.png
toc1.png (21.27 KiB) Viewed 4520 times


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

  1. \makeatletter
  2. \let\toc@pre\relax
  3. \let\toc@post\relax
  4. \makeatother


The problem is gone:

toc2.png
toc2.png (21.88 KiB) Viewed 4520 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
Site admin

Link:
BBcode: Topic is solved[/url]" title="Click to select post's link in BBcode format" onclick="this.focus();this.select();" />
HTML: Topic is solved</a>" title="Click to select post's link in HTML format" onclick="this.focus();this.select();" />
Hide post links
Show post links

jgomez2
Posts: 6
Joined: Sat Jan 05, 2013 6:03 am

Postby jgomez2 » Sun Jan 20, 2013 7:14 pm

understood, will do better next time

Link:
BBcode:
HTML:
Hide post links
Show post links

User avatar
Stefan Kottwitz
Site Admin
Posts: 7801
Joined: Mon Mar 10, 2008 9:44 pm
Location: Hamburg, Germany
Contact:

Postby Stefan Kottwitz » Sun Jan 20, 2013 7:58 pm

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:
    1. \begin{center}
    2. \chapter{{\Huge \textbf{CHEM 705 Section 1: Particle Physics}}}
    3. \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
Site admin

Link:
BBcode:
HTML:
Hide post links
Show post links


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 2 guests