[luatex] Info on direction primitives/implementation

Taco Hoekwater taco at elvenkind.com
Wed Dec 5 11:40:36 CET 2012

On 12/05/2012 09:49 AM, Joseph Wright wrote:
> On 04/12/2012 12:58, Taco Hoekwater wrote:
>> There is (of course) much more detail than this, but that is the overview.
> Two follow-on questions :-)
> First, I see that there are five primitives doing the work here:
> \textdir, \mathdir, \pardir, \bodydir and \pagedir. The first two are
> easy enough to understand, and I think I get \pardir (flips where the
> \indent and so forth are). However, I'm not really clear on \bodydir and
> \pagedir: anyone got a good explanation?

Quoting myself from an older message:

Taco wrote:
> Roughly put, but I think fairly accurate, is that \bodydir is the
> 'box direction' of \box255, and \pagedir is the initial location of
> the placement origin point on the paper. These have to line up if your
> macro page is not shifting \box255 itself.

They are a bit odd in the sense that realistically both of them
are needed once (and exactly once) right at the start of a document,
and that both should have the same value: if they do not agree, text
will normally end up outside of the paper unless the macro package
intervenes explicitly.

> 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.

Best wishes,

More information about the luatex mailing list