Text Formattinghyperref | Combination of Part and "LaTeX -> DVI -> PDF"

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

hyperref | Combination of Part and "LaTeX -> DVI -> PDF"

Post by svend_tveskaeg »

Hi all.

First of all, consider the following MWE:

Code: Select all

\documentclass{article}
\usepackage[danish]{babel}
\usepackage{pstricks-add}
\usepackage{hyperref}

\makeatletter
\def\@part[#1]#2{%
    \ifnum \c@secnumdepth >\m@ne
      \refstepcounter{part}%
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
    \else
      \addcontentsline{toc}{part}{#1}%
    \fi
    {\parindent \z@
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >\m@ne
       \Large\bfseries\hfil\partname~\thepart\hfil
       \par\nobreak
     \fi
     \huge \bfseries #2%
     \markboth{}{}\par}%
    \nobreak
    \vskip 3ex
    \@afterheading}
\makeatother

\begin{document}

\tableofcontents

\part{A very long title; longer than the width of the page, which gives me some problems}
\label{del1}

\begin{figure}[htbp]
\centering
  \begin{pspicture}(1,1)
    \psline(0,0)(1,1)
  \end{pspicture}
\end{figure}

\end{document}
Info.:
  • I have PS figures in my real document so I have one in my example as well.
  • The code part in the preamble is taken from here (which is taken from the article class).
How do I get a line break in the ToC entry for the \part if i use latex+dvipdf with the hyperref package?

If I use pdflatex there is no problems, but I cannot do that because of the PS graphics (as fare as I know); I use latex+dvipdf instead. Furthermore, there is no problem if I remove the hyperref package.

Thank you in advance!
Last edited by svend_tveskaeg on Mon Feb 06, 2012 12:59 am, edited 2 times in total.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

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

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

shadgrind
Posts: 140
Joined: Thu Jul 16, 2009 12:39 am

hyperref | Combination of Part and "LaTeX -> DVI -> PDF"

Post by shadgrind »

Use the breaklinks option when you load the hyperref package.
System: TeX Live 2012, Fedora 18 x86_64, GNU Emacs 24.2
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: hyperref | Combination of Part and "LaTeX -> DVI -> PDF"

Post by svend_tveskaeg »

Spot on. Thank you!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply