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.
In this article
Installation instructions
As a general rule of thumb, it is recommended to install bothLatin Modern Math (which usesComputer Modern style popular for math formulas) andSTIX 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 theLatin Modern Math andSTIX Two Math fonts as follows:
- Downloadlatinmodern-math-1959.zip.
- Open the ZIP archive, move inside the
latinmodern-math-1959directory and then inside theotfdirectory. You will find alatinmodern-mathfont file. - Open the
latinmodern-mathfont file and click theInstall button. - Downloadstatic_otf.zip.
- Open the
static_otf.zipZIP archive, and then move inside thestatic_otfdirectory. Among the files there, you will find aSTIXTwoMath-Regularfile. - Open the
STIXTwoMath-Regularfile and click theInstall 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 theLatin Modern Math font as follows:
- Downloadlatinmodern-math-1959.zip.
- Extract the ZIP archive, move inside the
latinmodern-math-1959directory and then inside theotfdirectory. You will find alatinmodern-mathfont file. - Double-click the
latinmodern-mathfont file click theInstall font button from the window that opens.
Note:If you are using macOS Ventura (version 13) or higher, thenSTIX Two Math is already pre-installed and you can skip the steps below.
Install theSTIX Two Math font as follows:
- Downloadstatic_otf.zip.
- Open the
static_otf.zipZIP archive, and then move inside thestatic_otfdirectory. Among the files there, you will find aSTIXTwoMath-Regular.otffile. - Open the
STIXTwoMath-Regular.otffile and click theInstall 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 ofSTIX 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 distributionsin order to install theLatin Modern Math andSTIX Two Math fonts from yourpackage manager. Alternative approaches are also provided if your Linuxdistribution does not provide dedicated packages for these fonts.
Debian-based distributions (including Ubuntu and Mint)
sudo apt-get install fonts-lmodern fonts-stixFedora-based distributions
sudo dnf install texlive-lm-math stix-math-fontsopenSUSE-based distributions
sudo zypper install texlive-lm-math stix-fontsArch Linux
sudo pacman -S otf-latinmodern-math otf-stixTeXLive packages
If your Linux distribution does not provide packages for theLatin Modern Math andSTIX fonts, consider instead installing thetexlive packages containing theLatin Modern Math andXITS fonts. For example on Mageia:
sudo urpmi texlive-dist texlive-fontsextraHowever, 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 theopentype 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 -sfUpstream packages
If no packages are available on your Linux distributions, or if you just want to install upstream packages then try this:
- Downloadlatinmodern-math-1959.zip andstatic_otf.zip.
- Create a
~/.fontsif it does not exist already and placelatinmodern-math.otfandSTIXTwoMath-Regular.otfin that directory. - Run
fc-cache -fto regenerate the fontconfig cache.
Android
You must use theMathML-fonts add-on.
Noto Sans Math provides good Unicode coverage for math symbols andmath layout.
Other systems
On other systems, consider installing afont with a MATH table using your package manager. Note that these fonts are generally delivered with TeX distributions such asTeX Live, but you might need to follow specific instructions so that your system is aware of the fonts. As a last resort, install theMathML fonts add-on.
Advanced setup
In the next sections, you will find other useful tips for installation andconfiguration 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 theXITS orAmiri 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 theMathML-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 forLatin Modern Math andSTIX into some local font folder and (if necessary) to runfc-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 anymathematical 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 theMathML Font Settings add-on.