Skip to main content

Module dirs

Module dirs 

Source
Expand description

Directions: the direction parameters (\pagedir, \bodydir, \pardir, \textdir, \mathdir, \linedir and their numeric …direction forms), the directions of boxes, and the direction nodes (\begindir/\enddir) that text-direction changes leave in horizontal lists (LuaTeX manual §3.3).

Behaviour established black-box against LuaTeX 1.22:

  • Direction parameters are saved and restored with groups like other parameters, and the assignment is local even with \global. \tracingassigns shows them as \textdir TLT.
  • A box without dir/bdir gets the direction of the list it is made in: \bodydir in vertical mode, \textdir in horizontal mode and \mathdir in math mode. Inside the box, \bodydir, \pardir and \textdir are (re)assigned the box’s direction, in that order. In a math shift group they are assigned \mathdir.
  • A formula in text whose \mathdir differs from \textdir (both after the formula’s group) gets \begindir/\enddir nodes just inside its math nodes.
  • Simple and semi-simple groups start by (re)assigning two internal counters, \nolocalwhatsits and \nolocaldirs, to 0, and box groups \nolocaldirs; every \textdir adds one to \nolocaldirs. They show only in \tracingassigns/\tracingrestores output.
  • \textdir in horizontal or math mode appends \begindir <dir>. If a text direction was already begun in the same group, an \enddir for it comes first (also for the same direction).
  • In vertical mode the assignment only records the direction; a paragraph started while one is recorded in the current box begins with \begindir <\textdir> (after the local par node, before the indentation box), unless \textdir is \pardir.
  • When a simple group ({…}) or a semi-simple group (\begingroup… \endgroup) ends outside vertical mode, the directions begun in it are ended, innermost first. Box and math groups end them silently. A box starts with no directions of its own.
  • Line breaking: the last line gets \enddir nodes for the directions still open at the end of the paragraph, between the final \penalty10000 and \parfillskip. Every other line ends with \enddir nodes for the directions open at its break (innermost first, before \rightskip), and the next line begins with \begindir nodes for them (outermost first).

Modules§

dir_sub
Dir node subtypes.