unicode-math
unicode-math copied to clipboard
Math operator in figure caption results in failure.
Description
Using unicode-math
version 0.8m
, installed with TeX Live 2018, causes math operators in figure captions to fail with the following error:
! Undefined control sequence.
\__um_fontswitch:n ...ath@bgroup \__ummath@bgroup
\cs_set_eq:NN \math@egroup...
l.10 \caption{Test caption $i \bmod 64$.}
I am observing this issue on Mac OS X 10.13.
Check/indicate
- [X] Relevant for XeTeX
- [X] Relevant for LuaTeX
- [X] Issue tracker has been searched for similar issues?
- [ ] Links to <tex.stackexchange.com> discussion if appropriate
Minimal example demonstrating the issue
\documentclass{article}
\usepackage{unicode-math}
\begin{document}
\begin{figure}
\caption{Test caption $i \bmod 64$.}
\end{figure}
\end{document}
Further details
Based on the error message, this issue seems to be related to #492.
\bmod
has always been a fragile command. If you comment out unicode-math
, add \listoffigures
and compile with pdflatex
, the .lof
file will contain
\contentsline {figure}{\numberline {1}{\ignorespaces Test caption $i \nonscript \mskip -\medmuskip \mkern 5mu\mathbin {\mathgroup \symoperators mod}\penalty 900\mkern 5mu\nonscript \mskip -\medmuskip 64$.}}{1}
Use \protect\bmod
when the command is used in a moving argument.
On the other hand, it would probably be a good addition if unicode-math
makes the command robust.
Thanks @eg9 for the quick response and for reminding me about \protect
. Thus far I've only seen this issue affect fragile math operators, such as \bmod
or \sin
(without amsmath
).