LaTeXML The Manual

Appendix K CSS Classes

When the target format is in the HTML family (XHTML, HTML or HTML5), LaTeXML adds various classes to the generated html elements. This provides a trail back to the originating markup, and leverage to apply CSS styling to the results. Recall that the class attribute is a space-separated list of class names. This appendix describes the class names used.

The basic strategy is the following:


with element being the LaTeXML element name that generated the html element. These elements reflect the original TeX/LaTeX markup, but are not identical. See Appendix I for details.


where font can indicate any of the font characteristics:


: serif, sansserif, typewriter, caligraphic, fraktur, script;


: bold, medium;


: upright, italic, slanted, smallcaps;

These sets are open-ended.


where alignment indicates the alignment of the contents within the element.


: left, right, center, justify;


: top, bottom, baseline, middle.


indicates single or double borders on an element with edges being: t, r, b, l, tt, rr, bb, ll; these are typically used for table cells.


reflects the distinct uses a particular LaTeXML elements serve which is indicated by the role attribute. Examples include creator, for ‘document creators’, where the role may be author, editor, translator or others. Thus, depending on your purposes and the expected markup, you might choose to write CSS rules for ltx_creator or ltx_role_author. Similarly, quote is stretched to accomodate translation or verse.


marks the titles of various sectional units. For example, a chapter’s title will have two classes: ltx_title and ltx_title_chapter.


marks various types of ‘theorem-like’ objects, where the type is whatever was used in \newtheorem.


marks various types of floating objects, such as might be defined using the float package using \newfloat.


reflects the various roles of items within listings, such as those created using the listings package (whose containing element would have class ltx_lstlisting). Such classes include: ltx_lst_language_lang, ltx_lst_keywordclass, ltx_lxt_line, ltx_lst_linenum.


indicates various items in bibliographys, typically generated via BibTeX; the items include key, number, type, author, editor, year, title, author-year, edition, series, part, journal, volume, number, status, pages, language, publisher, place, status, crossref, external, cited and others.

ltx_toclist_type, ltx_tocentry_type

reflects the levels of Table of Contents lists: they carry the ltx_toclist class, from the element used to represent them, and also ltx_toclist_section naming the sectional unit for which this list applies to assist in styling. A nested TOC for a chapter might thus have ul’s carrying ltx_toclist_chapter and ltx_toclist_section. Additionally, ltx_toc_compact and ltx_toc_verycompact can be added to style compact and very compact styles (eg single line). Note that the generated li items will have class ltx_tocentry and ltx_tocentry_type, for the type of the entry.


hypertext links, whether within or across documents, whether created from \ref or \href, will get ltx_ref and, sometimes, extra classes applied. For example, a reference that ends up pointing to the current page is marked with ltx_ref_self. Cross-referencing material used to fill-in the contents of the reference is marked: a reference number gets ltx_ref_tag; a title ltx_ref_title.


reflects the separate parts of notes; Note that the kind of note is generally reflected in the role attribute, such as footnote, endnote, etc. The parts are separated to facilitate formatting, hover effects, etc: outer contains the whole; mark for the mark, if any; content the actual contents of the note. type is for an extra span indicating the type of note if it is unusual.


reflects page layout components created during the XSLT; items include: main, content, header, footer, navbar logo, columns, column1, column2.


reflects different parts related to equation formatting: pad reflects padding to align equations on the page; eqnarray and lefteqn arise from LaTeX’s eqnarray environment; gather and align arise from AMS environments; intertext arises from text injected between aligned equations.

Any other explicit use of the addClass(class) function or of the \lxAddClass{class} macro from the latexml package will add the given class as is, without any additional ltx_ prefix.

Two oddball items that may get refactored away are: ltx_phantom and ltx_centering. The latter seems slightly distinct from ltx_align_center.