# [Tex/LaTex] thesterious error: \pdfendlink ended up in different nesting level than \pdfstartlink

errorshyperrefpdftex

I ran into the "mysterious"

\pdfendlink ended up in different nesting level than \pdfstartlink


error. According to http://www.tug.org/errors, "this happens when hyperref is used under pdftex and a citation splits across a page boundary". The given solution is to manual fix the citation to not split across the page boundary.

However, this workaround isn't feasible for me, as the documents are automatically generated on a server with no user interaction.

Is there any solution to the problem known, perhaps an experimental hyperref action or a patch to pdftex? (Probably, one could use luatex to solve the problem, but for other reasons, luatex is not an option in this project.)

MWE:

\documentclass[%draft
]{article}
\usepackage{hyperref}
\setlength{\textwidth}{3cm}
\setlength{\textheight}{3cm}

\begin{document}
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam
nonumy eirmod tempor invidunt ut labore et dolore magna
\href{http://www.tug.org/errors}{aliquyam erat, sed diam voluptua.}
\end{document}


According to Heiko Oberdiek, the bug was introduced with a change to atbegshi. With hyperref v6.82r, it should be fixed. I tested with v6.82v (which hit texlive 2012 today) and the MWE runs properly without error.