# [luatex] \enddir

Joseph Wright joseph.wright at morningstar2.co.uk
Thu Dec 13 11:54:41 CET 2012

On 13/12/2012 10:11, Taco Hoekwater wrote:
> Normally, the code that exports the box to PDF/DVI takes care of
> closing up the open direction nodes based on the box's 'box direction'.
> But if there is a group involved, then the box does not give enough
> hints, hence the explicit \enddir in that case.
>
> The missing \enddir is a number-of-nodes optimization from Omega that
> Hans is not too happy about as it is both confusing and makes it a
> little hard to process the node list directions in lua, so it will
> likely go away at some point, and explicit \enddirs will be present
> always at some point in the future.

OK, all makes sense.

>> For testing, I tried
>>
>>    \hbox{\textdir TRT ABC\textdir TLT D}
>>
>> which gives the slightly odd
>>
>>    ..\hbox(6.83331+0.0)x29.4445, direction TLT
>>    ...\begindir TRT
>>    ...\tenrm A
>>    ...\tenrm B
>>    ...\tenrm C
>>    ...\begindir TRT
>>    ...\begindir TLT
>>    ...\tenrm D
>>    ..\glue 0.0 plus 1.0fill
>>
>> (Can't imagine this is deliberate.)
>
> Code copied from Omega, and there were no comments in that code
> anywhere, so I just kept it as is originally. But it does look
> weird, so I made a local change to produce \enddir TRT instead
> of the second \begindir TRT. For this source:
>
>   (\hbox{\textdir TRT ABC\textdir TLT DEF})
>
> The change actually changed the output PDF from (old):
>
>   (DEFCBA)
>
> to (new)
>
>
> which to my layman's eyes appears to make more sense (the second
> \textdir now actually replaces the first, instead of starting an
> implied direction group).
>
> But then, I find the direction stuff utterly confusing, so before I
> commit the change, I would really like a second opinion.

Totally agree: I've no idea either what is 'correct'. Frank asked John
Plaice if he could enlighten us (LaTeX team) on the Omega approach. I've
CC'd him on this reply: perhaps he has more insight.
--
Joseph Wright