# Hyperlinks in ToC

I started working with LaTeX some months ago and this forum has been very useful for me.

Now I am writing a report and I want to have the ToC, LoF and LoT with hyperlinks. So I use the package:

\usepackage[dvips,breaklinks]{hyperref}


Then I compile via \latex+dvips+ps2pdf+view pdf. When the PDF is generated the link text does not break at end line (i.e., in ToC, LoF and LoT). I also used hypdvips package but a lot of errors appear.

\usepackage{hypdvips}


Although one solution is to add linktocpage, I want to make the text active and not only the page number.

I also tried compiling via latex+dvipdfm+view pdf with the option dvipdfmx in hyperref

\usepackage[dvipdfmx]{hyperref}


This time the breaklinks problem is solved but the EPS figures are shifted.

I am using Texmaker 4.1, MiKTeX 2.9, Ghostscript 9.10 and GSview 5.0 on Windows 7.

I would appreciate any guidance.

## 3 Answers

\documentclass[a5paper,dvips]{article}
\usepackage{geometry}
\usepackage[breaklinks,colorlinks]{hyperref}
\usepackage{breakurl}
\begin{document}
\tableofcontents

\section{An extraordinary long title to show that titles are which are
linked in the toc are broken across lines}

foo \qquad
\url{An_extraordinary_long_title_to_show_that_titles_are_which_are_linked.pdf}

\end{document}


@Herbert thank you for your reply. I also tried with \usepackage{breakurl} but it did not work. Very long titles are not well linked as short titles.

\documentclass[a5paper,dvips]{article}
\usepackage{geometry}
\usepackage[breaklinks]{hyperref}
\usepackage{breakurl}
\begin{document}
\tableofcontents

\section{An extraordinary long title to show that titles are which are
linked in the toc are broken across lines}

\section{A short title}

foo \qquad
\url{An_extraordinary_long_title_to_show_that_titles_are_which_are_linked.pdf}

\end{document}


• sure. that was the reason why I used option colorlinks for hyperref. Which, by the way. looks much better than the default rectangles – user2478 Dec 3 '13 at 20:25
• Instead of “answering” your own question, you should comment on Herbert's answer or edit the original question to include the additional information. – jub0bs Dec 3 '13 at 22:45

I solved the problem using the following three packages:

\usepackage[hyperpageref]{backref}
\usepackage{hyperref}
\usepackage{hypdvips}


If you have \bibliography with BibTeX and you do not want a link page to go back from references, compile once with \latex+dvips+ps2pdf including:

\usepackage[hyperpageref]{backref}
\usepackage{hyperref}


and then compile once again but this time including \usepackage{hypdvips}