5

I have a problem with a too long hyperlink.

This reference is one word, but it is too long and doesn't set the text width, so some part is pushed beyond the margin:

\hyperlink{label}{IS_TOO_LONG_WORD_WITHOUT_ANY_SEPARATORS...}

How to pledge hyperlink to break on a new line (similarly as when LaTeX breaks words across lines)?

egreg
  • 1,121,712
Yulia Spryn
  • 493
  • 6
  • 13

1 Answers1

10

Hyperref driver with breaklinks support

Then TeX couldn't find break points and the question is not related to hyperref. Solution: Insert break points, e.g. \-, \discretionary, \hyphenation, \penalty, …

Hyperref driver without breaklinks support

From the README:

Wrapped/broken link support

Only few drivers support automatically wrapped/broken links, e.g. pdftex, dvipdfm, hypertex. Other drivers lack this feature, e.g. dvips, dvipsone.

Workarounds:

  • For long section or caption titles in the table of contents or list of figures/tables option linktocpage can be used. Then the page number will be a link, and the overlong section title is not forced into an one line link with overvull \hbox warning.
  • \urls are caught by package breakurl.
  • The option breaklinks is intended for internal use. But it can be used to force link wrapping, e.g. when printing a document. However, when such a document is converted to PDF and viewed with a PDF viewer, the active link area will be misplaced.

    Another limitation: some penalties are "optimized" by TeX, thus there are missing break points, especially within \url. (See thread "hyperref.sty, breaklinks and url.sty 3.2" in comp.text.tex 2005-09).

Also manual broken links are possible:

\hyperlink{label}{FIRST_PART}%
\hyperlink{label}{NEXT_PART}%
\hyperlink{label}{LAST_PART}
Heiko Oberdiek
  • 271,626