[luatex] TLT, TRT, RTT and LTL

David Carlisle d.p.carlisle at gmail.com
Mon Nov 21 22:01:05 CET 2016

As some will have seen on xetex list, there has been some gentle
pressure (from me and others:-) on xetex maintainers to adopt a model
for writing direction closer to the omega/luatex model than the
tex--xet model from etex that xetex currently uses.

But I thought I'd better check what I was asking for.

The direction primitives are more or less undocumented in the luatex
manual, mostly in reference to the changes from the original omega
versions. However there are four direction values as in the subject
line and (apparently) seven \*dir primitives
\pagedir \bodydir \pardir \textdir \mathdir \boxdir \linedir which
means that there are 4^7=16384 possible states for the direction
primitives. Clearly not all those states are sensible but it's less
clear how many of them are actually different (that is in what
contexts the different primitives may be used to specify a direction
and whether they have any effect at that point.

I stated to make a pass at documenting them, starting with some text
form the omega manual, adapted with some text from the luatex manual,
bits gleaned from reading the luatex sources, and some
experimentation, but it's incomplete and quite likely wrong in

If there is an existing more complete documentation I'd be happy to
discard this, or failing that, if anyone has any further text or
corrections I'll add and repost later,
currently it's just plain text but if it was at all accurate and
complete perhaps something could be added to the manual.


The luatex system distinguishes four different directions,

each is designated by three parameters:

The beginning of the page  is one of
T(top), L(left), R(right).

For English and Arabic, the beginning of the page is T;
for Japanese it is R;
for Mongolian it is L.

The beginning of the line  is one of
T(top), L(left), R(right).

Defines  where  each  line  begins.
For  English,  it is L;
for Arabic, it is R;
for Japanese and Mongolian, it is T.

The top of the line  is one of
T(top), L(left).
Corresponds  to  the  notion  of  ‘up’ within a  line.

These result in the following typical settings:

TLT for English,
TRT for  Arabic,
RTT for  Japanese,
LTL for  Mongolian.

The following primitives are used with these writing direction specifications.

page (\pagedir)
text (\textdir)
mathematics (\mathdir)
body (\bodydir)
paragraph (\pardir)
box (\boxdir)
line (\linedir)

Each of these primitives takes as primitive one of the above four
writing directions.


Can this be different to \pagedir? If it is different get warning
warning  (backend):
  pagedir differs from bodydir, the output may be placed wrongly on the page

This defines the direction of the paragraph building.
I in the default \pagedir TLT \bodydir TLT \textdit TLT then

paragraph indentation left of first line, at top.
\rightskip fills from the right and \parfillskip fills the bottom
line, from the right

paragraph indentation left of first line, at top.
\rightskip fills from the left and \parfillskip fills the bottom line
from the left,

paragraph indentation left of first line, at top.
\rightskip is a vertical skip after each line

paragraph indentation vertical above first line, at top.
\rightskip is a vertical skip after each line

*** not documented at all ??***

*** mentioned in manual but undocumented? ***

This primitive can appear anywhere in a text
Grouping is respected, so it is possible to have inserts within a paragraph:
these  are  implemented  using  the  local  paragraph  mechanism  described  in
the previous section.

Normally mathematics is done in the same direction as English, namely
TLT There have been situations where it has been written TRT.

TLT: left to right
TRT: Right to left
LTL: down with superscripts to the left
RTT: down with superscripts to the right

More information about the luatex mailing list