XeTeX: What happened to \mathcal and \mathscr?

You have several options

Don’t use unicode-math

Unless you have a specific reason to use it, you don’t have to use it and your old code should work just fine.

\documentclass{standalone}
\usepackage{mathrsfs}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

enter image description here

Use a different math font

Some OpenType math fonts like XITS Math have both math calligraphic and math script alphabets. By default XITS Math has a math script alphabet and the math calligraphic alphabet is available through stylistic set 1. We can use unicode-math

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{XITS Math}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

enter image description here

Use \mathscr from a different font

The default font, Latin Modern Math, has a math calligraphic alphabet only; we can use the math script from XITS Math. Though unicode-math loads Latin Modern Math by default, we have to explicitly use it for some reason or things will not be quite right.

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\mathscr,\mathbfscr}]{XITS Math}
\begin{document}
$\mathcal{C} = \mathscr{C}$
\end{document}

enter image description here

That being said, the root of this complication is because the people who encoded Unicode math symbol could not find any convincing evidence for the use in math of both the calligraphic alphabet and the math script in the same context to mean different things, so they considered it to be just a stylistic not semantic difference so they were unified in encoding.


When Unicode added the Math Alphabet block they decided not to treat script and calligraphic as different, I think unicode-math more or less as a design principle follows that.

If you look in the log you see

Missing character: There is no  in font rsfs10!

where that C is MATHEMATICAL ITALIC CAPITAL C (U+1D436)

You need to get back to a normal ASCII C for rsfS, this works although there may be more elegant ways

$\mathcal{C} = \mathscr{\char`\C}$

enter image description here


You can use different fonts for different ranges; XITS Math has the calligraphic letters similar to the usual ones.

\documentclass{standalone}
\usepackage{unicode-math}
\setmathfont{Latin Modern Math}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{XITS Math}
\setmathfont[range=\mathscr]{XITS Math}
\begin{document}
$\mathcal{ABCDEF} = \mathscr{ABCDEF}$
\end{document}

enter image description here

Tags:

Fonts

Xetex