John Was john.was at ntlworld.com
Fri Aug 20 17:20:42 CEST 2010

Hi

I'm not sure what reversing you get (the whole link? individual letters?),
but in case it helps here is some antediluvian code that I used to use many
years ago to get occasional Hebrew words in ordinary EmTeX.  You would want
to put the back-to-front text in the \reversedtext macro at the end of the
code; and you would need to have \input pstricks somewhere in the header to
your file.  (Note that 'gobbledtext' in the follwowing just gets swallowed
up - I've forgotten the ins and outs of this and think the code is a bit of
trickery derived from something Jonathan Fine produced, either publicly or
in a message to me.)

\def\processlist#1%
{%
\ifx #1\ \ \else
\ifx #1\sentinel \expandafter \sentinel \noexpand
\else
%\processitem
\flip #1\fi\fi
\processlist
}
\def \sentinel {\gobble\sentinel}
\def \gobble #1 {}
%where \processitem is up to you.
%Use as \processlistabcdefghij\sentinel
\def\flip#1{\psscalebox{-1 1}{#1\vrule height 0.8\baselineskip depth
0.2\baselineskip width0pt}}
\def\flipletter#1{\ifreverse \scalebox{-1 1}{#1}\else\relax\fi}
\def\reversedtext#1{\processlist #1\sentinel gobbledtext \hskip 0pt\ }

Example of usage:

Some stuff \reversedtext{turnitround}and some more stuff.

Note that the space following the reversed material is part of the
\reversedtext macro so that after the closing } you *don't* put in a space
(otherwise you'll get a double space in the output) - it seems quite hard to
insert a space if you don't incorporate it in the macro, but as I say I've
forgotten all the details.  If you need spaces within the argument (I think
not?) they would have to be given explicitly with \

If you want an entire block reversed (not each letter one by one), just give
\input pstricks and then

\psscalebox{-1 1}{text to be reversed}

Hope this helps!

John

----- Original Message -----
From: "Ron Aaron" <ron at ronware.org>
To: <xetex at tug.org>
Cc: <news3 at nililand.de>
Sent: 20 August 2010 14:51
Subject: Re: [XeTeX] RTL hyperlink problems

> 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
> <</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
>
>
> --------------------------------------------------
> Subscriptions, Archive, and List information, etc.:
>  http://tug.org/mailman/listinfo/xetex