3

An MWE is like this:

\documentclass{article}
\usepackage{unicode-math}
\DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n}
\begin{document}
$ \tilde{\mathcal{B}} $

% $ \hat{\mathcal{B}} $
\end{document}

The error shows "! Internal error: bad native font flag in `map_char_to_glyph'".

It seems that \DeclareMathAlphabet{\mathcal}{OMS}{cmsy}{m}{n} is not compatible with unicode-math. Any advice is appreciated!

1 Answer 1

5

You’re trying to load an old-fashioned NFSS font command, which is incompatible with unicode-math.

To load a new \mathcal alphabet from an OpenType font, use the range= option of \setmathfont, for example,

\documentclass{article}
\usepackage{unicode-math}

\setmathfont{XITS Math}[
  Scale = MatchUppercase ]
\setmathfont{Latin Modern Math}[
  range = {cal,bfcal},
  Scale = MatchUppercase ]

\begin{document}
\[ \mathcal{ABC} \quad \mathscr{ABC} \]
\end{document}

This loads both the \mathcal and \mathbfcal alphabets, and scales the fonts so that their capital letters are the same height.

1
  • Thanks very much!
    – Misaya
    Jan 11, 2021 at 3:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .