Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

Fonts for Mozilla's MathML engine

Fonts with appropriate Unicode coverage and Open Font Format features are required for good math rendering. This wiki page describes how users can install and use such math fonts with Mozilla's MathML engine. Note that most of these instructions may as well apply to other Web rendering engines.

Installation Instructions

Windows

Install the Latin Modern Math and STIX fonts as follows:

  1. Download latinmodern-math-1959.zip.
  2. Open the ZIP archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. You will find a latinmodern-math font file.
  3. Open the latinmodern-math font file and click the Install button.
  4. Download STIXv1.1.1-word.zip.
  5. Open the ZIP archive, move inside the Fonts directory and then inside the STIX-Word directory. You will find the STIXMath-Regular, STIX-Regular, STIX-Bold, STIX-Italic, STIX-BoldItalic font files.
  6. Open the STIXMath-Regular font file and click the Install button. If desired, you may also do the same for the other font files.

Note: Cambria Math is installed by default on Windows 7 and later versions and should ensure relatively good MathML rendering. An enhancement request has been submitted to Microsoft to install Latin Modern Math and STIX by default.

OS X

Install the Latin Modern Math and STIX fonts as follows:

  1. Download latinmodern-math-1959.zip.
  2. Extract the ZIP archive, move inside the latinmodern-math-1959 directory and then inside the otf directory. You will find a latinmodern-math font file.
  3. Double-click the latinmodern-math font file click the "Install the font" button from the window that opens.
  4. Download STIXv1.1.1-word.zip.
  5. Open the ZIP archive, move inside the Fonts directory and then inside the STIX-Word directory. You will find the STIXMath-Regular, STIX-Regular, STIX-Bold, STIX-Italic, STIX-BoldItalic font files.
  6. Open the STIXMath-Regular font file and click the "Install the font" button from the window that opens. If desired, you may also do the same for the other font files.

Note: A deprecated version of STIX is preinstalled starting with OS X Lion and should ensure relatively good MathML rendering. Enhancement requests have been submitted to Apple to ship OpenType MATH fonts in the default installation. If you have a developer account, these are problems 16841023 and 17021145.

Linux

Install the Latin Modern Math, STIX or XITS fonts, which are generally available from your package manager.

On Debian/Ubuntu/Mint and other Debian-based distributions, use the following command:

sudo apt-get install fonts-lmodern fonts-stix

On Fedora and other Fedora-based distributions, use the following command (stix-math-fonts is often already installed):

sudo dnf install texlive-lm-math stix-math-fonts

On openSUSE and other openSUSE-based distributions, use the following command:

sudo zypper install texlive-lm-math stix-fonts

On other Linux distributions, consider installing appropriate texlive packages, which includes Latin Modern Math and XITS:

sudo pacman -S texlive-core texlive-fontsextra # Arch Linux
sudo urpmi texlive-dist texlive-fontsextra # Mageia

However, you might need to ensure that the fonts are known by your system. Typically,  use a fontconfig configuration /etc/fonts/conf.avail/09-texlive-fonts.conf that points to the opentype directory of TeXLive, such as

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/your/path/to/texmf-dist/fonts/opentype</dir>
</fontconfig>

Finally, add this configuration file to the system font location list and regenerate the fontconfig cache:

ln -sf /etc/fonts/conf.avail/09-texlive-fonts.conf /etc/fonts/conf.d/
fc-cache -sf

Android

You must use the MathML-fonts add-on.

Note: There is an enhancement request opened on the Noto bug tracker to improve math support.

Firefox OS

You must use the MathML-fonts add-on.

Note: We plan to bundle a MATH font in the default installation.

Other systems

On other systems, consider installing a MATH font using your package manager. Note that these fonts are generally delivered with TeX distributions such as TeX Live, but you might need to follow specific instructions so that your system is aware of the fonts. As a last resort, install the MathML fonts add-on.

Advanced setup

Arabic Mathematical Alphabetic Symbols

Currently, very few fonts have appropriate glyphs for the Arabic Mathematical Alphabetic Symbols. If you are likely to need these characters, we recommend to install the XITS or Amiri fonts.

Installation without Administrator Privilege

If you need to install fonts on a system without adminstrator privilege, the easiest option is to use math font the MathML-fonts add-on. Note that using the add-on is not optimal since it forces your Gecko browser to load a CSS stylesheet on each page you visit as well as Web math fonts on all pages with MathML content. A better alternative on UNIX systems is to install the OTF files for Latin Modern Math and STIX into some local font folder and (if necessary) to run fc-cache on it. On OS X and Linux, the standard paths are ~/Library/Fonts/ and ~/.fonts.

Fonts with a MATH table

You can actually render MathML using any font with a MATH table and related Open Font Format features. A list of such math fonts is provided below. You can use the advanced font preference menu to configure the default font for mathematics. Alternatively, you can try the MathML-fontsettings add-on.

Using mathematical fonts on Web pages

Starting with Gecko 31.0 (Firefox 31.0 / Thunderbird 31.0 / SeaMonkey 2.28), it is now easy to set up the CSS style (and optional WOFF fonts) to use on your Web site. See the Authoring MathML page for details and try the MathML Torture Test. You can use FontForge and FontTools to edit the MATH table and create your own mathematical fonts.

Document Tags and Contributors

Tags: 
 Contributors to this page: fred.wang, auscompgeek, trevorh, raniere, mc10, fscholz, wgianopoulos, Sheppy
 Last updated by: fred.wang,