1

Some of titles are too long, and when I make the table of contents by adding the \usepackage{hyperref}, one line is not enough for them. When I add the \usepackage{hyperref}, the titles are out of the margin for page. If I remove this package, the title is ok for me (because it can automatically divide into two lines).

How can this problem be solved?

I prefer to have the full title in several lines in the table of contents under the \usepackage{hyperref}.

The following is my code about this question.

\documentclass[12pt]{report}
\usepackage[utf8]{inputenc}
\usepackage{CJKutf8}
\usepackage{graphicx} 
\usepackage{indentfirst}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
filecolor=magenta,
urlcolor=cyan,
}
\begin{document}
\maketitle
\tableofcontents
\chapter{chapter 1}

\section{section 1 section 1 section 1 section 1 section 1 section 1}

\section{section 2 section 2 section 2 section 2 section 2 section 2 section     2 section 2 section 2 section 2 section 2 section 2}

\end{document} 

enter image description here

If I want the section 2 to divide into several lines with hyperref (that is the link can break into several lines) how can I do?

2
  • 2
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – LaRiFaRi
    Commented Apr 30, 2015 at 8:39
  • i think that something like breaklinks is called for here. should be in the documentation for hyperref. Commented May 4, 2015 at 20:51

1 Answer 1

1

Some drivers do not support links, which are broken across lines. Option breaklinks helps for a print version. The disadvantage is that it cannot enable broken link support magically. Therefore the link areas are quite wrong. For the table of contents the problem can be easily solved by using option linktocpage, which makes the page numbers instead of the section titles to links.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .