§ 2.2. Basic Postprocessing
In the simplest situation, you have a single TeX source document from which you want to generate a single output document. The command
| latexmlpost options --destination=doc.xhtml doc |
or similarly with --destination=doc.html, will carry out a set of appropriate transformations in sequence:
-
scanning of labels and ids;
-
filling in the index and bibliography (if needed);
-
cross-referencing;
-
conversion of math;
-
conversion of graphics and picture environments to web format (png);
-
applying an XSLT stylesheet.
The output format affects the defaults for each step and is determined by the file extension of --destination, or by the option
| --format=(xhtml|html|xml) |
- html
-
both math and graphics are converted to png images; the stylesheet LaTeXML-html.xslt is used.
- xhtml
-
math is converted to Presentation MathML, other graphics are converted to images; the stylesheet LaTeXML-xhtml.xslt is used.
- xml
-
no math, graphics or XSLT conversion is carried out.
Of course, all of these conversions can be controlled or overridden by explicit options described below. For more details about less common options, see the command documentation latexmlpost, as well as Appendix E.
¶ Scanning
The scanning step collects information about all labels, ids, indexing commands, cross-references and so on, to be used in the following postprocessing stages.
¶ Indexing
An index is built from \index markup, if
makeidx's \printindex command has been used,
but this can be disabled by
| --noindex |
The index entries can be permuted with the option
| --permutedindex |
Thus \index{term a!term b} also shows up as \index{term b!term a}.
This leads to a more complete, but possibly rather silly, index,
depending on how the terms have been written.
¶ Bibliography
Bibilographic data from BibTeX can be provided with the option
| --bibliography=bibfile.xml |
The bibliography would have typically been produced by running
| latexml --dest=bibfile.xml bibfile.bib |
Note that the XML file, bibfile, is not used to directly produce
an HTML-formatted bibliography, rather it is used to fill in
the \bibliography{..} within a TeX document.
¶ Cross-Referencing
In this stage, the scanned information is used to fill in the text and links of cross-references within the document. The option
| --urlstyle=(server|negotiated|file) |
can control the format of urls with the document.
- server
-
formats urls appropriate for use from a web server. In particular, trailing index.html are omitted. (default)
- negotiated
-
formats urls appropriate for use by a server that implements content negotiation. File extensions for html and xhtml are omitted. This enables you to set up a server that serves the appropriate format depending on the browser being used.
- file
-
formats urls explicitly, with full filename and extension. This allows the files to be browsed from the local filesystem.
¶ Math Conversion
Specific conversions of the mathematics can be requested using the options
| --mathimages # converts math to png images, |
| --presentationmathml or --pmml # creates Presentation \MathML |
| --contentmathml or --cmml # creates Content \MathML |
| --openmath or --om # creates \OpenMath |
(Each of these options can also be negated if needed, eg. --nomathimages) It must be pointed out that the Content MathML and OpenMath conversions are currently rather experimental.
More than one of these conversions can be requested, and each will be included in the output document. However, the option
| --parallelmath |
can be used to generate parallel MathML markup, provided the first conversion is either --pmml or --cmml.
¶ Graphics processing
Conversion of graphics (eg. from the graphic(s|x) packages'
\includegraphics) can be enabled or disabled
using
| --graphicsimages or --nographicsimages |
Similarly, the conversion of picture environments can be controlled with
| --pictureimages or --nopictureimages |
An experimental capability for converting the latter to SVG can be controlled by
| --svg or --nosvg |
¶ Stylesheet
If you wish to provide your own XSLT or CSS stylesheets, the options
| --stylesheet=stylesheet.xsl |
| --css=stylesheet.css |
can be used. The --css option can be repeated to include multiple stylesheets; for example, the distribution provides several in addition to the core.css stylesheet which is included by default.
- navbar-left.css
-
Places a navigation bar on the left.
- navbar-right.css
-
Places a navigation bar on the left.
- theme-blue.css
-
Colors various features in a soft blue.
- amsart.css
-
A style appropriate for many journal articles.