[luatex] Info on direction primitives/implementation

Joseph Wright joseph.wright at morningstar2.co.uk
Wed Dec 5 12:01:44 CET 2012

On 05/12/2012 10:40, Taco Hoekwater wrote:
>> 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.

Ah right: that explains my experiments (things kept disappearing from
the page). I assume these would also make sense at the start of a vbox
being used as a 'minipage' (in LaTeX terminology) or similar galley

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

OK, so at the macro level probably they want to have a single interface.

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

Makes sense: perhaps one of the Arabic typesetting experts might step in
here and give an opinion :-)
Joseph Wright

More information about the luatex mailing list