# latexmlpost

(November 17, 2020)

Postprocesses an xml file generated by latexml to perform common tasks, such as convert math to images and processing graphics inclusions for the web.

## Synopsis

latexmlpost [options] xmlfile

 Options:
--verbose               shows progress during processing.
--VERSION               show version number.
--help                  shows help message.
--sourcedirectory=sourcedir sets directory of the original
source TeX file.
--validate, --novalidate Enables (the default) or disables
validation of the source xml.
--format=html|html5|html4|xhtml|xml requests the output format.
(html defaults to html5)
--destination=file      sets output file (and directory).
--omitdoctype           omits the Doctype declaration,
--noomitdoctype         disables the omission (the default)
--numbersections        enables (the default) the inclusion of
section numbers in titles, crossrefs.
--nonumbersections      disables the above
--stylesheet=xslfile    requests the XSL transform using the
given xslfile as stylesheet.
--css=cssfile           adds css stylesheet to (x)html(5)
(can be repeated)
--nodefaultresources    disables processing built-in resources
--javscript=jsfile      adds a link to a javascript file into
html4/html5/xhtml (can be repeated)
--xsltparameter=name:value passes parameters to the XSLT.
--split                 requests splitting each document
--nosplit               disables the above (default)
--splitat               sets level to split the document
--splitpath=xpath       sets xpath expression to use for
splitting (default splits at
sections, if splitting is enabled)
--splitnaming=(id|idrelative|label|labelrelative) specifies
how to name split files (idrelative).
--scan                  scans documents to extract ids,
labels, etc.
section titles, etc. (default)
--noscan                disables the above
--crossref              fills in crossreferences (default)
--nocrossref            disables the above
--urlstyle=(server|negotiated|file) format to use for urls
(default server).
--index                 requests creating an index (default)
--noindex               disables the above
--splitindex            Splits index into pages per initial.
--nosplitindex          disables the above (default)
--permutedindex         permutes index phrases in the index
--nopermutedindex       disables the above (default)
--bibliography=file     sets a bibliography file
--splitbibliography     splits the bibliography into pages per
initial.
--nosplitbibliography   disables the above (default)
--prescan               carries out only the split (if
enabled) and scan, storing
cross-referencing data in dbfile
(default is complete processing)
--dbfile=dbfile         sets file to store crossreferences
--sitedirectory=dir     sets the base directory of the site
--mathimages            converts math to images
(default for html4 format)
--nomathimages          disables the above
--mathsvg               converts math to svg images
--nomathsvg             disables the above
--mathimagemagnification=mag sets magnification factor
--presentationmathml    converts math to Presentation MathML
(default for xhtml & html5 formats)
--pmml                  alias for --presentationmathml
--nopresentationmathml  disables the above
--linelength=n          formats presentation mathml to a
linelength max of n characters
--contentmathml         converts math to Content MathML
--nocontentmathml       disables the above (default)
--cmml                  alias for --contentmathml
--openmath              converts math to OpenMath
--noopenmath            disables the above (default)
--om                    alias for --openmath
--keepXMath             preserves the intermediate XMath
representation (default is to remove)
--mathtex               adds TeX annotation to parallel markup
--nomathtex             disables the above (default)
--plane1                use plane-1 unicode for symbols
(default, if needed)
--noplane1              do not use plane-1 unicode
--graphicimages         converts graphics to images (default)
--nographicimages       disables the above
--graphicsmap=type.type specifies a graphics file mapping
--pictureimages         converts picture environments to
images (default)
--nopictureimages       disables the above
--svg                   converts picture environments to SVG
--nosvg                 disables the above (default)


If xmlfile is ’-’, latexmlpost reads the XML from standard input.

## Options & Arguments

### General Options

--verbose

Requests informative output as processing proceeds. Can be repeated to increase the amount of information.

--VERSION

Shows the version number of the LaTeXML package..

--help

Shows this help message.

### Source Options

--sourcedirectory=source

Specifies the directory where the original latex source is located. Unless latexmlpost is run from that directory, or it can be determined from the xml filename, it may be necessary to specify this option in order to find graphics and style files.

--validate, --novalidate

Enables (or disables) the validation of the source XML document (the default).

### Format Options

--format=(html|html5|html4|xhtml|xml)

Specifies the output format for post processing. By default, it will be guessed from the file extension of the destination (if given), with html implying html5, xhtml implying xhtml and the default being xml, which you probably don’t want.

