[pdftex] Problem with nested hyperlinks in hyperref

Heiko Oberdiek oberdiek at uni-freiburg.de
Thu Feb 9 18:17:59 CET 2006

On Thu, Feb 09, 2006 at 02:56:09PM +0100, Dario Teixeira wrote:

> I have come across an interesting issue with hyperref
> and pdftex.  Whenever one hyperlink is nested inside
> another, the entire remainder of the line is shown
> as an hyperlink.
> If you are wondering why on earth would someone want
> to have nested hyperlinks, please take a look at this
> sample document I created; it also displays the "feature":
> http://www.dse.nl/~dario/misc/nestedlinks.pdf  [50KB]

It is a bug in pdfTeX:

[part before]
\pdfstartlink goto name{Hello}
[hello start
  \pdfstartlink attr{/C[1 0 0]} goto name{World}
  [inside world]%
[part after]\par

\pdfdest name{Hello}XYZ\relax
\pdfdest name{World}XYZ\relax

Three annotations are generated by pdfTeX 1.30.4:

7 0 obj <<
/Type /Annot
/Rect [148.989 757.436 540 767.399]
/Subtype /Link
/A << /S /GoTo /D (Hello) >>
>> endobj
8 0 obj <<
/Type /Annot
/C[1 0 0]
/Rect [199.439 757.436 257.361 767.399]
/Subtype /Link
/A << /S /GoTo /D (World) >>
>> endobj
9 0 obj <<
/Type /Annot
/Rect [257.361 757.436 281.769 767.399]
/Subtype /Link
/A << /S /GoTo /D (Hello) >>
>> endobj

As workaround, put the outer/enclosing annotation into a box
(\hbox in plain TeX, \mbox in LaTeX). Disadvantage is that
then the link cannot be broken across lines anymore.

I have made a bug report (479).

Yours sincerely
  Heiko <oberdiek at uni-freiburg.de>

More information about the pdftex mailing list