Iteration 1
\documentclass[10pt]{article}
\usepackage[MnSymbol]{mathspec} % Includes amsmath.
\setmathsfont(Digits,Latin,Greek,Symbols)[Numbers={Lining,Proportional}]{Calibri}
\setmainfont[Mapping=tex-text, Ligatures={NoRequired,NoCommon,NoContextual}]{Calibri}
\usepackage[italic]{mathastext}
\begin{document}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\begin{align}
\dfrac{5a + 10b}{10} &= c \times |XY| - \alpha\beta\gamma^{2}\\
x &= 5~\mathsf{°C}
\end{align}
\end{document}
This ticks the first two boxes in my requirements, and here is what you get out:
You can notice this approach has multiple problems though:
- The fraction line is not typeset in Calibri "style".
- The
\times symbol is not typeset using Calibri.
- The
\circ (degree) symbol is completely missing.
- 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.
\documentclass[10pt]{article}
\usepackage{amsmath} % Same for amsmath.
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont[Mapping=tex-text,Ligatures={NoRequired,NoCommon,NoContextual}]{Calibri}
\setmathfont[slash-delimiter=frac]{Cambria Math}
\setmathfont[range={"0000-"FFFF}]{Calibri}
\setmathfont[range=up]{Calibri}
\setmathfont[range=sfup]{Calibri}
\setmathfont[range=it]{Calibri Italic}
\setmathfont[range=bfup]{Calibri Bold}
\setmathfont[range=bfit]{Calibri Bold Italic}
\setsansfont{Calibri} % Make \mathsf and \textsf also Calibri
\begin{document}
ABCDEFGHIJKLMNOPQRSTUVWXYZ
\begin{align}
\dfrac{5a + 10b}{10} &= c \times |XY| - \alpha\beta\gamma^{2}\\
x &= 5~\mathsf{°C}
\end{align}
\end{document}
Here is the lovely result:

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.
\neq... – Ulrike Fischer Apr 07 '19 at 20:38\neq. It works if I increase the range to"0000-"FFFF. – Augustin Apr 07 '19 at 20:42otfinfo, you can then turn that into arange=that tries to use only the characters a font actually has. – Davislor Apr 07 '19 at 23:10\defaultfontfeatures{Scale=MatchLowercase}to the top, and the optionScale=1.0to\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 07 '19 at 23:19\setsansfont. – Davislor Apr 07 '19 at 23:21