Manual: math fonts

In this article we’re figuring out how fonts for mathematical notation work and how mathematicians and designers work with them

July 25, 2024


Disclaimer In this piece, we often refer to mathematicians who write down formulas. By the term mathematicians we mean anyone who deals with mathematics in one way or another, which is physicists, chemists, software and web developers, architects, engineers, analysts, economists, cryptographers and other professionals.


1 A page from Aritmetica mercantile by Pietro Borghi, 1484. Image courtesy: Bayerische Staatsbibliothek


What is a math font and how is it different from a non-mathematical font?

Mathematical fonts are designed for typesetting complex formulas and equations and there is a huge number of special symbols in their character sets. Apart from those special glyphs, math fonts contain characters from basic Latin, Greek, the first four letters of the Hebrew alphabet, and numerals. If a font was designed to be used by mathematicians writing in Arabic, it also has to include Arabic characters.

(As mathematicians who write in, for example, Hebrew, Bulgarian or Georgian use Latin for mathematical notation, they can work with a math font that does not support these languages.)


2 Evaluation with Arabic glyphs and Eastern Arabic-Indic numerals


3 Evaluation with Latin glyphs and Western Arabic numbers


Unlike people who deal with text and write only from left to right (or right to left), mathematicians operate in two dimensions, vertical and horizontal, which means they also write from top to bottom, adding numerators and denominators. That is the reason why math fonts should include a number of brackets and square root signs of various heights (but not various weights).


4


A usual system of styles cannot be applied to math fonts: an А and an А within the same formula may have different meanings. That is why a math font usually has just one style. At the same time, math operators — which might have italic versions in certain non-math typefaces (+ =) — are always upright in math fonts.


6 Glyphs that can be both — upright and italic — in math fonts


7 Glyphs that can only be upright in math fonts


Mathematical accents work differently than the accents we’re used to. As a mathematical accent can be positioned above several characters at once, a math font needs to contain specially designed accents (to fit various amounts of characters).


8


Can I use a math font to set text?

Technically, you can. But if you type in a language other than English, the typeface might lack certain glyphs you need. Math fonts are also spaced for use in math equations where each symbol stands by itself, so math fonts will look badly spaced when used for texts. But math fonts are often designed as an extension to an already existing text family, so it should be easy to find a text pair for a math font.


9


Is there a special Unicode block for mathematical glyphs?

There is, and there is more than one. The first one to appear was the Letterlike Symbols. It has a total of just 80 characters while the largest of these blocks, Mathematical Alphanumeric Symbols, contains nearly 1,000 symbols, including, for instance, bold and regular Latin fraktur, a script, double-struck characters, and five types of numerals.

The symbols from these two blocks often get copied and pasted into profile descriptions on social media. Then there’s spammers who add them to their mailings to prevent the email client’s algorithms from recognizing text and moving the message to a spam folder.


10


There are six more Unicode blocks for representing functions and mathematical operations: two blocks of mathematical operators (U+2200–22FF and U+2A00–2AFF), two blocks of miscellaneous mathematical symbols (U+27C0–27EF and U+2980–29FF), arrows, and technical icons.


25


26


If the font is intended for mathematicians using Arabic, it also includes Arabic-Indic numerals and Arabic mathematical symbols (those two groups of characters are also stored in separate Unicode blocks).

Glyphs required in a math font are to be found in Basic Latin, Greek, supplementary basic Latin blocks (in the last mentioned block, math fonts need symbols for the simplest mathematical manipulations — for example, division and multiplication).

How can I tell a quality math font from a poor-quality one?

A quality typeface is supposed to address as many typographic challenges generated by mathematical notation as possible. For example, in formulas — as opposed to body text — it is often the case that an italic character is followed by an upright one. In this case, one needs to check if there is proper spacing or not.


11 Equation with italic spacing correction (left) and without it (right)


Characters to be used at a very small size (for example, in a formula where a superscript has a superscript) require optical compensation so as not to look lighter than the character they refer to.


12 Symbols optical compensations (left) and without them (right)
Image: Khaled Hosny (github)


The fraction line, brackets, and the font’s tallest characters (such as the integral symbol and the summation symbol) should be aligned at one axis. This axis is called the Math axis and is defined by the font.


