# [NTG-context] (again) bug with bidi direction and \about references

Hans Hagen pragma at wxs.nl
Wed Aug 12 23:18:15 CEST 2015

On 8/12/2015 10:19 PM, Rik Kabel wrote:
> On 2014-03-04 11:07, Khaled Hosny wrote:
>> On Mon, Mar 03, 2014 at 07:49:07PM +0100, Pablo Rodriguez wrote:
>>> Hi Hans,
>>>
>>> sorry for telling again, but I’m afraid that the following sample shows
>>> a serious buggy interaction between \setupdirections[bidi=on] and \about
>>> references.
>>>
>>> \setupdirections[bidi=on]
>> No problem with \setupdirections[bidi=on,method=two] (which I still
>> think should be the default, but Hans is not convinced).
>>
>> Regards,
>> Khaled
>
> Khaled,
>
> I too had to rely on method=two as well to get around the problem with
> references appearing at the bottom left of some pages, but this seems to
> be resolved with the recent betas and the changes Hans has made at
> Talal's urging.
>
> Perhaps you could test to see if resolves your cases.

there are three methods:

- default : based on how idris uses structured tex + mixed latin/arabic
- one : from khaled, optimized and extended a bit by me
- two : a follow up on 'one' by me (updated unicode bidi specs + more
clever fences)

'default' is more efficient and ok for most mixed cases like the ones
idris needs; i will probably leave 'one' as-is but will at some point
optimize method 'two' and probably add some options there; also, in the
case of for instance writing manuals 'default' might be a better choice

anyway, the problem with all methods (and more if it's a strict one) is
that (as with more solutions) it's hard to get around when you want
something different; also unicode bidi evolves (and actually the last
version handles some cases that were the reason for 'default' in the
first place as idris noted conceptual issues with unicode bidi at that
time) so one can wonder about compatibility issues with any such
mechanism that applies some heuristics to input instead of tagging

now, messing with the text stream is one aspect of bidi but that will
not solve layout issues and special cases like hyperlinks, margin notes,
images and such because simply reversing the par dir (or text dir) can
interfere a lot (the dir mechanism in luatex is taken from omega and was
never made for real complex mixed cases) .. many mechanisms need to be

so ... in order to get everything all right we need to test and improve
stepwise ... no other way

(i'm playing with a better handling of line number for instance, where
we have quite some interaction between paragraph properties and putting
numbers at the right spot, and that's only one thing of many ... and i
prefer to leave the luatex engine untouched ... i'm not really a user of
r2l myself so ... a slow free-time process)

Hans

-----------------------------------------------------------------