Sans serif math mode parentheses not scaling

bracketsmath-modesans-serif

I am using the implementation I found from this website to write a document in the Calibri font, including the math mode. It looks wonderful, however there is one major flaw: the "large" symbols don't scale properly. This includes integral signs and parentheses.

MWE:

\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}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit...
    \[ x^2y = 2z\left(\frac{\alpha \beta^2}{73c}\right)^2 \]
    \[ \frac{d}{dx}\int f(x)\,dx = f(x) \]
\end{document}

Is there any easy way to fix this? If there's no simple general solution, it would also be fine to just fix the parentheses, as for my purposes the other "large" symbols don't occur.

Thanks in advance.

PS: I'm using this slightly weird implementation instead of, say the sansmath package, or using the cmbright font, as I subjectively prefer the look that it gives. Also, it's better compatible with the Calibri font which I'm using for the main text.

Best Answer

enter image description here

\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} %removing this fixes the issue
% Or if you _really_ want to keep that, at least put the () back
\setmathfont[range={"0028-"0029}]{Cambria Math}
\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}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit...
    \[ x^2y = 2z\left(\frac{\alpha \beta^2}{73c}\right)^2 \]
    \[ \frac{d}{dx}\int f(x)\,dx = f(x) \]
\end{document}

Basically

\setmathfont[range={"0000-"FFFF}]{Calibri} %removing this fixes the issue

Will break the math setting as Calibri is not a Math font. You added a line to fix up (just) fractions and I added another to fix up (just) extendable () but not doing that at all would seem safer. (As your output shows \intfor example is barely usable with this setting)