[tex-k] Re: [pdftex] pdfeTeX: bad interaction of \pdfstartlink...\pdfendlink with \beginR...\endR

Vladimir Volovich vvv at vsu.ru
Wed Dec 29 16:58:59 CET 2004


"HH" == Hartmut Henkel writes:

 >> BTW, Hartmut seems to be close to solving that bug already.

 HH> No, definitely :-( What i can do, is to have link boxes in RL
 HH> text, even several in a line. Nodes are swapped pairwise inside
 HH> the reverse() function, as soon as an end_link appears. But it's
 HH> much more complicated:

 HH> 1. Links can be nested.

hm - i wonder how it is treated by PDF viewers? if you click on a
place which is linked from several links nested, which link is to be
followed?

 HH> Then the above approach fails, and a stack is required to
 HH> remember the right pairs for swapping.

Maybe it's possible to make it work without the need to swap, but
rather require to use \pdfendlink before the \pdfstartlink in RL text?
[currently an attempt to do that produces the "this can't happen" error]

 HH> 2. If link text is wrapped around in RL mode, the rectangles go
 HH> to the wrong side (as Hans noted). And more weirdnesses... I
 HH> anyway wonder how RL is done. I thought paragraphs would look
 HH> like:

 HH> LR LR LR...LR LR LR

 HH> RL...RL RL RL RL RL

 HH> But here it's

 HH> RL...RL RL RL RL RL

 HH> And the \parindent is always left? In short, no idea how to use
 HH> RL.

To get the "symmetric" RL layout, you can use this (taken from babel):

\TeXXeTstate=1
\newif\if at rl
\def\rl at everypar{\if at rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
\let\o at everypar=\everypar
\def\everypar#1{\o at everypar{\rl at everypar#1}}

then put \@rltrue in vertical mode to start RL typesetting.

 HH> 3. And, maybe \pdfstartthread has a similar problem.

That's quite possible. Similarly to links, maybe we can solve that if
it will be required to have the \pdfendthread before \pdfstartthread
in RL text?  (without getting an error)

if such approach will be taken, I wonder if it's possible to detect
the current text direction to take decision on the correct sequence of
\pdfstartlink...\pdfendlink (in LR text) or
\pdfendlink...\pdfstartlink (in RL text)?

Or if there's no built-in way to test the current direction, will the
trick with like:

\def\switchtoRL{\beginR\@rltrue}
\def\switchtoLR{\beginL\@rltrue}

work? i.e. if the macros will take care to set the conditional for
each usage of \beginR or \beginL, will it be reliable to test that
conditional to make decision on the order of \pdfstartlink and
\pdfendlink?

Best,
v.



More information about the tex-k mailing list