1

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, or unicode-math and 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.

  • There is https://tex.stackexchange.com/questions/303538/xelatex-mathtools-unicode-math-and-text-spoil-mathtt but I guess its old, as the bug was apparently fixed in Tex Live 2016? – Calvin Khor Jun 26 '21 at 08:59
  • 1
    Shouldn't unicode-math always be loaded last? – daleif Jun 26 '21 at 10:35
  • @daleif thanks for the comment. yes, that is the recommendation which I did also try; it doesn't help. But that is likely "less wrong" so I will edit the order. – Calvin Khor Jun 26 '21 at 10:53
  • 2
    If you're on tl17 you should really update – daleif Jun 26 '21 at 10:55
  • @daleif :) Also a fair point...I'll get to it probably on tuesday (after this thing is due) – Calvin Khor Jun 26 '21 at 10:57
  • 3
    I cannot duplicate this bug on either LuaLaTex or XeLaTeX in TeX Live 2021. – Davislor Jun 26 '21 at 16:32
  • You might see if \setoperatorfont{\mathrm} fixes it, or \setmathrm{XITS}. – Davislor Jun 26 '21 at 16:34
  • those didn't work. But I can confirm that updating to Tex Live 2021 did! Thanks everyone – Calvin Khor Jul 01 '21 at 04:10
  • 1
    I can reproduce this bug with TeXLive 2017 (on Overleaf), but newer versions of TeX Live should have this bug fixed. Also, I vote to close this questions since it can be solved by updating. – Jasper Habicht Jul 13 '22 at 11:59
  • @JasperHabicht thank you for the close vote. I now know that we close for such a reason on tex.SE. If the question should be deleted it seems I have a button for that – Calvin Khor Jul 13 '22 at 12:03

0 Answers0