[Tex/LaTex] Behavior of \mathcal and \mathscr in STIX 2.0.0

mathcalstix

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?

Best Answer

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}

enter image description here

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.

Related Question