1LaTeXML::Core::Token(3)User Contributed Perl DocumentatioLnaTeXML::Core::Token(3)
2
3
4
6 "LaTeXML::Core::Token" - representation of a Token: a pair of character
7 and category code (catcode); It extends LaTeXML::Common::Object.
8
9 Exported functions
10 "$catcode = CC_ESCAPE;"
11 Constants for the category codes:
12
13 CC_BEGIN, CC_END, CC_MATH, CC_ALIGN, CC_EOL,
14 CC_PARAM, CC_SUPER, CC_SUB, CC_IGNORE,
15 CC_SPACE, CC_LETTER, CC_OTHER, CC_ACTIVE,
16 CC_COMMENT, CC_INVALID, CC_CS.
17
18 [The last 2 are (apparent) extensions, with catcodes 16 and 17,
19 respectively].
20
21 "$token = Token($string,$cc);"
22 Creates a LaTeXML::Core::Token with the given content and catcode.
23 The following shorthand versions are also exported for convenience:
24
25 T_BEGIN, T_END, T_MATH, T_ALIGN, T_PARAM,
26 T_SUB, T_SUPER, T_SPACE, T_LETTER($letter),
27 T_OTHER($char), T_ACTIVE($char),
28 T_COMMENT($comment), T_CS($cs)
29
30 "@tokens = Explode($string);"
31 Returns a list of the tokens corresponding to the characters in
32 $string. All tokens have catcode CC_OTHER, except for spaces which
33 have catcode CC_SPACE.
34
35 "@tokens = ExplodeText($string);"
36 Returns a list of the tokens corresponding to the characters in
37 $string. All (roman) letters have catcode CC_LETTER, all others
38 have catcode CC_OTHER, except for spaces which have catcode
39 CC_SPACE.
40
41 "UnTeX($object, $suppress_linebreaks);"
42 Converts $object to a string containing TeX that created it (or
43 could have). Note that this is not necessarily the original TeX
44 code; expansions or other substitutions may have taken place.
45
46 Line-breaking of the generated TeX can be explicitly requested or
47 disabled by passing 0 or 1 as the second $suppress_linebreaks
48 argument. The default behavior of line-breaking is controlled by
49 the global State value "SUPPRESS_UNTEX_LINEBREAKS".
50
51 Methods
52 "@tokens = $object->unlist;"
53 Return a list of the tokens making up this $object.
54
55 "$string = $object->toString;"
56 Return a string representing $object.
57
58 "$string = $token->getCSName;"
59 Return the string or character part of the $token; for the special
60 category codes, returns the standard string (eg.
61 "T_BEGIN->getCSName" returns "{").
62
63 "$string = $token->getString;"
64 Return the string or character part of the $token.
65
66 "$code = $token->getCharcode;"
67 Return the character code of the character part of the $token, or
68 256 if it is a control sequence.
69
70 "$code = $token->getCatcode;"
71 Return the catcode of the $token.
72
74 pBruce Miller <bruce.miller@nist.gov>
75
77 Public domain software, produced as part of work done by the United
78 States Government & not subject to copyright in the US.
79
80
81
82perl v5.38.0 2023-07-19 LaTeXML::Core::Token(3)