Problem: In the below MWE, math is rendered correctly, unless there is \mathrm or an operator like \sin, and then the entire $...$ is rendered in upright font; Further, all future $...$ are upright.
MWE:
\documentclass{beamer}
\usefonttheme{serif}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}
\begin{document}
$this is italic$
$$italic$$
$this is already upright. \sin x$ $now upright$
$$ upright?$$
[ why is it?]
\end{document}
I guess there's a lot of packages for a MWE, but I think this is the smallest I can make it:
- Replacing
\documentclass{beamer},\usefonttheme{serif}with\documentclass{article}makes it work normally (but I'm trying to make slides) - similarly with removing either
mathtools, orunicode-mathand the font settings.
I tried reordering the packages, I don't think that did anything. Same thing happens (and was discovered) in a frame environment. I'm on TeX Live 2017, Macbook, and XITS/XITS Math are installed (I can see them in Font Book).
I've already removed all use of mathtools from my slides, but any thoughts on what's happening? Presumably I'm just doing something wrong.
\setoperatorfont{\mathrm}fixes it, or\setmathrm{XITS}. – Davislor Jun 26 '21 at 16:34