Vanishing math font styles in unicode-math due to a mess of mathtools, mathtt and using math fonts with ranges
It's a misfeature, but a workaround is to load again the main math font for the \mathscr
range; you also have to declare anew the main math font.
\documentclass{article}
\usepackage{mathtools}
\usepackage{
fontspec,
unicode-math,
}
\setmathfont{Latin Modern Math}
\setmathfont{XITS Math}[
range = \mathcal,
]
\setmathfont{Latin Modern Math}[
range = \mathscr
]
\begin{document}
$A$
$\symtt{L}$
$\mathcal{L}$
\end{document}
Note that the correct call for a typewriter type variable is \symtt
, or \mathtt
would load the text monospaced font.
This is the pdffonts
report:
BRCTEL+LatinModernMath-Regular-Identity-H CID Type 0C yes yes yes 5 0
HSKWQU+XITSMath-Identity-H CID Type 0C yes yes yes 7 0