Skip to main content

Crate latexml_core

Crate latexml_core 

Source
Expand description

The Core of latexml - roughly the equivalent of TeX conversion.

Re-exports§

pub use crate::common::error::*;

Modules§

alignment
Support for TeX-like Alignments
aux_macros
Auxiliary macros Helper macros for quicker and more idiomatic construction and access to data structures.
binding
The programmable API foundation for creating bindings of LaTeX sty/cls libraries
comment
TeX comments as standalone objects
common
Common abstractions that are useful at various stages of Core processing
cycle_guard
Windowed cycle-detection infinite-loop guard.
definition
All possible definitions for TeX-native commands (expandable, primitive, constructor,…)
digested
a shared interface for digested objects Interface layer for the full range of digested objects
document
An abstraction layer over the converted XML document
dump_codegen
Code generator: dump file → compiled Rust module Generate Rust source code from a kernel dump file.
dump_reader
Reader for Rust-native kernel dump files Reader for Rust-native kernel dump files (produced by dump_writer.rs).
dump_writer
Writer for Rust-native kernel dump files Writer for Rust-native kernel dump files.
gullet
The Gullet is responsible for reading Tokens and other data from the Mouth
keyval
A LaTeX-like Key-Value object Key-Value Definitions
keyvals
A collection of Key-Value objects, typically from a single LaTeX argument
ligature
Rules for combining together characters and other text rules
list
A list of Digested objects
mouth
The mouth is a thin interface over a file, responsible for reading characters and associating them with catcodes
parameter
The abstraction layer used by the Gullet to read arguments for the various kinds of TeX object definitions
rewrite
Rules for rewriting the constructed XML document, after core processing has completed
stack_guard
Configurable native-stack growth guard for deeply-recursive digestion.
state
A global, singleton, mutable state - hosts almost all TeX-facing runtime information for the conversion
stomach
The stomach is an abstraction responsible for digesting Tokens and Registers prepared by the Gullet into Boxes
sxml
Streaming XML substrate for fragmented (bounded-memory) conversion. Streaming XML substrate — the shared representation layer for fragmented (bounded-memory) conversion.
tbox
A TeX-like digested Box
telemetry
Per-job structured telemetry: phase wall times, counts, resource peaks. See docs/performance/TELEMETRY.md for the design contract. Per-job telemetry: phase wall times, counts, and resource peaks.
token
The Token and its Catcode
tokens
Grouping Tokens together Token List constructors.
util
Auxilary utilities that do not participate in the main conversion abstraction
watchdog
Main-level wall-clock watchdog that forcibly aborts the process after a deadline. Complements the cooperative stomach::check_timeout polling for native-code hotspots (Marpa, libxml2, libxslt) that don’t return to the digestion loop. Wall-clock watchdog that forcibly aborts the process after a deadline.
whatsit
A TeX-like digested Whatsit

Macros§

