Open itoijala opened 8 years ago
As you might expect, siunitx
is only parenthetically involved here: you can get the same effect with
\documentclass{beamer}
\usepackage{unicode-math}
\begin{document}
\begingroup
\setbox0=\hbox{\ensuremath{\mathsf{}}}
\setbox0=\hbox{\ensuremath{\mathtt{}}}
\endgroup
\begin{frame}
$\mathbf{foo}$ % works with \symbf
\setmathfont{XITS Math}$x$
\end{frame}
\end{document}
(the method siunitx
uses to pick up the active math font families). I'll see if I can trace this further.
It seems that the same issue prevents using \smashoperator or \cramped (from mathtools) even outside beamer :
\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}
\begingroup % or \usepackage{siunitx}
\setbox0=\hbox{\ensuremath{\mathsf{}}}
\setbox0=\hbox{\ensuremath{\mathtt{}}}
\endgroup
\begin{document}
\begin{align*}
Z_\beta &= \smashoperator{\sum_{\sigma \in \left\{-1, +1\right\}^N}} e^{-\beta H(\sigma)} \\
Z_\beta &= \sum_{\sigma \in \left\{-1, +1\right\}^N} e^{-\beta H(\sigma)}
\end{align*}
\end{document}
gives
Removing the \begingroup ... \endgroup statement makes the black bar go away.
I'm sleep deprived but I've looked at this again and can't see where the issue is coming from. Will continue to investigate. (My answer to the OP would be: don't change the maths font mid-slide!)
Thanks @CommunicationAnimale for the additional comments.
@CommunicationAnimale — I've just tested your example with the most recent release of the package and it now appears fixed. Hopefully you see the same — please let me know (by opening a new issue) if you see it re-occur.
The following:
gives the error: