[luatex] About \mathdir and \pardir

Taco Hoekwater taco at elvenkind.com
Thu Apr 1 16:02:50 CEST 2010

Vafa Khalighi wrote:
> $$1+2=3$$

Definitions like those expands roughly into

<starthmode (fixing \pardir for this par)>
<set \pardir>
   < set \mathdir>
   </stopmathmode (restoring \mathdir)>
   <mlist processing using current (outer)\mathdir>
<stophmode (restoring \pardir)>
<parbreaking using outer \pardir>

In both cases (\everypar and \everydisplay) the dir assignment
is ignored: the relevant direction from the outer level is the
one used (but for two different reasons).

I expect you can get around the \everydisplay by using

\def\mathsdir{\@EA\global\if at RTLmaths\mathdir TRT\else\mathdir TLT\fi}

but have not actually tried, I am keying this in from memory.

> I think this behaviour is not correct. LuaTeX's direction primitives should
> be accessible through \everypar, \everymath and \everydisplay primitives.

You may well be right, but that is backward incompatible so it needs
consensus among the mixed typesetting users and even then a very
explicit announcement (implementation could turn out to be non-trivial
as well, but is definitely doable). So I would ask users that have an
interest in mixed direction typesetting to think about this thoroughly
and voice their opinion.

Best wishes,

More information about the luatex mailing list