Fonts for MathML
Fonts with appropriate Unicode coverage and Open Font Format features are required for good math rendering. This page describes how users can install such math fonts to properly display MathML in browsers.
Installation instructions
As a general rule of thumb, it is recommended to install both Latin Modern Math (which uses Computer Modern style popular for math formulas) and STIX Two Math (which has large unicode coverage for scientific characters). In the next sections, you will find detailed instructions to install these fonts in various operating systems.
Windows
Install the Latin Modern Math and STIX Two Math fonts as follows:
- Download latinmodern-math-1959.zip.
- Open the ZIP archive, move inside the
latinmodern-math-1959
directory and then inside theotf
directory. You will find alatinmodern-math
font file. - Open the
latinmodern-math
font file and click the Install button. - Download static_otf.zip.
- Open the
static_otf.zip
ZIP archive, and then move inside thestatic_otf
directory. Among the files there, you will find aSTIXTwoMath-Regular
file. - Open the
STIXTwoMath-Regular
file and click the Install button. If desired, you may also do the same for the other font files in the directory.
Note: Cambria Math is installed by default on Windows and should ensure relatively good MathML rendering.
macOS
Install the Latin Modern Math font as follows:
- Download latinmodern-math-1959.zip.
- Extract the ZIP archive, move inside the
latinmodern-math-1959
directory and then inside theotf
directory. You will find alatinmodern-math
font file. - Double-click the
latinmodern-math
font file click the Install font button from the window that opens.
Note: If you are using macOS Ventura (version 13) or higher, then STIX Two Math is already pre-installed and you can skip the steps below.
Install the STIX Two Math font as follows:
- Download static_otf.zip.
- Open the
static_otf.zip
ZIP archive, and then move inside thestatic_otf
directory. Among the files there, you will find aSTIXTwoMath-Regular.otf
file. - Open the
STIXTwoMath-Regular.otf
file and click the Install Font button from the window that opens. If desired, you may also do the same for the other font files in the directory.
Note: A deprecated version of STIX is preinstalled starting with OS X Lion (version 10.7). Although some browsers are able to make use of it, it is strongly recommended to follow the instructions above for optimal math rendering.
Linux
Below, you can find commands to execute on popular Linux distributions in order to install the Latin Modern Math and STIX Two Math fonts from your package manager. Alternative approaches are also provided if your Linux distribution does not provide dedicated packages for these fonts.
Debian-based distributions (including Ubuntu and Mint)
bash
sudo apt-get install fonts-lmodern fonts-stix
Fedora-based distributions
bash
sudo dnf install texlive-lm-math stix-math-fonts
openSUSE-based distributions
bash
sudo zypper install texlive-lm-math stix-fonts
Arch Linux
bash
sudo pacman -S otf-latinmodern-math otf-stix
TeXLive packages
If your Linux distribution does not provide packages for the Latin Modern Math and STIX fonts, consider instead installing the texlive
packages containing the Latin Modern Math and XITS fonts. For example on Mageia:
bash
sudo urpmi texlive-dist texlive-fontsextra
However, you will likely need to ensure that these fonts are known by your system. Add a fontconfig configuration /etc/fonts/conf.avail/09-texlive-fonts.conf
that points to the opentype
directory of TeXLive, such as:
xml
<?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:
bash
ln -sf /etc/fonts/conf.avail/09-texlive-fonts.conf /etc/fonts/conf.d/
fc-cache -sf
Upstream packages
If no packages are available on your Linux distributions, or if you just want to install upstream packages then try this:
- Download latinmodern-math-1959.zip and static_otf.zip.
- Create a
~/.fonts
if it does not exist already and placelatinmodern-math.otf
andSTIXTwoMath-Regular.otf
in that directory. - Run
fc-cache -f
to regenerate the fontconfig cache.
Android
You must use the MathML-fonts add-on.
Note: Noto Sans Math provides good Unicode coverage for math symbols and Google plans to add support for math layout features.
Other systems
On other systems, consider installing a font with a MATH table 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
In the next sections, you will find other useful tips for installation and configuration of fonts for MathML.
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 administrator 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 macOS and Linux, the standard paths are respectively ~/Library/Fonts/
and ~/.fonts
.
Fonts with a MATH table
You can actually install any mathematical OpenType font and use them for MathML rendering. Some browsers provide a way to configure the default font for MathML in their font preference menu. Alternatively, you can try the MathML-fontsettings add-on.