# Best practice - how can I get my whole document (including math) to only use font X with LuaLaTeX and fontspec?

Considering one uses math symbols in a document, it is desirable to have them all displayed in the serif font one is using for text, or in basically any font x one would like to use for this sort of thing.

So for one who just started looking into using LuaLaTeX, the amount of information on how to properly typeset a document with only one font (or good combination of at least 2 fonts) is a bit overwhelming. There are easily hundreds of questions on fontspec, Lua(La)TeX, mathspec and the resulting options to use a font, some of which are 4 years old.

Maybe some of the more experienced (and especially more successful) users, who have done this kind of thing before, could share their code for some of the most popular fonts (or their clones and variants)?

• Times New Roman

• Helvetica/Arial

• Palatino

• Minion Pro

• Garamond

• Georgia

... and more

I'm not sure I qualify as experienced and/or more successful :-). But here's an example of the setup I used for my thesis. Adobe Garamond Pro was used as the text font. Sadly, I needed bold to appease the thesis arbiters at my university, so I used BoldFont=AGaramondPro-Semibold as it looks slightly less out of place than the standard bold weight.

For mathematics, I used the mathdesign package with option adobe-garamond. This provided all math symbols I needed for my document, with glyph shapes appropriate for Garamond as a text font. For this to be successful, you must copy the .otf font files to a specific TDS directory, as detailed in the mathdesign README file.

I also have shown some additional typographical enhancements in my sample below, which you may be interested in. microtype allows for more pleasing color on the page. The selnolig package breaks ligatures which would otherwise span morpheme boundaries. Of course, only German and English are supported out of the box, so it won't do much for the Latin text in my example below.

Here's an example using the blindtext package to produce a sample mathematics paper, with explanations in the comments for each font option. I've set this in a two-column layout just so that all the math samples fit on one page for the screenshot.

## Sample Code

%% compile with LuaLaTeX
\documentclass[twocolumn]{article}
\usepackage{blindtext} % just for the sample math paper

% here are the font specifications
\usepackage[adobe-garamond]{mathdesign} % use the mathdesign package with Garamond
\usepackage[no-math]{fontspec} % load fontspec without modifying maths fonts
\setmainfont[
Ligatures=TeX, % make ---, --, etc function as in traditional (La)TeX
Kerning=Uppercase, % slight tracking adjustment for all-caps material
BoldFont={AGaramondPro-Semibold}, % this is a bit of a faux pas, but it was required by my thesis office :(
Numbers=Proportional, % I also had some code to switch to lining numbers in tabular matter
\setmathrm{Adobe Garamond Pro} % for operators and other text in math

% some additional (optional) typographic enhancements
\usepackage{microtype}
\usepackage[english]{selnolig} % of course, this won't do much for latin lipsum text :-)

\begin{document}
\blindmathpaper
\end{document}


## Close-up

• I don't get the same output as you. Many examples: my symbols (=, –, +, etc.) are not rounded as yours; my \alpha are different; the \sum symbol is different; also the \partial; and event the math letters (for instance, my x is much more upright-ish than yours). – Manuel Aug 11 '14 at 11:25
• @Manuel there are some installation steps needed for mathdesign to work with Adobe Garamond Pro. See its README file for details. – Paul Gessler Aug 11 '14 at 11:31
• @Manuel thanks for the note; I've updated the answer with a mention of this. – Paul Gessler Aug 14 '14 at 1:17

In according to unimath-symbols.pdf, the best fonts for math symbols are

M Latin Modern Math (1588)

X XITS Math (2437)

C Cambria Math (2189)

A Asana Math (2259)

P TeX Gyre Pagella Math (1612)

E Neo Euler (579) (IMHO, this is very wrong ...)

There are many Times-compatible font with fontspec, like TeX Gyre Termes, FreeSerif and STIX. However, I prefer Latin Modern font to Times. This is my MWE

\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage[no-math]{fontspec}
\defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX}
\setmainfont{Latin Modern Roman}[BoldFont={* Demi}]
\setsansfont{Latin Modern Sans}[BoldFont={* Demi Cond}]
\setmonofont{Latin Modern Mono Light}
\usepackage[math-style=ISO,bold-style=ISO]{unicode-math}
\setmathfont{Latin Modern Math}
\begin{document}
\section{Test}
Test text $\mathrm{test\ } α + β = ζ$
\end{document}


Note that amsmath is loaded before unicode-math like suggested by unicode-math package documentation.

• Is it better to use TeX-Gyre Pagella Math or NewPX or Asana?. I'm looking for some opentype font with nice math, and with text looking like Palatino (because of university restrictions). – skan Nov 25 '16 at 13:42

I had some experience with this in my thesis... The Times clone in the TeX Gyre fonts (Termes) can be used quite simply with the unicode-math package. In fact, any of the TeX Gyre fonts can be used this way (at least, the ones with corresponding math fonts) and this should work for XeLaTeX as well.

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Termes}
\setmathfont{TeX Gyre Termes Math}
\begin{document}
Test text $\mathrm{test\ math} \alpha \beta x y z$
\end{document}