Skip to main content

Crate latexml

Crate latexml 

Source
Expand description

latexml-oxide converts LaTeX documents into HTML5 with MathML, XML and EPUB 3: a Rust port of LaTeXML. This crate, published as latexml, holds the command-line binaries latexml_oxide and latexmlmath_oxide and the library that drives a conversion. Its developer binaries (genschema_oxide, the audits, cortex_worker) install from a source checkout with --features extended-install.

  • api: the stable entry points, convert_to_xml, convert_to_html and convert_to_html_with.
  • converter::Converter: a full conversion with its own configuration (preloads, search paths, split, …).
  • post: the post-processing to HTML, XHTML or EPUB (Perl’s latexmlpost).
  • format_dumps: the format dumps embedded in the binary or built once for the host TeX tree.
  • environment and intermediate_files: every environment variable read, and every file written.

The engine is in latexml_core and latexml_engine, the bindings in latexml_package and latexml_contrib, the math parser in latexml_math_parser and the post-processors in latexml_post. Start with the README and USAGE.md.

Modules§

alloc_hook
The binaries’ global allocator: an allocator that ends the process through the binary’s allocation-failure hook (latexml_core::watchdog::alloc_failed) when an allocation returns null. It replaces the nightly-only std::alloc::set_alloc_error_hook (issue #143): the hook’s Fatal:oom:alloc_failed line and exit 137 are kept for every allocation, and a fallible one (try_reserve, std’s fs::read) now ends the same way instead of returning an error. cortex_worker’s address-space cap (--child-mem-limit-mb) reaches the hook through it.
api
Stable, high-level conversion API for using latexml as a library.
bib_session
The recursive BibTeX session behind post-processing’s bibliography.
converter
core_interface
environment
Environment variables
format_dumps
A format dump for the TeX tree this process reads.
heap_trim
Handing freed heap memory back to the OS on long runs.
identity
Per-conversion identity banner — executable name, version, git revision and exact start time, logged once at the head of every conversion so any log names the precise binary and moment that produced it.
ini_tex
Format dump mode — Rust equivalent of Perl’s iniTeX + DumpFile.
intermediate_files
Intermediate files
lsp_server
Persistent server for editor/preview integration (latexml_oxide --server).
main_tex
Main .tex discovery for directory inputs.
multidoc
In-memory join of multiple core-XML documents into one.
post
Post-processing pipeline API.
render_workers
Process-parallel page rendering for pass B of the post pipeline (docs/archive/STREAMING_POST_DESIGN_2026-07-06.md §6).
source_date
The date of a paper’s source: the newest modification time among the TeX source files of the bundle it came in (Config::source_date_epoch), the clock ar5iv’s archival preload gives the job so \today prints the paper’s own date — the one arXiv’s PDF shows — and never the conversion’s (user ruling 2026-10-10).
streaming_restart
Eager → --streaming restart policy shared by the CLI and cortex_worker (batches 56dw/56dz): when to stream up front (resolve_streaming, the source-size projection), where an eligible eager run stops to rerun (restart_watermark, nine tenths of the memory fuse), whether a finished eager attempt asks for the rerun (restart_budget), and the memory release the rerun needs first (release_before_rerun).
util

Functions§

dump_compiled_latexml_model
Load the embedded LaTeXML schema and return its compiled-model serialisation in the .model plain-text format. Used by tools/compileschema.sh stage 2 (and the --dump-model flag on the latexml_oxide binary) to regenerate LaTeXML.model from the same source the runtime sees.
load_latexml_default_model
Load the embedded LaTeXML schema (compile-time) into the runtime MODEL. Single home for the load_model!("LaTeXML") macro expansion — the macro generates a fresh _ModelLoader::build_model at each call site (~600 KiB of .text per copy), so funnelling all callers through this one function lets LTO keep exactly one instance in the final binary. Mirrors Perl LaTeXML::Common::Model::compileSchema (Model.pm L121-136).