LaTeXML::Core(3pm)
π LaTeXML::Core β the Perl doc bestie edition
okay so this is the LaTeXML::Core(3pm) page from the User Contributed Perl Documentation, and it's literally the main-character module that transforms TeX into XML. buckle up π
β¨ NAME β¨
"LaTeXML" β transforms TeX into XML. that's it, that's the vibe. no cap.
πΈ SYNOPSIS πΈ
use LaTeXML::Core;
my $latexml = LaTeXML::Core->new();
$latexml->convertAndWrite("adocument");
But also β and this is the part where u breathe a sigh of relief β see the convenient command line script latexml, which suffices for most purposes. like genuinely, for most purposes u do not need to touch any of this. iykyk π
π¦ DESCRIPTION π¦
π METHODS π
"my $latexml = LaTeXML::Core->new(%options);"β Creates a new LaTeXML object for transforming TeX files into XML. yes bestie, this is the constructor, this is where the whole journey begins β¨
Here are the options u can pass, and what each one does:
verbosityβ Controls verbosity; higher is more verbose, smaller is quieter.0is the default.strictβ If true, undefined control sequences and invalid document constructs give fatal errors, instead of warnings. like, it stops playing games. πincludecommentsβ If false, comments will be excluded from the result document.preloadβ an array of modules to preloadsearchpathβ an array of paths to be searched for Packages and style files.
(these generally set config variables in the LaTeXML::Core::State object) β so like, that's where the settings actually live, okurrr π
"$latexml->convertAndWriteFile($file);"β Reads the TeX file$file.tex, digests and converts it to XML, and saves it in$file.xml. in goes.tex, out comes.xml, no notes. π"$doc = $latexml->convertFile($file);"β Reads the TeX file$file, digests and converts it to XML and returns the resultingXML::LibXML::Document."$doc = $latexml->convertString($string);"β OBSOLETE π Use"$latexml-"convertFile("literal:$string");>instead. (yes it's written exactly like that in the source, i don't make the rules.)"$latexml->writeDOM($doc,$name);"β Writes the XML document to$name.xml."$box = $latexml->digestFile($file);"β Reads the TeX file$file, and digests it returning theLaTeXML::Core::Boxrepresentation."$box = $latexml->digestString($string);"β OBSOLETE π« Use"$latexml-"digestFile("literal:$string");>instead."$doc = $latexml->convertDocument($digested);"β Converts$digested(theLaTeXML::Core::Boxreprentation) into XML, returning theXML::LibXML::Document.
π§ Customization π§
In the simplest case, LaTeXML will understand your source file and convert it automatically. iconic behaviour, honestly.
With more complicated (realistic) documents, you will likely need to make document specific declarations for it to understand local macros, your mathematical notations, and so forth. like yeah, when things get real, u gotta teach it ur ways π
Before processing a file doc.tex, LaTeXML reads the file doc.latexml, if present. Likewise, the LaTeXML implementation of a TeX style file, say style.sty is provided by a file style.ltxml.
See LaTeXML::Package for documentation of these customization and implementation files. that's ur next stop, fr fr π
β SEE ALSO β
See latexml for a simple command line script. honestly the low-effort slay option.
See LaTeXML::Package for documentation of these customization and implementation files.
For cases when the high-level declarations described in LaTeXML::Package are not enough, or for understanding more of LaTeXML's internals, see:
LaTeXML::Core::Statemaintains the current state of processing, bindings or variables, definitions, etc.LaTeXML::Core::Token,LaTeXML::Core::MouthandLaTeXML::Core::Gulletdeal with tokens, tokenization of strings and files, and basic TeX sequences such as arguments, dimensions and so forth.LaTeXML::Core::BoxandLaTeXML::Core::Stomachdeal with digestion of tokens into boxes.LaTeXML::Core::Document,LaTeXML::Common::Model,LaTeXML::Core::Rewritedealing with conversion of the digested boxes into XML.LaTeXML::Core::DefinitionandLaTeXML::Core::Parametersrepresentation of LaTeX macros, primitives, registers and constructors.LaTeXML::MathParserthe math parser.LaTeXML::Global,LaTeXML::Common::Error,LaTeXML::Common::Objectother random modules.
π AUTHOR π
Bruce Miller <bruce.miller@nist.gov> β thank u king π«Ά
π₯ COPYRIGHT π₯
Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US. periodt. π
okay that's the whole page bestie, nothing skipped, nothing invented β go transform some TeX πΈ
β¨ and that's a wrap β¨ β this was LaTeXML::Core(3pm) from perl v5.40.1, dated 2025-11-16. mwah π
π¦ where this page comes from
- ubuntu resolute: latexml 0.8.8-4 Β· PD
- ubuntu stonking: latexml 0.8.8-4 Β· PD
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms