Discussion:
pdfstartlink/pdfendlink and boxing level problems
Add Reply
Ulrike Fischer
2018-11-28 11:31:25 UTC
Reply
Permalink
After some discussion in the latex team I have two questions about
\pdfstartlink/\pdfendlink in pdftex (\pdfextension startlink/endlink
in luatex) and boxing levels.

1.
Currently the commands give a fatal error if used in different
boxing levels:

x\hbox{\pdfstartlink
attr {/Border[0 0 1]}
user{
/Subtype/Link%
/A<<%
/Type/Action%
/S/URI%
/URI(blkub)%
%
} Linktext}
\pdfendlink

\bye
! pdfTeX error (ext4): \pdfendlink ended up in different nesting
level than \pdfstartlink.
! ==> Fatal error occurred, no output PDF file produced!

This doesn't happen very often in documents, but if the galley is
split and reboxed it is possible that long links end in different
levels. One example involving two column mode and top floats has
been discussed on the latex2e github:
https://github.com/latex3/latex2e/issues/94

Is the fatal error really sensible here? Couldn't the engines close
the last annotation with some more or less sensible coordinate and
continue with a warning? A pdf with a wrong link area seems better
than no pdf at all (and would release the format and packages from
the need to carefully keep track of boxing levels when splitting and
reassembling stuff).


2. The engines interrupts linking if the boxing level of
intermediate text is less than the boxing level at the start of the
link:

x\hbox{\hbox{\pdfstartlink
attr {/Border[0 0 1]}
user{
/Subtype/Link%
/A<<%
/Type/Action%
/S/URI%
/URI(blkub)%
%
} Linktext}}
not linked
\hbox{still not linked}
\hbox{\hbox{more Linktext\pdfendlink}}

\bye

This allows to some extend to exclude e.g. header and footer from
link areas. But doesn't work e.g. with fancyhdr which adds an
additional box level to the footer. xetex/xdvidfpmx has here a quite
useful special \special{pdf:nolink} which can be used to suppress
the unwanted link area:

\documentclass[a4paper]{article}
\usepackage{fancyhdr}
\pagestyle{fancy}
\cfoot{some longer text that should not be linked}
\usepackage{ifxetex}
\ifxetex
%\cfoot{\special{pdf:nolink}some longer text that should not be
linked\special{pdf:link}}
\fi
\usepackage{hyperref}

\begin{document}
\vspace*{48\baselineskip}
xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxx
\href{xxxxx}{link link link link }
\end{document}

Would it be possible to add to pdftex/luatex something similar?
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Karl Berry
2018-11-28 22:09:17 UTC
Reply
Permalink
Hi Ulrike - for pdftex: your suggestions seem reasonable to me on the
face of it, and I don't see any immediate compatibility stoppers. But
implementing them is not something I am likely to ever get around to :(,
and I doubt Thanh has time these days. Maybe you or someone else would
be motivated to write the patches (+ docs + test cases)?

For LuaTeX: if no replies are forthcoming, you might write the
dev-luatex list.

Thanks,
Karl
Ulrike Fischer
2018-11-29 13:38:13 UTC
Reply
Permalink
Post by Karl Berry
Hi Ulrike - for pdftex: your suggestions seem reasonable to me on the
face of it, and I don't see any immediate compatibility stoppers.
Ah good. So you don't see a reason for the fatal error either?
Post by Karl Berry
But implementing them is not something I am likely to ever get around to :(,
and I doubt Thanh has time these days. Maybe you or someone else would
be motivated to write the patches (+ docs + test cases)?
Well I can't, that's outside my sphere ;-) But perhaps we can find
someone.
Post by Karl Berry
For LuaTeX: if no replies are forthcoming, you might write the
dev-luatex list.
I did it, but don't know yet if it ended in the gmane nirwana (while
writing to lists where I'm already on works fine, new lists are
quite a problem, perhaps I need to get first the list in a "normal
way" before I can use gmane with it.)
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Loading...