My requirements are:

  1. Use Calibri as the main font. This is easy with XeLaTeX.
  2. Use Calibri as the math font. Also quite easy using e.g. mathspec. But this takes care only of letters and numbers.
  3. Use Calibri as the font for math symbols (e.g. \times, =, +) in equations. This is the difficult part.

It took me a few years and two iterations to figure this out, but I finally found a solution. Both are discussed in the answer below.

2 Answers 2


Iteration 1

\usepackage[MnSymbol]{mathspec}  % Includes amsmath.
\setmainfont[Mapping=tex-text, Ligatures={NoRequired,NoCommon,NoContextual}]{Calibri}

    \dfrac{5a + 10b}{10} &= c \times |XY| - \alpha\beta\gamma^{2}\\
    x &= 5~\mathsf{°C}

This ticks the first two boxes in my requirements, and here is what you get out:

Iteration 1 You can notice this approach has multiple problems though:

  1. The fraction line is not typeset in Calibri "style".
  2. The \times symbol is not typeset using Calibri.
  3. The \circ (degree) symbol is completely missing.
  4. The "C" in the equation is not typeset using Calibri. because I used \mathsf. Therefore, the Computer Modern sans font was used.

Iteration 2

My first solution was good-enough, so I stuck with it for a few years. However, during that time the great unicode-math package emerged.

The key ingredient (or hack) that satisfied my third requirement was the line \setmathfont[range={"0000-"FFFF}]{Calibri} which means: "Use Calibri for all Unicode characters 0x0000 to 0xFFFF, i.e. the vast majority of symbols I would ever want to use in equations."

Also note the \setmathfont[slash-delimiter=frac]{Cambria Math}. This is necessary, as Calibri is not available as a LaTeX math font. So we use Cambria Math, because it matches Calibri in style better, e.g. it has more matching fraction lines. However, we use the trick described above to use Calibri for the Unicode range of most of the characters anyone will see.

\usepackage{amsmath}  % Same for amsmath.
\setmathfont[slash-delimiter=frac]{Cambria Math}
\setmathfont[range=it]{Calibri Italic}
\setmathfont[range=bfup]{Calibri Bold}
\setmathfont[range=bfit]{Calibri Bold Italic}
\setsansfont{Calibri}  % Make \mathsf and \textsf also Calibri

    \dfrac{5a + 10b}{10} &= c \times |XY| - \alpha\beta\gamma^{2}\\
    x &= 5~\mathsf{°C}

Here is the lovely result:

Iteration 2

Final notes

  • I verified that this works with XeLaTeX. It should work with LuaTeX as well.
  • This should work with any other font.
  • I hope this helps you typesetting beautiful documents.
  • Add a \neq ... Apr 7, 2019 at 20:38
  • @UlrikeFisher: Nice catch with the \neq. It works if I increase the range to "0000-"FFFF.
    – Augustin
    Apr 7, 2019 at 20:42
  • One suggestion: if you examine the coverage of a font, e.g. with otfinfo, you can then turn that into a range= that tries to use only the characters a font actually has.
    – Davislor
    Apr 7, 2019 at 23:10
  • I’d also recommend adding \defaultfontfeatures{Scale=MatchLowercase} to the top, and the option Scale=1.0 to \setmainfont. This will improve the scaling if you try to use Calibri with some other font family, such as a monospace, serif, script or blackboard-bold font.
    – Davislor
    Apr 7, 2019 at 23:19
  • 1
    If your document uses the sans-serif family (as, for example, Koma’s headers do by default), you’d also want to \setsansfont.
    – Davislor
    Apr 7, 2019 at 23:21

I also struggled with this, trying to use setmainfont and setmathfont but what ended up working was:

Path = /path/,
BoldFont = LocalFont-Cond,
ItalicFont = LocalFont-ExtObl,
BoldItalicFont = LocalFont-BoldExtObl]{LocalFont}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.