[Tex/LaTex] hyperref package, breaklinks option

hyperrefline-breakinglinks

When I compile with LaTeX + dvips, I get the following warning message:

Package hyperref Warning: You have enabled option `breaklinks'.  
(hyperref)                But driver `hdvips.def' does not suppport this.  
(hyperref)                Expect trouble with the link areas of broken links.  

Right now, I am using the report document class and call the hyperref package with the following commands (I am using MikTeX 2.9 and WinEdt 7.0 on Windows 7)

\usepackage[breaklinks]{hyperref}  
\usepackage[hyphenbreaks]{breakurl}

The document compiles (using LaTeX+dvips) and the links spanning two lines appear to break correctly, but I receive the warning message. Is this a problem? How can I fix it? I tried to add the following package and compile using pdflatex (instead of LaTeX + dvips)

 \usepackage[pdf]{pstricks} 

but it produced the following warning message:

 >>> Loading package auto-pst-pdf <<<  

 Package pstricks Warning: ************************************ 
 (pstricks)                Option pdf needs a "pdflatex -shell-escape <file>" 
 (pstricks)                or a "pdflatex -enable-write18 <file>" 
 (pstricks)                (if you are using MikTeX) 
 (pstricks)                ************************************.  

I also get the following error, which prevented me from being able to compile with pdflatex:

 Package ifplatform Warning: 
     shell escape is disabled, so I can only detect \ifwindows  

 ! Package auto-pst-pdf Error:
     "shell escape" (or "write18") is not enabled:
     auto-pst-pdf will not work!

Alternatively, I tried using the epstopdf package (and compiled with pdflatex), but that package is not compatible with the psfrag package. I am looking for a way to fix the breaklinks warning message (see above), without losing the ability to use eps figures and the psfrag package.

Best Answer

As you load the breakurl package you can safely ignore the warning message issued by the hyperref package. It’s the dedicated purpose of the breakurl package to enable breakable URL links in case of the traditional DVI→PS→PDF document generation path supported by the hdvips output driver. If you want to get rid of the redundant hyperref warning message omit the breaklinks option, i.e.,

\usepackage{hyperref}
\usepackage[hyphenbreaks]{breakurl}

or use the silence package:

\usepackage{silence}

\WarningFilter{hyperref}{You have enabled option `breaklinks'.}

\usepackage[breaklinks]{hyperref}
\usepackage[hyphenbreaks]{breakurl}

If you choose to switch from the DVI mode to the PDF mode of pdfTeX there will be no hyperref warning message and you won’t need the breakurl package since the hpdftex output driver is capable of breaking URL links itself. In this case, however, you additionally have to load a support package such as the pstool package facilitating the usage of psfrag features in the PDF mode of pdfTeX. Moreover, you probably have to enable the \write18{...} construct, e.g. by passing the appropriate command-line option (-shell-escape in TeX Live/Linux) to the pdflatex program. A little example (You need an EPS file pi.eps containing the tag pi):

%% LaTeX master file test.tex: Process with pdflatex -shell-escape test.tex.

\documentclass{article}

\usepackage{pstool}

\usepackage{hyperref}

\begin{document}

\begin{figure}
  \centering
  %% Include pi.eps and replace the tag ‘pi’ with π.
  \pstool{pi}{\psfrag{pi}{\(\pi\)}}
\end{figure}

\noindent
\parbox{3cm}{\raggedright\url{http://tex.stackexchange.com}}

\end{document}
Related Question