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.\tracingassignsshows them as\textdir TLT. - A box without
dir/bdirgets the direction of the list it is made in:\bodydirin vertical mode,\textdirin horizontal mode and\mathdirin math mode. Inside the box,\bodydir,\pardirand\textdirare (re)assigned the box’s direction, in that order. In a math shift group they are assigned\mathdir. - A formula in text whose
\mathdirdiffers from\textdir(both after the formula’s group) gets\begindir/\enddirnodes just inside its math nodes. - Simple and semi-simple groups start by (re)assigning two internal
counters,
\nolocalwhatsitsand\nolocaldirs, to 0, and box groups\nolocaldirs; every\textdiradds one to\nolocaldirs. They show only in\tracingassigns/\tracingrestoresoutput. \textdirin horizontal or math mode appends\begindir <dir>. If a text direction was already begun in the same group, an\enddirfor 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\textdiris\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
\enddirnodes for the directions still open at the end of the paragraph, between the final\penalty10000and\parfillskip. Every other line ends with\enddirnodes for the directions open at its break (innermost first, before\rightskip), and the next line begins with\begindirnodes for them (outermost first).
Modules§
- dir_sub
- Dir node subtypes.