class RuleNode
- supers: Node
A rule node stands for a solid black rectangle.
Contrary to traditional TeX, LuaTeX has more rule
subtypes because we
also use rules to store reuseable objects and images. User nodes are invisible
and can be intercepted by a callback.
The left
and right
keys are somewhat special (and experimental).
When rules are auto adapting to the surrounding box width you can enforce a shift
to the right by setting left
. The value is also subtracted from the width
which can be a value set by the engine itself and is not entirely under user
control. The right
is also subtracted from the width. It all happens in
the backend so these are not affecting the calculations in the frontend (actually
the auto settings also happen in the backend). For a vertical rule left
affects the height and right
affects the depth. There is no matching
interface at the TeX end (although we can have more keywords for rules it would
complicate matters and introduce a speed penalty.) However, you can just
construct a rule node with Lua and write it to the TeX input. The outline
subtype is just a convenient variant and the transform
field
specifies the width of the outline.
Example:
assert.node_type("rule", nil, {
id = "rule (2)",
subtypes = {
"normal (0)",
"box (1)",
"image (2)",
"empty (3)",
"user (4)",
"over (5)",
"under (6)",
"fraction (7)",
"radical (8)",
"outline (9)",
},
fields = {
"prev (-1)",
"next (0)",
"id (1)",
"subtype (2)",
"attr (3)",
"width (4)",
"depth (5)",
"height (6)",
"dir (7)",
"index (8)",
"left (9)",
"right (10)",
},
})
Reference:
- Source file of the
LuaTeX
manual: luatex-nodes.tex#L119-L157 - Corresponding C source code: texnodes.c#L912-L920
- Donald Ervin Knuth. “TeX: The Program”: section 135. page 51 tex.pdf
😱 Types incomplete or incorrect? 🙏 Please contribute!
fields
RuleNode.subtype
RuleNode.attr
RuleNode.attr : Node {
next: Node?,
prev: Node?,
id: integer,
subtype: integer,
head: Node?,
attr: Node,
}
A list of attributes.
RuleNode.width
the width of the rule where the special value −1073741824 is used for ‘running’ glue dimensions
RuleNode.height
the height of the rule (can be negative)
RuleNode.depth
the depth of the rule (can be negative)
RuleNode.left
shift at the left end (also subtracted from width)
RuleNode.right
(subtracted from width)
RuleNode.dir
the direction of this rule
RuleNode.index
an optional index that can be referred too
RuleNode.transform
an private variable (also used to specify outline width)