GeneralLong lines do not wrap around in Table of contents

LaTeX specific issues not fitting into one of the other forums of this category.
otnemem
Posts: 9
Joined: Mon May 05, 2008 11:29 pm

Re: Long lines do not wrap around in Table of contents

Post by otnemem »

yes actually! the content line just doesn't wrap and keeps going. If it's of any help i use Miktex 2.7

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Re: Long lines do not wrap around in Table of contents

Post by Stefan Kottwitz »

We get different results with the same code, seems like there's a problem with your LaTeX installation. Could you post your logfile of this code example above as attachment here? Perhaps I will get an idea by reading through it.

Stefan
LaTeX.org admin
otnemem
Posts: 9
Joined: Mon May 05, 2008 11:29 pm

Re: Long lines do not wrap around in Table of contents

Post by otnemem »

there you go...thanks so much for the help i really appreciate!
Attachments
Main.log
(15.87 KiB) Downloaded 332 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Long lines do not wrap around in Table of contents

Post by Stefan Kottwitz »

Hi otnemem,

your logfile shows that your document is loading hyperref. How can this happen? I did not see it in your example. If you find that, follow the message of gmedina above, he already recommended the breaklinks=true option for hyperref.
Or compile directly to pdf, not to dvi.

Stefan
LaTeX.org admin
otnemem
Posts: 9
Joined: Mon May 05, 2008 11:29 pm

Re: Long lines do not wrap around in Table of contents

Post by otnemem »

Hi stefan...that's strange. i've no idea why hyperref is loading as I never actually used that command. However i tried compiling to pdf directly and it seems to work now! again...thanks for your help.
bjorn
Posts: 4
Joined: Tue Oct 06, 2009 3:21 pm

Long lines do not wrap around in Table of contents

Post by bjorn »

Hi,

After installing MikTex 2.7 I got the same text wrapping problem in the TOC. The solutions presented here (\usepackage[breaklinks=true]{hyperref}) and elsewhere (\usepackage[linktocpage]{hyperref}) have not helped me, as there appears to be a conflict between the harvard package and the hyperref package. I use LEd.

"Latex Error: Option clash for package hyperref"

Any ideas how to sort this out without abandoning the harvard package?

Best
Björn

Code: Select all

\documentclass[a4paper]{report}
\usepackage{harvard}

\usepackage[dvips]{graphicx}
\usepackage[left=3.8cm,top=3cm,bottom=3cm,right=3cm]{geometry}
\usepackage{setspace} 
\usepackage{lscape}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage{color}
\setstretch{1.5}
%\usepackage[breaklinks=true]{hyperref}
%\usepackage[linktocpage]{hyperref}

\begin{document}
\tableofcontents
\chapter{Very very long long title Very long title Very long title Very long title Very long title}
\end{document}

User avatar
Stefan Kottwitz
Site Admin
Posts: 10340
Joined: Mon Mar 10, 2008 9:44 pm

Long lines do not wrap around in Table of contents

Post by Stefan Kottwitz »

Hi Björn,

try hypdvips:

Code: Select all

\usepackage{hypdvips}
Stefan
LaTeX.org admin
bjorn
Posts: 4
Joined: Tue Oct 06, 2009 3:21 pm

Long lines do not wrap around in Table of contents

Post by bjorn »

Thanks Stefan,

I added this in the syntax given above. I now get an error message as follows:

Code: Select all

"!Undefined control sequence.
\contentsline ...#2}{#3}\else \ifcase \Hy@linktoc
                                                 \csname 1@#1\endcsname {#2...
l.1 ...y long title Very long title}{2}{chapter.1}

?"
The error disappears when the \tableofcontents is deleted.


Best
Björn
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Long lines do not wrap around in Table of contents

Post by localghost »

The harvard package loads hyperref on its own so a second try to include hyperref must result in an option clash. Thus the loading sequence has to be changed. If you face further issues, address the maintainer of harvard.

Finally some hints not related to the problem (see code below). Abandon driver options like dvips. The packages that may need them detect on their own which compiler engine is running. For coloured tables it is better to use the xcolor package with an according option. The geometry package offers some options to get the desired result much easier. You are loading the setspace package but you don't use it.

Code: Select all

\documentclass[a4paper]{report}
\usepackage[bindingoffset=8mm,includeheadfoot,margin=3cm]{geometry}
\usepackage{graphicx}
\usepackage[onehalfspacing]{setspace}
\usepackage{lscape}
\usepackage{multirow}
\usepackage{amsmath}
\usepackage{longtable}
\usepackage[table]{xcolor}
%\usepackage[breaklinks=true]{hyperref}
\usepackage[linktocpage]{hyperref}
\usepackage{harvard}
\usepackage{blindtext}

\begin{document}
  \tableofcontents

  \Blinddocument
\end{document}

Best regards and welcome to the board
Thorsten¹
bjorn
Posts: 4
Joined: Tue Oct 06, 2009 3:21 pm

Re: Long lines do not wrap around in Table of contents

Post by bjorn »

Thorsten,
Changing the loading order of hyperref and harvard solved my problem. Thanks a lot for your quick response.

Thanks also for the other tips, I'll look into those.

Best
Björn
Post Reply