[XeTeX] RTL hyperlink problems
Ron Aaron
ron at ronware.org
Wed Aug 18 22:06:02 CEST 2010
Using xetex I found that the 'hyperref' package did not product attractive links in PDF, so I had to write my own PDF link code:
\def\hr#1#2{%
\special{pdf:bann <</Subtype/Link/BS
<</Type/Border/W 0.0 /S/S>>
/A << /S/URI/URI (#1)>> >>}
\special{pdf: bc [ 0 0 1 ]}{\bgroup #2 \egroup}\special{pdf: ec}
\special{pdf:eann}}
This works fine; however, if a hyperlink is in an RTL paragraph, and the link is broken at the end of the line, then some very ugly effects show up: the entire line on which the link started, as well as the entire line on which it ends, show up as a hyperlink.
Up until now, I've ignored this issue and simply put the link text (the #2 in my macro) inside an \hbox. For some reason, this keeps things from escaping and all is well -- but if the link text is a little long, it won't get broken, and this leads to ugly breaks.
I've tried using various "specials" to encapsulate the link and keep it from overflowing -- but to no avail. It seemed time to ask here if anyone else has a similar issue -- and if so, if they know of a solution.
Here is a full example demonstrating the problem:
\input eplain
\TeXXeTstate=1
\def\hr#1#2{%
\special{pdf:bann <</Subtype/Link/BS
<</Type/Border/W 0.0 /S/S>>
/A << /S/URI/URI (#1)>> >>}
\special{pdf: bc [ 0 0 1 ]}{\bgroup #2 \egroup}\special{pdf: ec}
\special{pdf:eann}}
\hsize=0.25\hsize
This is an example bit of text. Here is
\hr{mailto:ron at ronware.org}{my email address} if you care to send me a note or
two.
Now for RTL:
\beginR This is an example bit of text. Here is
\hr{mailto:ron at ronware.org}{my email address} if you care to send me a note or
two.
\endR
\vfill\eject\bye
More information about the XeTeX
mailing list