The html5 format converts the material to html5 form with mathematics as MathML; html5 supports SVG. html4 format converts the material to the earlier html form, version 4, and the mathematics to png images. xhtml format converts to xhtml and uses presentation MathML (after attempting to parse the mathematics) for representing the math. html5 similarly converts math to presentation MathML. In these cases, any graphics will be converted to web-friendly formats and/or copied to the destination directory. If you simply specify html, it will treat that as html5.

For the default, xml, the output is left in LaTeXML’s internal xml, but the math is parsed and converted to presentation MathML. For html, html5 and xhtml, a default stylesheet is provided, but see the --stylesheet option.

--destination=destination

Specifies the destination file and directory. The directory is needed for mathimages, mathsvg and graphics processing.

--omitdoctype, --noomitdoctype

Omits (or includes) the document type declaration. The default is to include it if the document model was based on a DTD.

--numbersections, --nonumbersections

Includes (default), or disables the inclusion of section, equation, etc, numbers in the formatted document and crossreference links.

--stylesheet=xslfile

Requests the XSL transformation of the document using the given xslfile as stylesheet. If the stylesheet is omitted, a ‘standard’ one appropriate for the format (html4, html5 or xhtml) will be used.

--css=cssfile

Adds cssfile as a css stylesheet to be used in the transformed html/html5/xhtml. Multiple stylesheets can be used; they are included in the html in the order given, following the default ltx-LaTeXML.css (unless --nodefaultcss). The stylesheet is copied to the destination directory, unless it is an absolute url.

Some stylesheets included in the distribution are –css=navbar-left Puts a navigation bar on the left. (default omits navbar) –css=navbar-right Puts a navigation bar on the left. –css=theme-blue A blue coloring theme for headings. –css=amsart A style suitable for journal articles.

--javascript=jsfile

Includes a link to the javascript file jsfile, to be used in the transformed html/html5/xhtml. Multiple javascript files can be included; they are linked in the html in the order given. The javascript file is copied to the destination directory, unless it is an absolute url.

--icon=iconfile

Copies iconfile to the destination directory and sets up the linkage in the transformed html/html5/xhtml to use that as the ”favicon”.

--nodefaultresources

Disables the copying and inclusion of resources added by the binding files; This includes CSS, javascript or other files. This does not affect resources explicitly requested by the --css or --javascript options.

--timestamp=timestamp

Provides a timestamp (typically a time and date) to be embedded in the comments by the stock XSLT stylesheets. If you don’t supply a timestamp, the current time and date will be used. (You can use --timestamp=0 to omit the timestamp).

--xsltparameter=name:value

Passes parameters to the XSLT stylesheet. See the manual or the stylesheet itself for available parameters.

### Site & Crossreferencing Options

--split, --nosplit

Enables or disables (default) the splitting of documents into multiple ‘pages’. If enabled, the the document will be split into sections, bibliography, index and appendices (if any) by default, unless --splitpath is specified.

--splitat=unit

Specifies what level of the document to split at. Should be one of chapter, section (the default), subsection or subsubsection. For more control, see --splitpath.

--splitpath=xpath

Specifies an XPath expression to select nodes that will generate separate pages. The default splitpath is //ltx:section | //ltx:bibliography | //ltx:appendix | //ltx:index

Specifying

  --splitpath="//ltx:section | //ltx:subsection
| //ltx:bibliography | //ltx:appendix | //ltx:index"


would split the document at subsections as well as sections.

--splitnaming=(id|idrelative|label|labelrelative)

Specifies how to name the files for subdocuments created by splitting. The values id and label simply use the id or label of the subdocument’s root node for it’s filename. idrelative and labelrelative use the portion of the id or label that follows the parent document’s id or label. Furthermore, to impose structure and uniqueness, if a split document has children that are also split, that document (and it’s children) will be in a separate subdirectory with the name index.

--scan, --noscan

Enables (default) or disables the scanning of documents for ids, labels, references, indexmarks, etc, for use in filling in refs, cites, index and so on. It may be useful to disable when generating documents not based on the LaTeXML doctype.

--crossref, --nocrossref

Enables (default) or disables the filling in of references, hrefs, etc based on a previous scan (either from --scan, or --dbfile) It may be useful to disable when generating documents not based on the LaTeXML doctype.

--urlstyle=(server|negotiated|file)

This option determines the way that URLs within the documents are formatted, depending on the way they are intended to be served. The default, server, eliminates unneccessary trailing index.html. With negotiated, the trailing file extension (typically html or xhtml) are eliminated. The scheme file preserves complete (but relative) urls so that the site can be browsed as files without any server.

Generates a table of contents in the navigation bar; default is none. The ‘context’ style of TOC, is somewhat verbose and reveals more detail near the current page; it is most suitable for navigation bars placed on the left or right. Other styles of TOC should be developed and added here, such as a short form.

