bartleby.language.tex
collapse-space
(collapse-space tree)
Collapse all sequences of contiguous space into a single space.
Group boundaries break contiguity.
This is a transformation instead of part of the parser since we may want to
output a tree that is relatively faithful to the input.
control-sequence
(control-sequence)
Parse a TeX 'control sequence', which can be a 'control symbol' or a 'control word'.
Returns a Keyword.
control-symbol
(control-symbol)
Parse a TeX 'control symbol', i.e., the escape character + another non-letter character.
Subsequent whitespace is not consumed. Returns a string.
control-word
(control-word)
Parse a TeX 'control word', i.e., the escape character + a sequence of letter characters.
All whitespace after the control word is immediately absorbed. Returns a string.
flatten
(flatten tree)
Flatten the list of nodes, removing commands and blocks throughout;
flatten this node into a string, or nil.
Flatten the node at loc, removing it if it's empty, replacing it with its
children if there are any, and removing any commands outright.
interpret-accent-commands
(interpret-accent-commands tree)
Unescape all accents in TeX node tree.
If loc points to an accent command, remove it and insert the appropriate
combining character after the following (non-whitespace) token
Take a node in the TeX tree and if it's an accent command (1-character keyword)
that has a corresponding combining character, return that character.
interpret-character-commands
(interpret-character-commands tree)
Replace each control sequence in a TeX tree that represents a specific
character with that character.
read
(read reader)
Parse and simplify the TeX reader into a string of TeX
read-str
(read-str string)
Parse and simplify a TeX string into a simplified string of TeX
simplify
(simplify tree)
Replace fancy characters, then unescape accents, then flatten
whitespace-chars
Set of the characters:
Horizontal Tab (U+0009)
Line Feed (U+000A)
Vertical Tab (U+000B)
Form Feed (U+000C)
Carriage Return (U+000D)
Space (U+0020)
write
(write tree writer & options)
Write TeX-formatted output to a java.io.Writer.
write-str
(write-str tree & options)
Convert TeX tree into TeX-formatted string