13


An exponent and a subscript should not bump into each other even if a subscript is also raised to a power.


14


There needs to be an extra horizontal space to be used if a bracketed value ends with a power (to compensate for the power’s sidebearings).


15


For more information on how to design (or choose) a high quality math font, read a guide on building math fonts by Khaled Hosny.

How many glyphs should a math font contain?

There is no universally applicable list, as it all comes down to the tasks that any particular font needs to solve. The number of glyphs in such typefaces may vary from 1,000 to 6,000. (To put this in perspective, the Inter typeface supporting 550 languages features 2,547 glyphs). Visit the TeX documentation website to see an illustrative list of glyphs that TeX suggests to include in a math font.

TeX?

TeX is the most famous typesetting program used by mathematicians to write and publish their research papers. Typically, they install LaTeX on their machines — an extension package that uses the TeX typesetting program for formatting its output and makes working with math easier. Using a LaTeX editor (for example, Overleaf), one can split the window into two parts, for entering commands and seeing whether the tool properly converts them into formulas.


16 LaTeX code (left). Set in Cera Mono. Math equation (right). Set in Latin Modern Math


Is this something new?

Donald Knuth first released TeX in 1978 and a year later he released the first version of Metafont, a description language allowing to render and design fonts. In Metafont, the points defining the shapes of the glyphs were defined with geometrical equations. Hermann Zapf experimented a lot with this font description system and used it to design his typeface AMS Euler, while Jonathan Hoefler, on the contrary, criticised Knuth’s invention a lot.


AMS Euler. Images: Luc Devroye


Does LaTeX allow for choosing a font to typeset a formula in?

Theoretically speaking, yes. Although the font situation in TeX is very complicated. As TeX was developed long before OpenType, the original TeX requires an old and TeX-specific font metrics data format. One has to use newly developed systems like XeTeX and LuaTeX to use OpenType fonts (and OpenType math fonts).

So mathematicians use LaTeX as a notepad, right?

If a mathematician is doing calculations rather than preparing a paper for publication, they will most likely still do that on paper. People who deal with mathematics often introduce new variables while calculating, and it is much faster and easier to simply draw it by hand than to figure out whether it is available in a font and how to typeset it.


Mathematical workbook, 1801. Image courtesy: Kevin J. Roberts Antiques


Does a designer need to know how LaTeX works to create a layout with a large amount of formulas?

It all depends on the task. For example, you can design an annual report in InDesign without any knowledge of LaTeX, as the tool has a plugin for handling formulas. Figma has a plugin to add mathematical expressions but not for editing them. You can typeset complex mathematical notation in FigMath using either the virtual keyboard or a regular one (as TeX commands).

If you are a designer in a project with a blog or website powered on Mirror, which is an on-chain Notion analogue, then you will still have to master LaTeX.


24 InDesign math plugin


Does a developer need to know LaTeX to make up a site featuring a lot of formulas?

Developers normally use the MathJax JavaScript engine. It allows embedding LaTeX or MathML (Mathematical Markup Language, a markup language like HTML designed for dealing with mathematical notation) commands into the website layout. This is why earlier developers needed to have knowledge of one of those. It is now enough for them to understand how LaTeX or MathML work to adjust the code that AI can write for them.

Who designs math fonts?

As the process of designing a typeface of this kind is time-consuming and difficult, that’s mostly corporations who do that — for instance, Cambria Math was commissioned by Microsoft and Noto Sans Math was commissioned by Google. However, there are some independent projects that address math fonts, too. For example, Canada-based STIX (Scientific and Technical Information Exchange) whose goal was to make scientific information accessible to as many people as possible. The entire collection of STIX fonts is available for download for free in the project’s GitHub repository.

The Polish foundry GUST (Grupa Użytkowników Systemu TeX) develops typefaces designed specifically to be used in LaTeX — for example, they updated Computer Modern (the updated version is called Latin Modern) and distribute it under an open licence. An Egypt-based foundry Alif Type focuses on designing fonts for mathematicians who use Arabic.


Special thanks to Khaled Hosny for for invaluable inputs and review.


Bibliography

Mentioned fonts