4.2 latexmlpost Customization

§ 4.2.2 CSS

CSS stylesheets can be supplied to latexmlpost to be included in the generated documents in addition to, or as a replacement for, the standard stylesheet LaTeXML.css. See the directory installationdir/LaTeXML/style/ for samples.

To best take advantage of this capability so as to design CSS rules with the correct specificity, the following points are helpful:

  • LaTeXML converts the TeX to its own schema, with structural elements (like equation) getting their own tag; others are transformed to something more generic, such as note. In the latter case, a class attribute is often used to distinguish. For example, a \footnote generates

      <note class=’footnote’>

    whereas an \endnote generates

      <note class=’endnote’>
  • The provided XSLT stylesheets transform LaTeXML’s schema to XHTML, generating a combined class attribute consisting of any class attributes already present as well as the LaTeXML tag name. However, there are some variations on the theme. For example, LaTeX’s \section yeilds a LaTeXML element section, with a title element underneath. When transformed to XHTML, the former becomes a <div class=’section’>, while the latter becomes <h2 class=’section-title’> (for example, the h-level may vary with the document structure),

Mode begin and end

For most elements, once the main html element has been opened and the primary attributes have been added but before any content has been added, a template with mode begin is called; thus it can add either attributes or content. Just before closing the main html element, a template with mode end is called.

Computing class and style

Templates with mode classes and styling.