LaTeXML::Core(3)

πŸ“¦ version 0.8.8, in nixos 26.05, nixpkgs unstable

πŸ’… NAME πŸ’…

LaTeXML β€” it transforms TeX into XML. That's it, that's the whole vibe. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

use LaTeXML::Core;
my $latexml = LaTeXML::Core->new();
$latexml->convertAndWrite("adocument");

But bestie, real talk β€” also check out the convenient command line script latexml, which honestly suffices for most purposes. Like, most of the time that's all you need, no cap. 🫢

This is page LaTeXML::Core(3) from the User Contributed Perl Documentation, and we're gonna get into it.


🌸 DESCRIPTION 🌸

πŸŽ€ METHODS πŸŽ€

  • my $latexml = LaTeXML::Core->new(%options); β€” creates a fresh new LaTeXML object, main character energy, for transforming TeX files into XML. πŸ’–

The %options you can pass (and yes, these generally set config variables in the LaTeXML::Core::State object, iykyk):

  • verbosity β€” controls verbosity. Higher is more verbose, smaller is quieter. 0 is the default. 🀫
  • strict β€” if true, undefined control sequences and invalid document constructs give fatal errors instead of warnings. So like, it stops playing around. πŸ’€
  • includecomments β€” if false, comments will be excluded from the result document. Bye bye comments πŸ™ˆ
  • preload β€” an array of modules to preload.
  • searchpath β€” an array of paths to be searched for Packages and style files. πŸ”
  • $latexml->convertAndWriteFile($file); β€” reads the TeX file $file.tex, digests and converts it to XML, and saves it in $file.xml. Slay, it did both jobs in one call. ✨
  • $doc = $latexml->convertFile($file); β€” reads the TeX file $file, digests and converts it to XML, and returns the resulting XML::LibXML::Document. 🎁
  • $doc = $latexml->convertString($string); β€” OBSOLETE 🚨 Use this instead:
$latexml-"convertFile("literal:$string");>
  • $latexml->writeDOM($doc,$name); β€” writes the XML document to $name.xml. πŸ“
  • $box = $latexml->digestFile($file); β€” reads the TeX file $file, and digests it, returning the LaTeXML::Core::Box representation. Boxed up and ready πŸ“
  • $box = $latexml->digestString($string); β€” OBSOLETE 🚨 Use this instead:
$latexml-"digestFile("literal:$string");>
  • $doc = $latexml->convertDocument($digested); β€” converts $digested (the LaTeXML::Core::Box reprentation) into XML, returning the XML::LibXML::Document. πŸ‘‘

🌈 Customization 🌈

In the simplest case, LaTeXML will just understand your source file and convert it automatically. Iconic. But with more complicated (realistic) documents, you will likely need to make document specific declarations so it understands local macros, your mathematical notations, and so forth. 😭

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. Matching set, cute. πŸ’œ

See LaTeXML::Package for documentation of these customization and implementation files.


πŸ‘‘ SEE ALSO πŸ‘‘

See latexml for a simple command line script.

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::State β€” maintains the current state of processing, bindings or variables, definitions, etc.
  • LaTeXML::Core::Token, LaTeXML::Core::Mouth and LaTeXML::Core::Gullet β€” deal with tokens, tokenization of strings and files, and basic TeX sequences such as arguments, dimensions and so forth.
  • LaTeXML::Core::Box and LaTeXML::Core::Stomach β€” deal with digestion of tokens into boxes.
  • LaTeXML::Core::Document, LaTeXML::Common::Model, LaTeXML::Core::Rewrite β€” dealing with conversion of the digested boxes into XML.
  • LaTeXML::Core::Definition and LaTeXML::Core::Parameters β€” representation of LaTeX macros, primitives, registers and constructors.
  • LaTeXML::MathParser β€” the math parser. πŸ”₯
  • LaTeXML::Global, LaTeXML::Common::Error, LaTeXML::Common::Object β€” other random modules.

✨ AUTHOR ✨

Bruce Miller <bruce.miller@nist.gov> β€” ty for your service 🫢


Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.


And that's the whole thing, bestie β€” perl v5.42.3, dated 2024-02-26, page LaTeXML::Core(3). Go forth and convert that TeX, periodt. πŸ’…πŸŒˆβ­

πŸ“¦ where this page comes from