4

For some reason, in this setup, \mathscr{C} and \mscrC produce different results:

\documentclass[12pt,a4paper]{article}
\usepackage{unicode-math}
\unimathsetup{math-style=TeX} 
\setmathfont{Cambria Math}
\setmathfont[range={\mathscr,\mathbfscr},StylisticSet=0]{xits-math.otf}
\begin{document}
\[
\mathscr{C}, \mscrC
\]
\end{document}

In the result, \mathscr{C} respects the remapping, but \mscrC does not. I was under the impression that unicode-math translates the former to the latter, but it seems as if \mathscr here contains some additional processing that "knows" about fonts. A literal 𝒞 behaves like \mscrC. The only thing that seems to work is redefining \mscrC after \begin{document} to force it to go through \mathscr.

  1. What is unicode-math really doing?

  2. How do I work around this?

  • 1
    \mscrC is just an alias for the 𝒞 character; \mathscr instead does many things. – egreg May 2 '12 at 14:05
6

I'm not sure but I think that it is not a bug but a feature: It gives you the possibility to use different fonts even if the "destination position" is the same. \mathscr{C}, \mscrC and also \mathcal{C} all print the char "1D49E. The current behaviour means that e.g. \mathscr and \mathcal can come from different fonts:

\documentclass[12pt,a4paper]{article}
\usepackage{unicode-math}

\unimathsetup{math-style=TeX}
\setmathfont{Cambria Math}
\setmathfont[range={\mscrC,\mathscr,\mathbfscr},]{xits-math.otf}

\begin{document}
\mscrC
\[
\mathscr{C}, \mscrC,\mathcal{C}
\]
\end{document}

If you want to change the look of \mathcal too you will have to add it to the list too (like I did for \mscrC).

  • Hmmm, but the documentation seems to suggest that the remapping is on the level of character codes, rather than commands. In fact, when I tried to remap a Unicode range instead of \mathscr I had the same problem. But remapping \mscrC directly seems to work, thanks! – Zhen Lin May 2 '12 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.