§ 4.1 LaTeXML Customization

This layer of customization deals with modifying the way a  document is transformed into ’s xml, primarily through defining the way that control sequences are handled. In 2.1 the loading of various bindings was described. The facilities described in the following subsections apply in all such cases, whether used to customize the processing of a particular document or to implement a new  package. We make no attempt to be comprehensive here; please consult the documentation for (LaTeXML::)Global and Package, as well as the binding files included with the system for more guidance.

A  binding is actually a Perl module, and as such, a familiarity with Perl is helpful. A binding file will look something like:

use LaTeXML::Package;
use strict;
use warnings;
# Your code here!
1;

The final ‘1’ is required; it tells Perl that the module has loaded successfully. In between, comes any Perl code you wish, along with the definitions and declarations as described here.

Actually, familiarity with Perl is more than merely helpful, as is familiarity with  and xml! When writing a binding, you will be programming with all three languages. Of course, you need to know the  corresponding to the macros that you intend to implement, but sometimes it is most convenient to implement them completely, or in part, in , itself (eg. using DefMacro), rather then in Perl. At the other end, constructors (eg. using DefConstructor) are usually defined by patterns of xml.