[luatex] Issue with unpaired dir node

Khaled Hosny dr.khaled.hosny at gmail.com
Sat Nov 3 14:52:24 CET 2018

On Tue, Oct 30, 2018 at 11:39:59AM +0200, Khaled Hosny wrote:
> On Mon, Oct 29, 2018 at 11:21:38PM +0200, Khaled Hosny wrote:
> > Hello all,
> > 
> > I’m working on a package that modifies the node list, and I’m working by
> > copying the node list one node at a time, doing some modifications
> > (possibly adding or dropping some of the nodes). This is working fine so
> > far, with one exception:
> > 
> > When setting an RTL paragraph like this:
> > 
> > \begingroup
> > \pardir TRT
> > \textdir TRT
> > text
> > \endgroup
> > 
> > The resulting paragraph is not right aligned after my code processes it,
> > but properly aligned otherwise. On the other hand, if I drop the
> > \{begin,end}group things are fine. Looking closely, there seem to be an
> > an +TLT dir node inserted without a closing -TLT one. If I change my
> > code to drop that node, things are fine again.
> > 
> > I’m not sure whether this unpaired +TLT node is expected or not, or what
> > is wrong with my code that is causing the misalignment. I’m attaching a
> > sample file that shows this behaviour, with some commented out code that
> > shows that removing the stray dir node fixes things.
> Here is a slightly updated example moving \pardir outside of the group,
> since the issue happens with just \textdir inside the group. Also the
> issue happens when using node.copy_list() as well, not only with manual
> iterating and copying each node.

I found a workaround, reusing the nodes instead of copying them. My
actual code is a bit more complex than the attached code (since I
sometimes need to use the same glyph node more than once and have to
copy them, but it still seems to work).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: unpaired-dir.tex
Type: application/x-tex
Size: 579 bytes
Desc: not available
URL: <https://tug.org/pipermail/luatex/attachments/20181103/9158caac/attachment.tex>

More information about the luatex mailing list