AH Formatter MathML fonts on Linux

Inasmuch as AH Formatter supports MathML 3.0 but on Linux ships with a minimal font-config.xml file, if you are formatting non-trivial MathML on Linux, then you’ll probably need to add some mathematical fonts to your font-config.xml.

identity-matrixIf x2y2 counts as trivial because you could do it with “ordinary” fonts, then non-trivial would include anything requiring “stretchy” characters, such as the identity matrix example from the MathML 3.0 spec that is shown on the right rendered without and with mathematical fonts. AH Formatter on Linux uses the STIX fonts by default, so the simplest way to get your MathML rendering correctly is to make sure that the STIX fonts are installed and that AH Formatter will use them.

The STIX fonts are included in some Linux distributions, and they are installed by default in some more recent Linux distributions. For example: on CentOS 7, they are installed by default in /usr/share/fonts/stix; on an older Xubuntu system, they are available as an optional “fonts-stix” package that installs in /usr/share/fonts/opentype/stix; but on CentOS 5, they are not installed, and the yum package manager doesn’t have them available as a package. If you can’t install them through your package manager, you can download them from the STIX Font Project’s SourceForge download page at http://sourceforge.net/projects/stixfonts/files/Current%20Release/ and then install at least the OpenType files.

Once you have the fonts installed, you just need to tell AH Formatter where to find them by adding a font-folder element for the directory containing the STIX fonts to your font-config.xml file (usually /usr/AHFormatterV63_64/etc/font-config.xml). For example, for CentOS 7:

<font-folder path="/usr/share/fonts/stix" />

Once that’s done, your mathematical characters will have gained a new dimension.