1LaTeXML::Core::Stomach(U3s)er Contributed Perl DocumentatLiaoTneXML::Core::Stomach(3)
2
3
4
6 "LaTeXML::Core::Stomach" - digests tokens into boxes, lists, etc.
7
9 "LaTeXML::Core::Stomach" digests tokens read from a
10 LaTeXML::Core::Gullet (they will have already been expanded).
11
12 It extends LaTeXML::Common::Object.
13
14 There are basically four cases when digesting a LaTeXML::Core::Token:
15
16 A plain character
17 is simply converted to a LaTeXML::Core::Box recording the current
18 LaTeXML::Common::Font.
19
20 A primitive
21 If a control sequence represents
22 LaTeXML::Core::Definition::Primitive, the primitive is invoked,
23 executing its stored subroutine. This is typically done for side
24 effect (changing the state in the LaTeXML::Core::State), although
25 they may also contribute digested material. As with macros, any
26 arguments to the primitive are read from the LaTeXML::Core::Gullet.
27
28 Grouping (or environment bodies)
29 are collected into a LaTeXML::Core::List.
30
31 Constructors
32 A special class of control sequence, called a
33 LaTeXML::Core::Definition::Constructor produces a
34 LaTeXML::Core::Whatsit which remembers the control sequence and
35 arguments that created it, and defines its own translation into
36 "XML" elements, attributes and data. Arguments to a constructor
37 are read from the gullet and also digested.
38
39 Digestion
40 "$list = $stomach->digestNextBody;"
41 Return the digested LaTeXML::Core::List after reading and digesting
42 a `body' from the its Gullet. The body extends until the current
43 level of boxing or environment is closed.
44
45 "$list = $stomach->digest($tokens);"
46 Return the LaTeXML::Core::List resuting from digesting the given
47 tokens. This is typically used to digest arguments to primitives
48 or constructors.
49
50 "@boxes = $stomach->invokeToken($token);"
51 Invoke the given (expanded) token. If it corresponds to a
52 Primitive or Constructor, the definition will be invoked, reading
53 any needed arguments fromt he current input source. Otherwise, the
54 token will be digested. A List of Box's, Lists, Whatsit's is
55 returned.
56
57 "@boxes = $stomach->regurgitate;"
58 Removes and returns a list of the boxes already digested at the
59 current level. This peculiar beast is used by things like \choose
60 (which is a Primitive in TeX, but a Constructor in LaTeXML).
61
62 Grouping
63 "$stomach->bgroup;"
64 Begin a new level of binding by pushing a new stack frame, and a
65 new level of boxing the digested output.
66
67 "$stomach->egroup;"
68 End a level of binding by popping the last stack frame, undoing
69 whatever bindings appeared there, and also decrementing the level
70 of boxing.
71
72 "$stomach->begingroup;"
73 Begin a new level of binding by pushing a new stack frame.
74
75 "$stomach->endgroup;"
76 End a level of binding by popping the last stack frame, undoing
77 whatever bindings appeared there.
78
79 Modes
80 "$stomach->beginMode($mode);"
81 Begin processing in $mode; one of 'text', 'display-math' or
82 'inline-math'. This also begins a new level of grouping and
83 switches to a font appropriate for the mode.
84
85 "$stomach->endMode($mode);"
86 End processing in $mode; an error is signalled if $stomach is not
87 currently in $mode. This also ends a level of grouping.
88
90 Bruce Miller <bruce.miller@nist.gov>
91
93 Public domain software, produced as part of work done by the United
94 States Government & not subject to copyright in the US.
95
96
97
98perl v5.32.0 2020-11-17 LaTeXML::Core::Stomach(3)