[Tex/LaTex] How to make calligraphic numbers available with `unicode-math`

fontsmathcalunicode-mathxetex

I use xits-math.otf with unicode-math with XeLaTeX.

It defines calligraphic upper case letters, but I need calligraphic lower case letters and especially numbers as well.

I tried this:

\documentclass{minimal}
\usepackage[math-style=TeX, bold-style=TeX]{unicode-math}
\usepackage{fontspec}

\setmathfont[StylisticSet=0]{xits-math.otf}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{xits-math.otf}

\newfontfamily\mathc[Path=/usr/share/texlive/texmf-dist/fonts/type1/public/mathabx-type1/]{mathc10.pfb}

\begin{document}
    $\mathcal{mathcal ABC 123}$ \\
    $\mathbfcal{mathbfcal ABC 123}$ \\
    \mathc{mathc10.pbf abc ABC 123 !@\$\%\&}
\end{document}

enter image description here

This gives me the uppercase \mathcal and \mathbfcal letters, but as you can see, the lowercase letters and numbers, are just the standard italic and upright symbols, respectively.

In that example, I made an extra font definition using fontspec to get access to the calligraphic font used with mathabx. With that, I can access the symbols, but not by using \mathcal, which is quite inconvenient, but the most inconvenient with this workaround, is that it doesn't work in math mode. I have to use \text{\mathc{3}} to get a calligraphic '3', which is isn't really an option. Also, no bold calligraphic symbols, which I don't really need, but it feels like something's missing.

A while ago, I asked here how to get the "mathc10" font while using MnSymbol. I don't use MnSymbol anymore, but I tried the solution anyway:

\documentclass{minimal}

\usepackage[math-style=TeX, bold-style=TeX]{unicode-math}
\usepackage{fontspec}

\setmathfont[StylisticSet=0]{xits-math.otf}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{xits-math.otf}

\DeclareFontFamily{OT1}{mathc}{}
\DeclareFontShape{OT1}{mathc}{m}{n}{ <-> mathc10 }{}
\DeclareMathAlphabet\mathcal{OT1}{mathc}{m}{n}

\newfontfamily\mathc[Path=/usr/share/texlive/texmf-dist/fonts/type1/public/mathabx-type1/]{mathc10.pfb}

\begin{document}
    $\mathcal{mathcal ABC 123}$ \\
    $\mathbfcal{mathbfcal ABC 123}$ \\
    \mathc{mathc10.pbf abc ABC 123 !@\$\%\&}
\end{document}

enter image description here

This kinda creates a new problem, while solving another: I have now access to calligraphic numbers with \mathcal – although no bold version – but now the letters are gone.

I'm thinking I might need a different OTF font for the \mathcal and \mathbfcal ranges, but I don't know which one, and I don't know if that's actually the best solution.

Again, what I need is:

  • calligraphic letters
  • calligraphic numbers
  • accessing them with \mathcal

Nice to have:

  • calligraphic bold version of letters and numbers

Best Answer

You don't need to load the mathc10 font with fontspec; however it doesn't have a boldface companion, as already said elsewhere.

\documentclass{article}
\usepackage{amsmath}
\usepackage[math-style=TeX, bold-style=TeX]{unicode-math}

\setmathfont[]{xits-math.otf}
\setmathfont[range={\mathcal,\mathbfcal},StylisticSet=1]{xits-math.otf}

\DeclareFontFamily{OT1}{mathc}{}
\DeclareFontShape{OT1}{mathc}{m}{n}{ <-> mathc10 }{}
\DeclareRobustCommand\xmcal[1]{\text{\usefont{OT1}{mathc}{m}{n}#1}}

\begin{document}
$\mathcal{mathcal ABC 123}$

$\mathbfcal{mathbfcal ABC 123}$ \\

$\xmcal{ABC abc 123}$

\end{document}

enter image description here