pub struct DeclaredMode {
pub mode: Option<SymStr>,
pub enter_horizontal: bool,
pub leave_horizontal: bool,
pub bounded: bool,
pub require_math: bool,
pub forbid_math: bool,
pub restricted_box: bool,
}Expand description
The mode transitions a binding’s options compile to for a primitive or constructor (its
mode, enter_horizontal, leave_horizontal, bounded, require_math and forbid_math
options), kept beside the digestion closures so that an audit can compare them with the
prologue of the real macro the binding replaces (KERNEL_CAPABILITIES K13). The definers
build those closures from this record, so the two cannot drift apart.
It holds what the options compile to, not their spelling: an environment that names no
mode records restricted_horizontal (Perl’s DefEnvironmentI, Package.pm:1902), and
bounded is dropped when a mode is given. It covers the opening side only (\begin{env}
and the bare \env; the closers undo it), and only the options: a prologue a binding’s
closure performs by hand (enter_horizontal() in its body) is not in it. A robust
command’s record is on its \cs␣ body, not on the \protect wrapper.
The prologue runs in the fixed order of Perl’s DefPrimitiveI/DefConstructorI
(Package.pm:1303-1309, 1465-1471): require_math, forbid_math, enter_horizontal,
leave_horizontal, then the mode (or the group when bounded). No definition declares both
horizontal transitions, in Perl’s pools or here; one that did would start a paragraph and
then end it.
Fields§
§mode: Option<SymStr>The mode the definition begins, after text is lowered to restricted_horizontal.
enter_horizontal: boolStarts a paragraph first: declared, or implied by a primitive’s or constructor’s
mode => "text" (Package.pm:1297-1299, 1459-1461; not an environment’s).
leave_horizontal: boolEnds the paragraph, after enter_horizontal when both are declared.
bounded: boolOpens a group: bounded with no mode, or a math constructor without nogroup.
require_math: bool§forbid_math: bool§restricted_box: boolDeclared mode => "restricted_horizontal" itself (not text, not an environment’s default): the constructor
builds a TeX box (\hbox, \mbox, \fcolorbox, \scalebox), the first element it opens outside math marked
for a frontmatter field’s print (core document::FIELD_BOX_PROPERTY, OXIDIZED_DESIGN #715).