Chapter 4 Customization

The processsing of the  document, its conversion into xml and ultimately to xhtml or other formats can be customized in various ways, at different stages of processing and in different levels of complexity. Depending on what you are trying to achieve, some approaches may be easier than others: Recall Larry Wall’s adage “There’s more than one way to do it.”

By far, the easiest way to customize the style of the output is by modifying the CSS, see 4.2.2, so that is the recommended way when it applies.

The basic conversion from  markup to xml is done by latexml, and is obviously affected by the mapping between the  markup and the xml markup. This mapping is defined by macros, primitives and, of course, constructors; The mapping that is in force at any time is determined by the -specific implementations of the  packages involved, what we call ‘bindings’. Consequently, you can customize the conversion by modifying the bindings used by latexml.

Likewise, you extend latexml by creating bindings for  styles that hadn’t been covered.

Or by defining your own  style file along with it’s  binding.

In all these cases, you’ll need the same skills: understanding and using text, tokens, boxes and whatsits, as well as macros and macro expansion, primitives and digestion, and finally whatsits and constructors. Understanding  helps; reading the  bindings in the distribution will give an idea of how we use it. To teach  about new macros, to implement bindings for a package not yet covered, or to modify the way  control sequences are converted to xml, you will want to look at 4.1. To modify the way that xml is converted to other formats such as html, see 4.2.

A particularly powerful strategy when you have control over the source documents is to develop a semantically oriented  style file, say smacros.sty, and then provide a  binding as smacros.sty.ltxml. In the  version, you may style the terms as you like; in the  version, you could control the conversion so as to preserve the semantics in the xml. If ’s schema is insufficient, then you would need to extend it with your own representation; although that is beyond the scope of the current manual, see the discussion below in 4.1.4. In such a case, you would also need to extend the xslt stylesheets, as discussed in 4.2.1.