LATEXML(1p)
π
LATEXML(1p) β bestie's guide to latexml
okay so. this is the latexml page from the User Contributed Perl Documentation, and it's basically the glow-up machine that takes your TeX/LaTeX file and turns it into XML. no cap. let's get into it π¦
β¨ NAME β¨
latexml β transforms a TeX/LaTeX file into XML. that's the whole vibe. that's literally it. π
β¨ SYNOPSIS β¨
latexml [options] texfile
Options:
--destination=file sets destination file (default stdout).
--output=file [obsolete synonym for --destination]
--preload=module requests loading of an optional module;
can be repeated
--preamble=file sets a preamble file which will
effectively be prepended to the main file.
--postamble=file sets a postamble file which will
effectively be appended to the main file.
--includestyles allows latexml to load raw *.sty file;
by default it avoids this.
--path=dir adds to the paths searched for files,
modules, etc;
--log=file specifies log file (default is file named after job name)
--documentid=id assign an id to the document root.
--quiet suppress messages (can repeat)
--verbose more informative output (can repeat)
--strict makes latexml less forgiving of errors
--bibtex processes as a BibTeX bibliography.
--xml requests xml output (default).
--tex requests TeX output after expansion.
--box requests box output after expansion
and digestion.
--noparse suppresses parsing math
--nocomments omit comments from the output
--inputencoding=enc specify the input encoding.
--VERSION show version number.
--debug=package enables debugging output for the named
package
--help shows this help message.
and here's the tea β β if texfile is '-', latexml reads the TeX source straight from standard input. and if texfile has an explicit extension of .bib, it gets processed as a BibTeX bibliography instead. iykyk π
β¨ OPTIONS AND ARGUMENTS β¨
--destination=file
tells it where to send the goods β by default the XML just gets written to stdout. π«
--preload=module
asks for an optional module or package to get loaded. lowkey a lifesaver when your TeX code never explicitly asks for the module (like, it doesn't input it or usepackage it). for example, hit it with --preload=LaTeX.pool to force LaTeX mode. periodt. π
--preamble=file, --postamble=file
points at a file whose contents effectively get prepended or appended to your main document file's content. super useful when you're processing TeX fragments β in that case the preamble is where you'd stash your documentclass and begindocument control sequences. π«Ά
heads up bestie: this option is not used when processing BibTeX files. π
--includestyles
this one lets you process style files β that's files with the extensions sty, cls, clo, cnf. by default these files are just ignored unless there's a latexml implementation of them hanging around (one with an extension of ltxml). β¨
so these style files generally fall into two classes:
- ones that merely affect document style β totally ignorable in the XML, they're not the main character
- ones that define new markup and document structure, often by using deeper LaTeX macros to get what they want
and like. the omission will lead to other errors (missing macro definitions, rip), but it is unlikely that processing the TeX code in the style file will lead to a correct document. so, yeah. choose your fighter. π
--path=dir
adds dir to the search paths used when hunting for files, modules, style files, etc β kinda like TEXINPUTS. and yes, you can repeat this option as many times as your heart desires. π
--documentid=id
assigns an ID to the root element of the XML document. this ID generally gets inherited as the prefix of the IDs on all the other elements in the document. it's giving... exactly what you want when you're building a site out of multiple documents and you need every single node to have a unique ID. slay. π
--quiet
reduces how chatty the output is during processing. use it twice and it's pretty much silent π€«
--verbose
increases the verbosity of output during processing β use it twice and it's pretty chatty. genuinely useful when you're chasing down errors and want the details. π₯
--strict
specifies a strict processing mode. by default, undefined control sequences and invalid document constructs (the ones that violate the DTD) just give you warning messages, but it attempts to continue processing anyway. using --strict makes those generate fatal errors instead. dramatic? yes. effective? also yes. π
--bibtex
forces latexml to treat the file as a BibTeX bibliography. π
note bestie, the timing is slightly different than the usual case with BibTeX and LaTeX. in the latter case, BibTeX simply selects and formats a subset of the bibliographic entries, and the actual TeX expansion happens when the result gets included in a LaTeX document. in contrast,latexmlprocesses and expands the entire bibliography, and the selection of entries is done during postprocessing. which also means any packages that define macros used in the bibliography must be specified using the--preloadoption. don't forget or you'll be crying π
--xml
requests XML output β which, fun fact, is the default. icon behavior β
--tex
requests TeX output, for debugging purposes. processing only gets carried out through expansion and digestion. and uh, this may not be quite valid TeX, since Unicode may be introduced. π
--box
requests Box output, also for debugging. processing gets carried out through expansion and digestions, and then the result is printed. π
--nocomments
normally latexml preserves comments from the source file, and adds a comment every 25 lines as an aid in tracking the source. the option --nocomments discards all of those comments. bye bye comments π
--inputencoding=encoding
specify the input encoding, eg. --inputencoding=iso-8859-1. the encoding must be one known to Perl's Encode package. π§
important: this only enables the translation of the input bytes to UTF-8 used internally by LaTeXML β it does not affect catcodes. it is usually better to use LaTeX's inputenc package. and note that this does not affect the output encoding, which is always UTF-8. π
--VERSION
shows the version number of the LaTeXML package.. (yes, two periods, i'm keeping it, it's part of the lore) π
--debug=package
enables debugging output for the named package. you give the package name without the leading LaTeXML::. π
--help
shows this help message. be nice to it. π
β¨ SEE ALSO β¨
latexmlpost, latexmlmath, LaTeXML β go read those too bestie, they're all part of the same little family π«ΆπΈ
and that's the whole thing!! made with love by perl v5.40.1, stamped 2025-11-16, filed under LATEXML(1p). go transform some TeX, you gorgeous genius π β¨π
π¦ 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 on : a language model's rewrite of the original, under its terms