TransWikia.com

`mathcal` incompatible with `unicode-math`

TeX - LaTeX Asked by Misaya on July 26, 2021

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!

One Answer

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.

Correct answer by Davislor on July 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP