# Is there a perfect maths font?

Let’s print your thesis in Comic Sans

Cauchy integral formula in three fonts

It’s decision time. Three, maybe four years of painstaking work have come down to this moment. You’re about to print your thesis. But before you click ‘print’, you have an important choice: What font should I pick?

Have a look at the three choices in the banner above. Can you pick a favourite? Which is the worst? What if you’re writing a school textbook: do you want something formal or friendly? Familiar or bespoke?

If we are to find our perfect maths font, we first have to examine the challenges we face when we try to print mathematics.

### Why type designers have their work cut out for them

Mathematics lives in a special world for typesetting (the name of the process given to putting letters on pages), thanks to its multitude of symbols and odd placements. Not only that, but good mathematics is about clear communication. I like to think of fonts as the accent of a piece of writing, setting the tone for what you’re saying, so you don’t want to confuse your reader by effectively saying it in a weird accent or mispronouncing the odd word.

You might think that it’s not that difficult to typeset mathematics: surely you just choose the appropriate size of an existing font and put the characters in the correct places. But there’s a lot more to it than that. Some things you might want to consider when using a font for mathematics:

Compare a-alpha-v-nu in, (a) Times New Roman, (b) XITS, a version of Times New Roman for maths, (c) Computer Modern, the default typeface in LaTeX, (d) Arial

• Are the letters distinct from each other? (see the comparisons between a-alpha-v-nu on the right)
• Do the letters look like what you expect them to? (is your phi going to look like $\phi$ or $\varphi$?)
• Can you read small characters clearly? (compare x2/x²/$x^2$)
• Does the maths fit well with the text?

#### Text v maths

When designing a font for text, a common consideration is kerning: how well certain letters fit together. Modern word processors have keming algorithms into them, even sometimes applying ligatures: special combinations of letters that naturally occur together. Most fonts have an ‘fi’ ligature, so let’s look at an example in Times New Roman.

The letters ‘fit’ in italic Times New Roman, (a) with ligatures, (b) without ligatures, (c) with extra spacing, (d) in a special mathematics version (“XITS”)

The second example is Times New Roman’s natural italic, which has an awkward bumping at the top between the tops of the ‘f’ and ‘i’. The use of a nice ligature (the first example) makes the word look neater. Of course, in mathematics, this would be terrible! In algebra, each letter has a separate meaning: combining them into one symbol would be especially confusing. In fact, we want to go the other way, spacing the letters out so they definitely don’t touch! Doing so gives us the third example, but then notice how the ‘f’ looks especially wide? The use of an adapted Times New Roman for maths, XITS, gives us an ‘f’ which is tucked in more neatly at the ends, making it stronger as an individual letter than as part of a word.

Open wide, say “aaaaaaaa”: all these letters have different meanings

#### Say aaaaaaaa

When designing a typeface, you design not just one font but many: you need an italic, a bold, a bold-italic, and maybe more: a typeface is a family of fonts. In maths, matters of style require that certain types of variables are typed in a certain way. For example, the international standard suggests that

• variables should be italic,
• functions should be upright (roman),
• vectors should be bold italic,
• tensors should be sans-serif bold italic.

Take a look at the eight ‘a’s to the right. The different styles (fonts) all mean different things! So not only is it important that we have all the variants, it’s also important that they are clearly distinct.

### Can a font be convincing?

The survey found Baskerville to be the most agreeable, and least disagreeable font. (Graph from data, when compared to Trebuchet)

In 2012, documentary filmmaker Errol Morris, with psychology professor David Dunning, ran an experiment on the New York Times website, presenting visitors with a claim about the Earth’s safety from asteroid collisions and asking them to state whether they believed the claim to be true. Unknown to the visitors, the claim was presented in one of six fonts, chosen randomly. Would visitors be more likely to believe some text just because it was written in a certain font?

The results were interesting: if you agreed, you would agree most strongly with Baskerville, a traditional serif typeface, most seen in old books. And if you disagreed, you agreed least strongly with… Baskerville. The worst-performing was, perhaps unsurprisingly, Comic Sans.

Almost as agreeable as Baskerville was Computer Modern, the default typeface of the typesetting system LaTeX. When asked to comment on these results, Dunning suggested that Baskerville had a form of ‘gravitas’ that the others lacked. But what gives a fonts its gravitas? Is it inherent, or is it inherited from its uses?

### Beautiful mathematics

Here are samples from six different typesetting systems:

You’re seeing the output of six systems using different fonts:

1. Official Chalkdust font editor’s handwriting, using black Parker fountain pen on the back of a page-a-day ‘365 stupidest things ever said’ calendar,
2. Professional typesetting, from a 1954 UCL maths exam paper,
3. Typewriter, from a 1985 exam paper, in a monospaced font,
4. Microsoft’s pre-2007 equation editor, using Times New Roman,
5. Microsoft’s post-2007 equation editor, using Cambria Math,
6. LaTeX, using Computer Modern.

#### Early days

The printing press (Source)

For many years, it was very difficult to type mathematics in a neat way without resorting to professional typesetting services. Until the late 1970s, it was typical for academics to handwrite their articles, and send it off to the publishers to be put together there. The output, as you can see in sample 2, is beautiful. Individual characters were chosen from metal cases, slotted together carefully, before being lightly coated with ink and stamped onto paper. The care of the typesetter was clear, but it led to a high number of mathematical typos, as they weren’t necessarily mathematically trained. This isn’t unreasonable: imagine being asked to typeset, by hand, a page of Russian!

