# Behavior of \mathcal and \mathscr in STIX 2.0.0

I recently installed STIX 2.0.0 and remarked that \mathcal and \mathscr give the same result (calligraphic letters). A minimal example:

\documentclass{article}

\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}

\begin{document}
$$\mathcal{A} \mathscr{A}$$
\end{document}


But if I add the option

\setmathfont[StylisticSet=01]{STIX Two Math}


they again give the same result, this time calligraphic letters with "roundhand style".

Is it the normal behavior of these commands in STIX 2? Is there a way to have the first kind on \mathcal and the second "roundhand style" one on \mathscr?

Define a font for the \mathscr range, see section 5.4.2 “Calligraphic vs. Script variants”.

\documentclass{article}

\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}
\setmathfont{STIX Two Math}[range={scr,bfscr},StylisticSet=01]

\begin{document}

$\mathcal{A}\mathcal{B}\mathcal{C}$

$\mathscr{A}\mathscr{B}\mathscr{C}$

\end{document}


This is the unicode-math version of the legacy method

\DeclareMathAlphabet{\mathscr}{<encoding>}{<family>}{<series>}{<shape>}


so doing \mathscr{A} just chooses the glyph based on a math code, not going through \mathchoice in a text mode box where an altogether different math version is set up.

• It works! For futur reference to this answer: the document you are refering to is the unicode-math package documentation section 5.4.2 “Calligraphic vs. Script variants” that can be found on the CTAN page of the package.
– gpst
Apr 2 '17 at 17:31

\mathcal and \mathscr (actually, \symcal and \symscr, and the former two commands are just aliases) point to the same Unicode ranges, as it can be seen from the unicode-math.sty:

\usv_set:nnn {scr} {Latin}{"1D49C}
\usv_set:nnn {cal} {Latin}{"1D49C}


So they aren't supposed to look differently.

If you want them to, then you'll have to use different math versions. The problem with this approach is that you cannot switch math versions inside a formula, but for \mathscr it shouldn't be a big problem. Just put the letters into a box like this:

\documentclass{article}

\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}
\setmathfont{STIX Two Math}[version=script,StylisticSet=1]

\renewcommand{\mathscr}[1]{{\text{\mathversion{script}$\symscr{#1}$}}}

\begin{document}
$\mathcal{A} \mathscr{A} \mathcal{A}$
\end{document}


I've also replaced $$...$$ by $...$ as the latter behave better in LaTeX code (for example, they honor the fleqn documentclass option).