[XeTeX] RTL hyperlink problems

Ron Aaron ron at ronware.org
Fri Aug 20 15:51:45 CEST 2010


On Friday 20 August 2010 16:15:22 Khaled Hosny wrote:
> On Fri, Aug 20, 2010 at 03:11:15PM +0200, Ulrike Fischer wrote:
> > Am Fri, 20 Aug 2010 13:57:46 +0300 schrieb Ron Aaron:
> > > Yes, well that is exactly the problem I am trying to find a way to
> > > work-around! 
> > 
> > I did understand this ;-). But if the author of bidi didn't find a
> > solution to the problem  perhaps there isn't one. 
> 
> Right, IIRC, that was the conclusion we reached while ago, it can't but
> be fixed in the engine itself.

Hmm.  Well, I've almost got what I want by modifying my \hr macro like so:

\def\hr#1#2{%
\ifrtl\endR\fi
\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}
\ifrtl\beginR\fi}


Note the '\ifrtl', which is a new conditional which must be set to indicate LTR vs RTL.  So I stop the RTL before doing the special, and resume it when I'm done with the specials.  That works /almost/ as I want. 

The remaining problem is that the link text (#2 in the macro) is reversed, e.g. LTR.  Do you know of a TeX way to reverse the characters?   I could shell out to 'rev', but that would be a pretty severe hit since I have a lot of links in my document.  I suppose I could also just reverse the text in the document so it shows in the correct direction, but that's not likely to be easy to remember to do.

Unlike in Arabic,  Hebrew has no connecting forms to worrry about -- so simply printing the 'link text' should look ok (that text also has no vowel points to complicate matters).

Best regards,
Ron

-- 
Sending me something private?
Use my GPG public key: AD29415D


More information about the XeTeX mailing list