I am experiencing the hyperref split-link issue described in previous questions. I tried to update the hyperref package as recommended as well as the oberdiek package which also seems to have some hyperref-related files.
My hyperref.sty
is now at v6.83m, hobsub-hyperref.sty
at v1.13. The MWE in @Michael's question compiles without problems, but my document still generates the same error. My documentclass is elsarticle
(version 1.2.0).
The following suffices to produce the problem:
\documentclass[5p]{elsarticle}
\usepackage{kantlipsum}
\usepackage{hyperref}
\begin{document}
\begin{frontmatter}
\end{frontmatter}
\kant*[1-4]
\kant[5]
\href{http://tex.stackexchange.com}{This is a very very
very very very very very very very very very very very very very
very very very very very very very very long link.}
\end{document}
Both the 5p
option and frontmatter
seem to be required, though the latter may be empty.
Best Answer
The MWE is a good starting point. From there I could simplify it further.
frontmatter
sets the title in the optional argument of\twocolumn
. Thus\twocolumn[]
is sufficient. The text can be replaced by vertical spaces. The class can be replaced by the standardarticle
class.MWE:
If
\twocolumn
is called with the optional argument, then macro\@topnewpage
is called, which puts the stuff of the optional argument in a double column float object for the top of the page. Thus also the following triggers the problem instead of\twocolumn[]
:At some later time in the output routine, macro
\@combinedblfloats
combines the top double float object with the normal page contents:As can be seen,
\@outputbox
is boxed again in an additional\vbox
. Thus the box level of the first part of the link is higher by one in comparison to the second page without the double float object.The following workaround increases the boxing level except for the first page:
The workaround also works with the original MWE of the question. In real documents, it is not trivial to know, which pages would need how many additional box levels.
A manual way would be using the following snippet, the first two lines quite early, even before
\documentclass
, the remaining part should be executed late, here via\AtBeginDocument
.Then the box listings of the output pages can be analyzed to identify the start part of the link and the end part on the next page. Then the number of dots at the line starts need to be compared.
The next example tries a more automatic solution:
Maybe this issue could also be fixed by replacing
\box\@outputbox
by\unvbox\@outputbox
in macro\@combinedblfloats
(maybe the vertical glue assignments might change):