LaTeX forum ⇒ Document ClassesToC garbled in revtex4-1. What the Hell !? Topic is solved

Information and discussion about specific document classes and how to create your own document classes.
User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

ToC garbled in revtex4-1. What the Hell !?

Postby Cham » Thu Nov 30, 2017 12:36 am

What is happening with this simple code ? The preview output is nice, but the ToC is garbled once exported as a PDF document! :o

  1. \RequirePackage[l2tabu,orthodox]{nag}
  2. \documentclass[11pt]{revtex4-1}
  3.  
  4. \begin{document}
  5.  
  6. \title{Big Title}
  7. \author{Isaac Newton}
  8. \email[email: ]{isaac.newton@somewhere.net}
  9. \affiliation{Somewhere}
  10.  
  11. \begin{abstract}
  12. Text.
  13. \end{abstract}
  14.  
  15. \maketitle
  16. \tableofcontents
  17.  
  18. \section{Introduction}
  19.  
  20. Text.
  21.  
  22. \section{Title}
  23.  
  24. Text.
  25.  
  26. \section{Title}
  27.  
  28. Text.
  29.  
  30. \subsection{Title}
  31.  
  32. Text.
  33.  
  34. \subsubsection{Title}
  35.  
  36. Text.
  37.  
  38. \subsubsection{Title}
  39.  
  40. Text.
  41.  
  42. \section*{Thanks}
  43.  
  44. Text.
  45.  
  46. \begin{thebibliography}{999}
  47.  
  48. \bibitem{bibitem1}
  49. R.~Bob \& P.~Peter, \textit{Title}, Found.\ Phys.\ \textbf{47}, no. 6, 797 (2017).
  50. \bibitem{bibitem2}
  51. F.~Charles \& R.~Alice, \textit{Title}, Phys.\ Rev.\ D \textbf{65}, 103522 (2002).
  52.  
  53. \end{thebibliography}
  54.  
  55. \end{document}


What is wrong here ? I know that the revtex4-1 class have some problems with customization, but why this crap with a minimal code ?

Preview :
garbledToC.jpg
garbledToC.jpg (14.22 KiB) Viewed 155 times

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Thu Nov 30, 2017 8:15 am

Please click on Open in Overleaf just above the code you posted.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Thu Nov 30, 2017 2:52 pm

Johannes, I don't understand what you want to show. As I said, the preview is fine, but the compiled PDF file isn't. The OverLeaf feature is broken on my old browser since about a year now. It no longer works after some change has been made on this site.

EDIT : I just noticed these warnings in the console (this comes from the simple MWE code I posted above) :

Package nag Warning: Command \it is an old LaTeX 2.09 command.
(nag) Use \itshape or \textit instead on input line 18.

[1{/usr/local/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./TSWLatexianTemp_000002.toc
Overfull \hbox (6.49583pt too wide) detected at line 6
\OT1/cmr/m/n/10.95 I.

Overfull \hbox (0.475pt too wide) detected at line 6
\OT1/cmr/m/n/10.95 2

...

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

Postby Stefan Kottwitz » Thu Nov 30, 2017 5:17 pm

Hi Cham,

you have to compile several (three) times, without deleting .toc or .aux file. At the first time, the toc is created. In the second run, the toc is displayed, but not yet all spaces for numbers reserved since they are now calculated and written to .toc or .aux, at the third time all is printed with correct placement and spacing. At least this is what I guess from looking at revtex4-1, some auto-adjusting table of contents packages do the same.

Stefan
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Thu Nov 30, 2017 9:31 pm

Stefan, apparently, you are right ! My preview was typesetting three times, while my export was doing it 2 times only. Changing this solves the issue, but I've done it on another computer (I'm at work right now). I'll confirm this later when I'll be on my main home computer.

But it's weird that I need 3 passes for a revtex4-1 file (without any index), while 2 passes is usually enough for all my other normal documents (book, article, etc, with a ToC but without index). Is this a "normal" non-standard behavior for the revtex4 class ?

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

Postby Stefan Kottwitz » Thu Nov 30, 2017 9:58 pm

Yes, but it's automatically adjusting the width instead of using fixed widths like base classes. With the latter, one can easily run into overlapping numbers when they are too hight, so too wide, such as with Roman numbers.

Stefan
Site admin

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Thu Nov 30, 2017 10:04 pm

Ahaa ! You see? I'm again learning new LaTeX things while just experimenting with the revtex4 class! (even if I already said in another topic that I'll abandon that class) :)

So the space between numbers and their section title in the ToC is a constant for most classes, while it's a variable that need 3 passes to be defined in revtex4?

Thanks for the interesting explanation !

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Fri Dec 01, 2017 1:31 am

Yep, I confirm that the revtex4-1 ToC need 3 passes. It's even actually a +1 point for that class, since it knows how to calculate the proper space in the ToC. I had a space problem with the book class before (space too small for some large section numbers, in a huge book), so I had to hack the ToC using some package.

Now I'm having a last problem with the revtex4-1 class : its ToC title "Contents" isn't translated in French, while the rest appears to be. Why ? How to make the ToC properly saying "Table des matières" (or something similar in French) ?
Last edited by Cham on Fri Dec 01, 2017 2:38 am, edited 1 time in total.

User avatar
Cham
Posts: 813
Joined: Sat Apr 02, 2011 4:06 pm

Postby Cham » Fri Dec 01, 2017 2:16 am

Apparently, I have to add the following command to translate "Contents" :

  1. \def\tocname{Table des matières}


I'm wondering if this is an "hack", or if there's something else to do the translation more "naturally". Any idea on this ?

User avatar
Johannes_B
Site Moderator
Posts: 3584
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Dec 01, 2017 7:43 am

Not a hack. Since that class has a very limited purpose, it is fixed. If you want to make a customiation, you need to whack it with a hammer. In this case, it is \defing the tocname.

By the way, you should check out latexmk. Great tool.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.


Return to “Document Classes”

Who is online

Users browsing this forum: No registered users and 8 guests