[Tex/LaTex] Cambria Math becomes plain Cambria

fontsunicode-math

I'm a LaTeX neophyte, so please excuse my ignorance.

I want to typeset a document with text in Cambria and math in Cambria Math.
I found the unicode-math package, which seems to do what I want.

Here is a simple sample:

\documentclass{article}

\usepackage{unicode-math}
\setmainfont{Cambria}
\setmathfont{Cambria Math}

\begin{document}

The Bezier curve $C$ of degree $m$ is
$$C(u) = \sum_{i=0}^m f_i(u)P_i$$

\end{document}

The math is coming out as plain (upright) Cambria.

Any idea what might be going wrong ??

[Elaboration]: I'm using MikTeX 2.9, and XeLateX. I updated the XeTeX version because unicode-math told me to. I'm just choosing an option from the TeXworks menu. I don't know what's happening behind the scenes (and I hope I don't need to know).

Here is some log file output that might be relevant:

Requested font "Cambria/ICU:script=latn;language=DFLT;" at 10.0pt
 -> C:/Windows/Fonts/CAMBRIA.TTC
Requested font "Cambria Math/ICU" at 10.0pt
 -> C:/Windows/Fonts/CAMBRIA.TTC
\g_fontspec_family_Cambria Math_int=\count125
Requested font "Cambria Math/B/ICU" at 10.0pt
 -> C:/Windows/Fonts/CAMBRIA.TTC
.................................................
. fontspec info: "no-font-shape"
. 
. Could not resolve font Cambria Math/B (it probably doesn't exist).
.................................................
. fontspec info: "defining-font"
. 
. Font family 'CambriaMath(0)' created for font 'Cambria Math' with options
. [BoldItalicFont={},ItalicFont={},Script=Math,SizeFeatures={{Size=10-},{Size=7
-10,Font=Cambria
. Math,Style=MathScript},{Size=-7,Font=Cambria
. Math,Style=MathScriptScript}},].
. 
. This font family consists of the following shapes:
. 
. * 'normal' with NFSS spec.:
. <10->"Cambria Math/ICU:script=math;language=DFLT;"<7-10>"Cambria
. Math/ICU:script=math;language=DFLT;+ssty=0;"<-7>"Cambria
. Math/ICU:script=math;language=DFLT;+ssty=1;"

Best Answer

This behaviour is due to a known 'breaking' change in the latest l3kernel release (i.e. one which the team knew altered behaviour but which was felt was the best choice in the long term). As such, unicode-math needs to be updated to conform with the altered l3kernel code.


Temporary fix (use at own risk): Make a copy of unicode-math.sty in your local tree and do a search-and-replace for \l_keys_choice_int, replacing with \l_keys_choice_int \or. That will fix the issue until unicode-math is fixed officially. (At least it does in my quick tests.)


The fixed unicode-math is now available on CTAN and in TeX Live 2012. As anticipated, this deals with the issue and all is well again.