[luatex] Info on direction primitives/implementation

Khaled Hosny khaledhosny at eglug.org
Wed Dec 5 14:22:03 CET 2012

On Wed, Dec 05, 2012 at 11:40:36AM +0100, Taco Hoekwater wrote:
> On 12/05/2012 09:49 AM, Joseph Wright wrote:
> >On 04/12/2012 12:58, Taco Hoekwater wrote:
> >Secondly, I'm a bit unsure about the detail on \mathdir when it comes to
> >numerals. From what I understand, numbers read in decreasing magnitude
> >left-to-right in both LTR and RTL languages, so for example pi is always
> >
> >    3.1415...
> >
> >and never
> >
> >   ...5141.3
> >
> >even when using (real) Arabic numerals rather than the 'arabic' ones of
> >the European tradition. However, \mathdir flips everything: is that
> >correct, and if so is the expectation that numerals in math mode are
> >handled using a Lua callback?
> A total lack of feedback from an actual knowledgeable person means that
> \mathdir does exactly what Aleph did. I *also* suspect it is wrong, but
> I am not going to mess with it without a person at hand who can tell me
> exactly what *should* happen.

\mathdir is no different from \textdir in this regard, both flip
everything and with both one have to explicitly mark parts that need not
be flipped (numbers do occur in text mode, remember), but the main
problem is that \mathdir inside a formula has no effect, so in this
example the numbers inside the formula are flipped while they shouldn't
(inserting dir nodes trough a callback works, though):

\pardir TRT\textdir TRT\mathdir TRT
Some text {\textdir TLT 123} more text.
$$a+b+c = {\mathdir TLT 123}$$

Apart from that, I think \mathdir handling is OK.

Joseph, now I remember I major draw back with LaTeX2e; math mode is
abused for non-math content, which is a nightmare for people who want
RTL text mode but LTR math mode, the last version of Omega (that was not
the base for aleph because it was too buggy) even had some primitives
just to aid macro writers to mitigate this. If there is anything LaTeX3
can do here, it would be to never use math mode for anything but math.


More information about the luatex mailing list