LaTeX forum ⇒ GeneralLong lines do not wrap around in Table of contents

LaTeX specific issues not fitting into one of the other forums of this category.
uetech
Posts: 4
Joined: Tue Apr 15, 2008 1:30 pm

Long lines do not wrap around in Table of contents

Postby uetech » Tue Apr 15, 2008 1:46 pm

Hi friends,

I recently started using latex and while I have faced many problems and found most of the solutions, there is still a problem I cannot fix.

The problem is with the TOC and the List of Figures. The section headings and figure captions are long and so in the TOC and the List of Figures, they should wrap around. Instead, latex displays them on a single line. Pls see figure below:

Image

The code I am using is the following. Many thanks for any kind of help or pointers.

  1. \documentclass[11pt,a4paper]{diss}
  2. \usepackage{a4,epsfig,exscale,longtable,amsfonts,amsmath,fancyhdr,makeidx,bibunits,hyperref,paralist,tocbibind,subfigure}
  3. \usepackage[dvips]{color}
  4. \usepackage{pifont} % Customizing the itemize list environment
  5.  
  6. \setlength{\textwidth}{125.0mm} \setlength{\textheight}{195.0mm}
  7. \setlength{\oddsidemargin}{10.0mm}
  8. \setlength{\topmargin}{0.0mm} % <----- book format
  9. \setlength{\baselineskip}{3.75mm} \setlength{\parindent}{5.00mm}
  10.  
  11. \pagestyle{fancy}
  12.  
  13. \newfont{\bookfont}{cmbx12 scaled 2500} % <--------- defining a new font --> \newfont{\bname}{filename scaled scalingfactor*1000}
  14.  
  15. \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
  16. \renewcommand{\sectionmark}[1]{\markright{\thesection\ #1}}
  17. \fancyhf{} % delete current setting for header and footer
  18. \fancyhead[LE,RO]{\bfseries\thepage}
  19. \fancyhead[LO]{\bfseries\rightmark}
  20. \fancyhead[RE]{\bfseries\leftmark}
  21. \renewcommand{\headrulewidth}{0.5pt}
  22. \renewcommand{\footrulewidth}{0pt}
  23. \addtolength{\headheight}{0.5pt} % make space for the rule
  24. \fancypagestyle{plain}{%
  25. \fancyhead{} % get rid of headers on plain pages
  26. \renewcommand{\headrulewidth}{0pt} % and the line
  27. }
  28.  
  29. \begin{document}
  30.  
  31. \parindent 0pt
  32. \frontmatter
  33.  
  34. \tableofcontents
  35. \pagestyle{empty}
  36.  
  37. \mainmatter
  38. \pagestyle{fancy}
  39. \addtolength{\parskip}{+0.2cm}
  40.  
  41. \include{mychapter}
  42.  
  43. \backmatter
  44. \addtolength{\parskip}{-0.2cm}
  45. \fontsize{10pt}{12pt} %bibliography font size = 10pt
  46.  
  47. \selectfont
  48. \listoffigures
  49.  
  50. \bibliographystyle{dissbib}
  51. \bibliography{models}
  52.  
  53. \vspace{12pt}
  54. \end{document}

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

Postby Stefan Kottwitz » Tue Apr 15, 2008 2:44 pm

Hi uetech,

could you please post your diss.cls as attachment? Without it I cannot compile your document to reproduce the problem. It's probably not a standard class.
Your code is not a minimal working example. One may get an impression by reading it and may try to type some additional code to get it compiled and showing the problem, but if you provided a compilable example showing some not-wrapping lines, one could easier give specific help.

Stefan

uetech
Posts: 4
Joined: Tue Apr 15, 2008 1:30 pm

Postby uetech » Tue Apr 15, 2008 3:08 pm

Hi Stefan_K,

I thank you for your efforts.
I have attached the diss.cls file as well as "mychapter.tex" file. Now the code given in my first post should compile.

Best Regards
Attachments
mychapter.tex
(2.13 KiB) Downloaded 198 times
diss.cls
Custom class file
(26.19 KiB) Downloaded 210 times

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm
Location: Colombia

Postby gmedina » Tue Apr 15, 2008 3:17 pm

I would suggest you to use the hyperref package with the breaklinks option activated; in your preamble, delete hyperref from this list of packages
  1. \usepackage{a4,epsfig,exscale,longtable,amsfonts,amsmath,fancyhdr,makeidx,bibunits,hyperref,paralist,tocbibind,subfigure}

and add this line after loading all the other packages:
  1. \usepackage[breaklinks=true]{hyperref}

By the way, you are using problematic and/or obsolete packages such as a4, epsfig,subfigure. The l2tabu document addresses this issue.
1,1,2,3,5,8,13,21,34,55,89,144,233,...

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

Postby Stefan Kottwitz » Tue Apr 15, 2008 3:35 pm

Hi uetech,

I agree with gmedina.
With your attachments I was able to compile (just without makeidx, even added subsections for testing), and the result looks like this:

Image

Probably you should consider updating your used packages.

Stefan

uetech
Posts: 4
Joined: Tue Apr 15, 2008 1:30 pm

Postby uetech » Tue Apr 15, 2008 4:39 pm

Thanks a lot gmedina and Stefan. The solution works perfectly.

Also thankyou for the information on packages. Actually the template I am using is supplied by my institute, is a very old one and needs to be updated. I will update it soon.

Best Regards

otnemem
Posts: 9
Joined: Mon May 05, 2008 11:29 pm

Postby otnemem » Mon May 05, 2008 11:34 pm

Hi all!

I was going through this post as i have the same problem. Unfortunately this remedy is not working for me. I would be really grateful if someone could give me a hand with this.

The main document is as follows:

  1. \documentclass [a4paper,12pt,oneside]{book}
  2.  
  3. \usepackage{float}
  4. \usepackage{harvard}
  5. \usepackage{graphicx}
  6. \usepackage[bottom]{footmisc} %package used to place footnotes at bottom of page
  7. \usepackage[hang,scriptsize,bf]{caption}
  8. \usepackage{multirow}
  9. \usepackage{eurofont}
  10.  
  11. \renewcommand{\baselinestretch} {1.6} \normalsize
  12.  
  13. \setlength{\oddsidemargin}{0.5in}
  14. \setlength{\evensidemargin}{0.0in}
  15. \setlength{\topmargin}{0.0in}
  16. \setlength{\footskip}{0.4in}
  17. \setlength{\headsep}{0.3in}
  18. \setlength{\headheight}{0.0in}
  19. \setlength{\textwidth}{5.6in}
  20. \setlength{\textheight}{9.3in}
  21.  
  22. \begin{document}
  23.  
  24. \include{preamble}
  25.  
  26. \pagenumbering{roman}
  27. \thispagestyle{empty}
  28. \tableofcontents
  29. \thispagestyle{empty}
  30. \listoffigures
  31. \thispagestyle{empty}
  32. \listoftables
  33. \thispagestyle{empty}
  34.  
  35. \pagebreak
  36. \include{Abbreviations}
  37.  
  38. \setlength{\oddsidemargin}{20mm}
  39. \setlength{\evensidemargin}{40mm}
  40. \setlength{\topmargin}{0mm}
  41. \setlength{\footskip}{0.4in}
  42. \setlength{\headsep}{0.3in}
  43. \setlength{\headheight}{0.0in}
  44. \setlength{\textheight}{8.5in}
  45.  
  46. \pagenumbering{arabic}
  47. \include{Introduction}
  48. \include{Literature}
  49. \include{Methodology}
  50. \include{Analysis}
  51. \include{Conclusions}
  52. \include{Recommendations}
  53. \include{Reflections}
  54. \appendix
  55. \include{appendixa}
  56. \include{appendixb}
  57. \include{appendixc}
  58. \include{appendixd}
  59.  
  60. \setlength{\oddsidemargin}{0.5in}
  61. \setlength{\evensidemargin}{0.0in}
  62. \setlength{\topmargin}{0.0in}
  63. \setlength{\footskip}{0.4in}
  64. \setlength{\headsep}{0.3in}
  65. \setlength{\headheight}{0.0in}
  66. \setlength{\textwidth}{5.6in}
  67. \setlength{\textheight}{9.3in}
  68.  
  69. \nocite{*}
  70.  
  71. \addcontentsline{toc}{chapter}{References}
  72. \bibliography{References}
  73. \bibliographystyle{agsm}
  74. \thispagestyle{empty}
  75.  
  76. \end{document}



Thanks again in advance for all!

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

Postby Stefan Kottwitz » Mon May 05, 2008 11:46 pm

Hi otnemem,

welcome to the LateX Community board!
I cannot compile your main document because I don't have the files that you are including. If I compile it without those files I cannot see the unwanted behaviour. Perhaps you could insert some lines (\chapter, \section ?) so that we can see what's meant. A minimal working example should be compilable and showing the problem. See here for more information. Usually compilable code quickly leads to a solution.

Stefan
Site admin

otnemem
Posts: 9
Joined: Mon May 05, 2008 11:29 pm

Postby otnemem » Thu May 08, 2008 11:03 pm

Hi there! thank for your reply... :)

I am taking off all the related files and just created a toc entry that is long enough not to wrap properly. The code is this...hope it's more indicative:

  1. \documentclass [a4paper,12pt,oneside]{book}
  2.  
  3. \usepackage{float}
  4. \usepackage{harvard}
  5. \usepackage{graphicx}
  6. \usepackage[bottom]{footmisc} %package used to place footnotes at bottom of page
  7. \usepackage[hang,scriptsize,bf]{caption}
  8. \usepackage{multirow}
  9. \usepackage{eurofont}
  10.  
  11. \renewcommand{\baselinestretch} {1.6} \normalsize
  12.  
  13. \setlength{\oddsidemargin}{0.5in}
  14. \setlength{\evensidemargin}{0.0in}
  15. \setlength{\topmargin}{0.0in}
  16. \setlength{\footskip}{0.4in}
  17. \setlength{\headsep}{0.3in}
  18. \setlength{\headheight}{0.0in}
  19. \setlength{\textwidth}{5.6in}
  20. \setlength{\textheight}{9.3in}
  21.  
  22. \begin{document}
  23.  
  24. \pagenumbering{roman}
  25. \thispagestyle{empty}
  26. \tableofcontents
  27. \setlength{\oddsidemargin}{20mm}
  28. \setlength{\evensidemargin}{40mm}
  29. \setlength{\topmargin}{0mm}
  30. \setlength{\footskip}{0.4in}
  31. \setlength{\headsep}{0.3in}
  32. \setlength{\headheight}{0.0in}
  33. \setlength{\textheight}{8.5in}
  34.  
  35. \section{The relationship between economic instruments and road transport policies}
  36.  
  37. \setlength{\oddsidemargin}{0.5in}
  38. \setlength{\evensidemargin}{0.0in}
  39. \setlength{\topmargin}{0.0in}
  40. \setlength{\footskip}{0.4in}
  41. \setlength{\headsep}{0.3in}
  42. \setlength{\headheight}{0.0in}
  43. \setlength{\textwidth}{5.6in}
  44. \setlength{\textheight}{9.3in}
  45.  
  46. \nocite{*}
  47.  
  48. \addcontentsline{toc}{chapter}{References}
  49. \bibliography{References}
  50. \bibliographystyle{agsm}
  51. \thispagestyle{empty}
  52.  
  53. \end{document}

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

Postby Stefan Kottwitz » Fri May 09, 2008 12:20 am

Hi otnemem,

I've tested your example without changes, the output looks like this:
contents.png
contents.png (11.97 KiB) Viewed 12175 times

Do you get different wrapping?

Stefan
Site admin


Return to “General”

Who is online

Users browsing this forum: Jamesbancy, Jeffreyabubs and 7 guests