The takeover of the typewriter meant that academics could start producing professional-looking, typewritten texts in-house. Suddenly everything is much cheaper; instead of giving the handwritten script to a possibly mathematically-illiterate printing house, you could give it to your secretary to type up. The quality of papers from a mathematical typo perspective increased greatly, but look what they produced in sample 3. Isn’t it awful?! There was only one font, and one font size (look at that terrible sigma). Spacing was a constant fudge, and if you wanted a more obscure symbol (possibly even a Greek letter on some machines), you’d have to handwrite it in. Ugly stuff.

Things didn’t really improve until desktop computers came along. Jumping ahead a few years, Microsoft Word has included an equation editor since 1992, but until 2007, it was incredibly poor and clunky to use, choosing to take fonts for text, and merely resizing them to put them in their place. See how in sample 4, the summation symbol is far thicker than the rest, and the ‘2’ is so high above the ‘n’?  This is because Times New Roman, as we’ve seen, isn’t by default optimised for maths. By bringing it down, as samples 5 and 6 do, you keep readability without creating an unbalanced equation. And look at the first sample in the Cauchy integral equations at the top of this blog (they use the systems from samples 4–6): the integral sign is far too small, and the circle is off-centre! Poor show.

#### Bastion of truth

A typical LaTeX experience: code on the left, output on the right

Now look to sample 6. Scientists have used the LaTeX typesetting system (and its earlier version, TeX) since the early 1980s. It’s code-based, so you write your document using lots of commands around your text, but its users say you get used to it, and that it’s worth it for its beautiful output. You can even write an excellent mathematics magazine in it. In the example above, do you see how the ‘1’ under the summation symbol is squatter than the ‘1’ on top of the fraction? It’s not just smaller; it’s fatter, keeping its width for legibility so that it remains small but not out-of-place with the rest of the symbols.

Due to its ubiquity and excellence in printing mathematics, Computer Modern, the default font LaTeX uses, is the face of authority. University course notes, academic papers, theses: Computer Modern is there! We get back to the agreeableness of Baskerville above: perhaps people trust this font because trusted people use this font. And this isn’t unreasonable! Recall that fonts are like accents: you would certainly believe an English accent if they’re telling you about tea, or a Canadian accent if they’re giving tips for making maple syrup.

“Do I have to read this, it’s so uggglllyy and done in Worrrrdd.” Supervisor: “Yes Adam it’s important for your research” 🙁 (Source)

All the sentimentality for Computer Modern often means its problems are often overlooked. I mean, it’s 2015 and mathematicians aren’t using WYSIWYG word processors, for crying out loud! Even more than that, look back to the sample at the top of this blog. On the printed page, Computer Modern looks great, but on the screen, the thin strokes (on the ‘n’ above) mean that it renders very poorly at typical text sizes, particularly on computers using Windows. It’s also very wide, and to people who aren’t used to seeing it, makes them wonder ‘why isn’t this Times?’.

#### A challenger

In Office 2007, Microsoft introduced Cambria into their new equation editor, to try to combine the good points of LaTeX with the good points of Word and newer font technology. The result is good: sample 5 shows a font that has different versions for different heights (note the different ‘1’s as mentioned above), as well as keeping the font thick enough so that it renders well at small sizes. Overall it suffers from the fact that Microsoft chose to make the sans-serif Calibri the default font in Office, leaving Cambria as an unused, slightly odd cousin, but the maths version mixes well with it.

#### Mix and match

I am, of course, mixing your choice of typeface with your choice of typesetting system. It’s surprisingly difficult to change your typeface once you’ve chosen your system, but it is possible. There’s no reason why you can’t mix the beauty of the LaTeX system with the tradition of Times New Roman (under its adapted-for-maths version!), or indeed the ease-of-use of Office’s equation editor with the familiarity of Computer Modern.

Two years ago I took part in a brain-scan study to try to see how mathematicians view beauty in equations. All of the equations were produced in Cambria. I am convinced that we would have been much more sympathetic to the particularly ugly equations if they had been instead in Computer Modern.

The perfect maths font is that which conveys your message with the authority it demands. You might have read the 36 methods of mathematical proof, and I request an addition. For when it’s too beautifully typeset to be wrong: proof by LaTeΧ.

[Small clarity edits made on 19 August 2015 following feedback from Reddit’s maths subreddit]

Adam is an assistant professor at Durham University, where he investigates weird, non-Newtonian fluids. If he’s not talking about the maths of chocolate fountains he is probably thinking about fonts, helping Professor Dirichlet answer your personal problems, and/or listening to BBC Radio 2.

• ### On the cover: VisualPDE.com

Ben Walker, Adam Townsend & Andrew Krause invite you to play with their fun online PDE visualiser
• ### My favourite LaTeX package

The Chalkdust editors share some of their favourites
• ### Page 3 model: Cows

How big is the biggest cow?
• ### Chalkdust issue 11 puzzle hunt #5

Adam Townsend sets the fifth and final puzzle. Can you solve it?
• ### Review: Mathematical socks 2

More sartorial inquisition for your feet
• ### Review of The Maths Behind by Colin Beveridge

Should you ask Santa for 'Ice Col' Beveridge's encyclopedic tome this festive period?