--index, --noindex

Enables (default) or disables the generation of an index from indexmarks embedded within the document. Enabling this has no effect unless there is an index element in the document (generated by $\backslash$printindex).

--splitindex, --nosplitindex

Enables or disables (default) the splitting of generated indexes into separate pages per initial letter.

--bibliography=pathname

Specifies a bibliography generated from a BibTeX file to be used to fill in a bibliography element. Hand-written bibliographies placed in a thebibliography environment do not need this. The option has no effect unless there is an bibliography element in the document (generated by $\backslash$bibliography).

Note that this option provides the bibliography to be used to fill in the bibliography element (generated by $\backslash$bibliography); latexmlpost does not (currently) directly process and format such a bibliography.

--splitbibliography, --nosplitbibliography

Enables or disables (default) the splitting of generated bibliographies into separate pages per initial letter.

--prescan

By default latexmlpost processes a single document into one (or more; see --split) destination files in a single pass. When generating a complicated site consisting of several documents it may be advantageous to first scan through the documents to extract and store (in dbfile) cross-referencing data (such as ids, titles, urls, and so on). A later pass then has complete information allowing all documents to reference each other, and also constructs an index and bibliography that reflects the entire document set. The same effect (though less efficient) can be achieved by running latexmlpost twice, provided a dbfile is specified.

--dbfile=file

Specifies a filename to use for the crossreferencing data when using two-pass processing. This file may reside in the intermediate destination directory.

--sitedirectory=dir

Specifies the base directory of the overall web site. Pathnames in the database are stored in a form relative to this directory to make it more portable.

### Math Options

These options specify how math should be converted into other formats. Multiple formats can be requested; how they will be combined depends on the format and other options.

--mathimages, --nomathimages

Requests or disables the conversion of math to images (png by default). Conversion is the default for html4 format.

--mathsvg, --nomathsvg

Requests or disables the conversion of math to svg images.

--mathimagemagnification=factor

Specifies the magnification used for math images (both png and svg), if they are made. Default is 1.75.

--presentationmathml, --nopresentationmathml

Requests or disables conversion of math to Presentation MathML. Conversion is the default for xhtml and html5 formats.

--linelength=number

(Experimental) Line-breaks the generated Presentation MathML so that it is no longer than number ‘characters’.

--plane1

Converts the content of Presentation MathML token elements to the appropriate Unicode Plane-1 codepoints according to the selected font, when applicable (the default).

--hackplane1

Converts the content of Presentation MathML token elements to the appropriate Unicode Plane-1 codepoints according to the selected font, but only for the mathvariants double-struck, fraktur and script. This gives support for current (as of August 2009) versions of Firefox and MathPlayer, provided a sufficient set of fonts is available (eg. STIX).

--contentmathml, --nocontentmathml

Requests or disables conversion of math to Content MathML. Conversion is disabled by default. Note that this conversion is only partially implemented.

--openmath

Requests or disables conversion of math to OpenMath. Conversion is disabled by default. Note that this conversion is only partially implemented.

--keepXMath

By default, when any of the MathML or OpenMath conversions are used, the intermediate math representation will be removed; this option preserves it; it will be used as secondary parallel markup, when it follows the options for other math representations.

### Graphics Options

--graphicimages, --nographicimages

Enables (default) or disables the conversion of graphics to web-appropriate format (png).

--graphicsmap=sourcetype.desttype

Specifies a mapping of graphics file types. Typically, graphics elements specify a graphics file that will be converted to a more appropriate file target format; for example, postscript files used for graphics with LaTeX will be converted to png format for use on the web. As with LaTeX, when a graphics file is specified without a file type, the system will search for the most appropriate target type file.

When this option is used, it overrides and replaces the defaults and provides a mapping of sourcetype to desttype. The option can be repeated to provide several mappings, with the earlier formats preferred. If the desttype is omitted, it specifies copying files of type sourcetype, unchanged.

The default settings is equivalent to having supplied the options:

  --graphicsmap=svg
--graphicsmap=png
--graphicsmap=gif
--graphicsmap=jpg
--graphicsmap=jpeg
--graphicsmap=eps.png
--graphicsmap=ps.png
--graphicsmap=ai.png
--graphicsmap=pdf.png


The first formats are preferred and used unchanged, while the latter ones are converted to png.

--pictureimages, --nopictureimages

Enables (default) or disables the conversion of picture environments and pstricks material into images.

--svg, --nosvg

Enables or disables (default) the conversion of picture environments and pstricks material to SVG.