1

When writing an URL breaking on several lines, the actual link is weird (blue rectangle on the image below) and does not correspond to the sentence. How to fix it?

Example of bad contour for URL

EDIT:

Here is the code:

\documentclass{article}
\usepackage[breaklinks=true]{hyperref}

\begin{document}

The next sentence is an hyperlink on several lines:
\href{http://www.google.com/}{Click on me to go to the famous webcrawler Google}.

\end{document}

In addition, I would like to avoid colored links because the document should be read on screen as well as be printed, and I do want the link and the text to be in black. That is why I prefer the link to be in a rectangle, like in the example above.

Of course, a solution would be to cut the link:

 \href{http://www.google.com}{Click on me to go to the}%
 \href{http://www.google.com}{famous webcrawler Google}.

but I search for an elegant solution.

1
  • 5
    please show a complete small document that shows the problem, it is very hard to debug code you can not see Commented Jan 20, 2017 at 16:59

1 Answer 1

1

Forget option breaklinks. It is enabled for drivers, that support broken links anyway. Other drivers like dvips do not support this feature. The the option fixes the output for printing, but the link area is broken.

Either compile with a driver, that supports broken links (e.g., pdflatex). Or the workaround of the question with manually broken links is a good approach. Broken URLs are supported for dvips by package breakurl.

A compromise with colorlinks would be a dark blue. Then the links can be seen, but they are decent and can be printed without being too light. But also in this case, the links look correct with forced breaklinks, but the link areas remain pretty wrong for drivers without support for broken links.

1
  • Compiling withpdflatex seems a good solution, thank you. Now I have to change some things to accomodate with ps-tricks.
    – Vinz
    Commented Jan 20, 2017 at 21:57

You must log in to answer this question.

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