§ 2.1. Basic XML Conversion
The command
latexml options --destination=doc.xml doc
loads any required definition modules (see below), reads, tokenizes, expands and digests the TeX document doc.tex (or from standard input, if - is given for the filename), converts it to XML, performs some document rewriting, parses the mathematical content and writes the result in doc.xml. For details on the processing, see Chapter 3, and Chapter 5 for more information about math parsing.
¶ Module Loading
A first consideration is what definitions for control sequences and environments are active and used for the processing. Definitions and customization modules, if present, are loaded in the following order:
- TeX.pool.ltxml
-
the core module is always loaded.
- --preload=module
-
causes loading of module.ltxml. For example, if LaTeXML fails to recognize a LaTeX document --preload=LaTeX.pool can be useful to force LaTeX-mode. Or if you want This option can be repeated, and the modules will be loaded in the given order.
- doc.latexml
-
a document-specific customization module is loaded if present.
As processing proceeds, additional modules may be loaded as follows.
- LaTeX.pool.ltxml
-
the core latex module, is loaded upon encountering certain recognizably LaTeX-specific commands, such as
\documentclass. - \documentclass{class}
-
loads class.cls.ltxml. (legacy
\documentstylebehaves similarly, along with any required packages). - \usepackage{package}
-
(or related) loads package.sty.ltxml. LaTeXML will not attempt to read the package.sty file, as these often involve LaTeX internals meaningless to the generation of XML, unless forced to with the option
--includestyles
A selective, per-file, option may be developed in the future — please provide use cases.
- \input{file}
-
loads an appropriate version of file, specifically the first found of: file.tex.ltxml, file.tex, file.ltxml or file.
Some of these modules (esp. TeX and LaTeX), are parts of the LaTeXML distribution; others are supplied by the user, or can be overridden by the user. See Chapter 4 for details about what can go in these modules.
Directories to search (in addition to the working directory) for modules and other files can be specified using
--path=directory
This option can be repeated.
¶ Other Options
The number and detail of progress and debugging messages printed during processing can be controlled using
--verbose and --quiet
They can be repeated to get even more or fewer details.
An option most useful in constructing complicated sites is
--documentid=id
which provides an ID for the document root element which is inheritted as a prefix for id's of the child-elements in the document. Using this option can assure unique identifiers across a set of source documents.
See the documentation for the command latexml for less common options.