# Trouble with fonts in XeLaTeX in MacTeX 2016

Consider the code

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode

\documentclass[11pt]{book}
\usepackage{unicode-math}
\setmainfont [Ligatures=TeX]     {TeX Gyre Pagella}
\setmathfont [Scale=1.05]          {Latin Modern Math}
\setmathfont [range=\mathbb]    {TeX Gyre Pagella Math}

\def\csdef #1{\expandafter\def\csname#1\endcsname}
\def\foo #1{\mathop{\mathcal{#1\kern 0pt }}\nolimits}
\def\Newfunction #1#2{\csdef{#1}{\mathop{\mathrm {\rm #2}\kern 0pt}\nolimits}}

\def\bor {\mathcal{B}\mathit{or}}
\Newfunction{Bor}{\mathcal{B}\mathit{or}}
\Newfunction{Imp}{\mathcal{I}\mkern -2mu \textit{mp}}

\parskip 5pt

\begin{document}
1) $\foo{B} + \foo{I}$ \par
2) $\bor+\Bor$ \par
3) $\Imp$ \par
4) $\bigl(( \quad )\bigr)$ \par
\end{document}


With XeTeX, Version 3.14159265-2.6-0.99992 (TeX Live 2015), all is OK except the \big in item 4.

With XeTeX, Version 3.14159265-2.6-0.99996 (TeX Live 2016), the mathcal disappear in items 2, 3.
In item 4, the \big are too small and an extra space is added between parenthesis.

I still don't understand why item 1 is always correct...

Computer : MacMini late 2012 + Mac OSX El Capitan 10.11.5

• Welcome! I get the output you show for 2016 also with 2015 and 2014. (Didn't test further back.) – cfr Jun 7 '16 at 21:19
• It seems to be a bad bug in unicode-math; if the main font is set, \mathrm{\mathcal{A}} won't produce any character. The non \big delimiter problem is solved by issuing a final \setmainfont[Scale=1.05,range=\int]{Latin Modern Math} instruction, but the space after the \bigl( delimiter is another apparent bug (only in XeLaTeX). – egreg Jun 7 '16 at 21:39
• I see that the mathcal{B} is gone, and it could be due to the changes in unicode math, but I don't understand what you are trying to achieve by putting a \mathcal after a \rm in a \mathrm. The large spacing is related to the pagella font. – Ulrike Fischer Jun 7 '16 at 21:40
• @UlrikeFischer It happens also with \DeclareMathOperator{\FOO}{\mathcal{X}} (with amsmath, of course), because, essentially, \mathrm is applied implicitly. – egreg Jun 7 '16 at 21:41
• @UlrikeFischer I get the space with XeLaTeX but not LuaLaTeX. And I get it with 2015 or 2016. – cfr Jun 7 '16 at 21:49

Thank you for reporting the bugs in unicode-math, @egreg. The two issues have now been fixed with