AssignRegister
CharToken
Special case: a character needs swift string conversion, so let’s use a dedicated macro
Debug
DebugFeature
Feature-gated debug logging — Perl’s Debug(...) if $LaTeXML::DEBUG{feature}. Usage: DebugFeature!("frontmatter", "FRONT Add {}", entry). Logs with the feature name as the log target (so output matches the previous log::debug!(target: "frontmatter", ...) form) and counts a Debug in the status report, like Debug!. NB deliberately does NOT forward to Debug! — its 3-expr (category, object, message) arm would mis-capture a format string with two arguments.
Error
Explode
Explode a string into a list of tokens, all w/catcode OTHER (except space). Note: newlines are converted to OTHER, NOT SPACE (Perl #2700 reverted #2646). ^^J in TeX decodes to CC_OTHER by default; let the tokenizer handle catcode reassignment if needed.
ExplodeChars
ExplodeText
Similar to Explode, but convert letters to catcode LETTER and others to OTHER Hopefully, this is essentially correct WITHOUT resorting to catcode lookup? Perl sync: newlines are OTHER, not SPACE (matches Perl #2700 revert of #2646).
Fatal
Font
build a Font from key=>val pairs
FontDirective
build a FontDirective from key=>val pairs (currently only FontDirective::Asset is supported in this macro)
Info
NewDefault
given a struct $name, create a new instance of it using the given key=>val pairs and complete the remaining entries via the Default instance
NewDefaultV
Just like NewDefault, but adds a mandatory .into_option() to all values
Note
Progress note to BOTH the log and stderr — Perl Note (_printline): the LOG always (if a buffer is bound, ANSI-stripped), STDERR only when the verbosity admits it ($USE_STDERR && $VERBOSITY>=0max_level >= Info).
NoteLog
Progress note to the LOG only — Perl NoteLog (print $LOG … if $LOG). Always written to the bound log buffer (the log is the verbose record), never stderr.
NoteSTDERR
Progress note to STDERR only — Perl NoteSTDERR (if $USE_STDERR && $VERBOSITY>=0). Never touches the log.
Number
Roman
Convert the number to upper case roman numerals, returning a list of LaTeXML::Core::Token
SetCounter
SymExplodeText
T_ACTIVE
macro for an ACTIVE char token
T_ALIGN
macro for an ALIGN “&” token
T_ARG
macro for a numbered ARG token
T_BEGIN
macro for a BEGIN “{” token
T_COMMENT
macro for a COMMENT content token
T_CR
macro for a CR “\n” token
T_CS
macro for a command sequence token
T_END
macro for a new END “{” token
T_LETTER
macro for a LETTER token
T_MARKER
macro for a tracing MARKER token
T_MATH
macro for a MATH “$” token
T_OTHER
macro for an OTHER code token
T_OTHER_CHAR
T_OTHER from a single character
T_PARAM
macro for a PARAM “#” token
T_RELAX
macro for T_CS(“\relax”)
T_SPACE
macro for a SPACE token (default “ “)
T_SUB
macro for a SUB “_” token
T_SUPER
macro for a SUPER “^” token
Token
Token constructor macro (defaults to OTHER code)
Tokens
convenience macro for assembling a Tokens object from different pieces (Token, Vec<Token>, Tokens)
Warn
after_digest
after_digest_simple
after_digest_single
before_digest
before_digest_simple
before_digest_single
construct
count_unpack_ref
fatal
fontmap
Instantiates a Font, using the Font fields as keys, and calling .into() for each value. The specification can be partial - missing fields are taken via the Default trait.
forbidMath
generate_message
getter
A closure for obtaining a RegisterValue, usually owned by a Register getter.
map
A flexary macro for constructing HashMap<String, T> maps, where T is generic.
mixrc
A variant on mixvec! where each argument receives an additional .into() call best used with an outer context that explicitly provides the expected type, such as
mixvec
A variant on vec! where each argument receives an additional .into() call best used with an outer context that explicitly provides the expected type, such as
noreplacement
pin
Call-site-cached interning for string literals — the first call on a thread pins the literal via pin_static, later calls return the cached SymStr directly (thread-local OnceCell load, no arena access). Use this from hot state-key lookup sites so you can keep writing string literals at the call site and still skip the per-call pin() hash probe:
predigest
print_stderr
prints a to STDERR without a line break
println_stderr
prints a single line to STDERR
prop_bool
prop_digested
prop_str
prop_string
prop_whatsit
properties
raw_char_map
A flexary macro for constructing HashMap<char, T> maps, where T is generic
raw_map
A flexary macro for constructing HashMap<K, V> maps, where K and V are both generic (inferred at time of use)
reader
replacement
report
report_mut
requireMath
reversion
reversion_digested
rewrite_replace_sub
roman
Convert the number to lower case roman numerals, returning a list of LaTeXML::Core::Token
s
The s! macro is a briefer alias for format!
set
Simple generic helper for HashSet<K,V> creation Source: https://riptutorial.com/rust/example/4149/create-a-hashset-macro
setter
sizersub
some
The some! macro transforms data in type S to Option<Into<T>> (always wrapping with Some)
static_map
A flexary macro for constructing HashMap<&'static str, &'static str> maps
stored_map
A flexary macro for constructing SymHashMap<Stored> maps
string_keys_map
A flexary macro for constructing HashMap<String, T> maps
string_map
A flexary macro for constructing HashMap<String, String> maps
sym_map
A flexary macro for constructing SymHashMap<T> maps
tagsub
transfer_opt_default
Transfers a mutable pointer to a hashmap entry, or fills in with a default if missing.
unpack_opt
Try to efficiently unwrap a Vec<T> into a [T;n] for $arg1$argn
unpack_opt_ref
Try to efficiently unwrap a &Vec<T> into a &[T;n] for $arg1$argn
unported
unref
Convenience macro to flexibly unpack a collection of Vec<ArgWrap> arguments into individual Tokens variables.

Structs§

Core
The Core conversion runtime
CoreOptions
Configuration for the Core processing

Enums§

TexMode
The current TeX processing mode

Statics§

NO_PROPERTIES

Traits§

BoxOps
Common operations for Box-like (digested) data

Functions§

ensure_libxml_init
Initialize libxml2 for thread safety. Must be called before any libxml2 operations that don’t go through libxml::parser::Parser. Delegates to the safe wrapper in rust-libxml, which uses its own std::sync::Once to guarantee exactly-once initialisation even across threads.
reset_thread_engine
Free this thread’s accumulated engine state — the three State singletons (STATE, STD_STATE, STY_STATE) and the string-interner arena — returning them to a fresh baseline.