# unicode math font smaller than the text

I have a problem with unicode-math. When I set the document at 12pt, the maths font remains 10pt, as shown in the following example:

\documentclass[12pt,fleqn,oneside]{article}
\usepackage{amsmath}
\usepackage[no-math]{fontspec}
\setmainfont[Ligatures=TeX]
{TeX Gyre Heros}

\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfontface\mathrm{Latin Modern Roman}

\begin{document}
This is an example~$y = \tan \text{angle}$
\end{document}


I don't really get along with unicode-math. Could you help me to fix this problem?

• Because these fonts are not the ones I will need to use... My mistake, let me edit. – Logos Jan 26 '18 at 17:56
• The math font is in 12pt, but latin modern looks smaller than pagella. Why don't you use TeX Gyre Pagella Math as math font? – Ulrike Fischer Jan 26 '18 at 18:28
• It is quite ugly, I know, but it has been decided to use TeX Gyre Heros for the text and Latin Modern for maths. As a matter of fact, the example is not accurate. I'm going to edit it again. – Logos Jan 26 '18 at 18:32

Scale to match:

\documentclass[12pt,fleqn,oneside]{article}
\usepackage{amsmath}

\usepackage[no-math]{fontspec}
\usepackage{unicode-math}

\setmainfont{TeX Gyre Heros}

\setmathfont{Latin Modern Math}[Scale=MatchLowercase]
\setmathrm{Latin Modern Roman}[Scale=MatchLowercase]

\begin{document}

This is an example~$y = \tan \text{angle}$

Another $y_{\mathrm{up}}$

\end{document}


• It works even better than mine. Thanks a lot: I didn't think of MatchLowercase to scale the fonts. – Logos Jan 26 '18 at 18:40

Empirically, I found the solution of scaling maths fonts of a factor 1.2 as in the example below:

\documentclass[12pt,fleqn,oneside]{article}
\usepackage{amsmath}
\usepackage[no-math]{fontspec}
\setmainfont[Ligatures=TeX]
{TeX Gyre Heros}

\usepackage{unicode-math}
\setmathfont{Latin Modern Math}[Scale=1.2]
\setmathfontface\mathrm{Latin Modern Roman}[Scale=1.2]

\begin{document}
This is an example~$y = \tan \text{angle}$
\end{document}


It is certainly not the most aesthetic way, but it works, at least with the two fonts I am using. If you find a most aesthetic solution, I will be pleased to see it, though.