2

I am trying to use AMS blackboard bold font together with TG Pagella Math in the way given in this answer. But I got the error

! Internal error: bad native font flag in `map_char_to_glyph'

Example (xelatex):

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Pagella Math}

\DeclareSymbolFont{AMSb}{U}{msb}{m}{n}
\protected\def\mathbb#1{{\mathchar\numexpr256*\symAMSb+`#1\relax}}

\begin{document}
  $\hat{\mathbb{Z}}$
\end{document}

It seems that there is a similar question here. I would like to know whether there are some better workaround to this problem.

1 Answers1

2

Ugly workaround:

\documentclass{article}
\usepackage{mathtools}
\usepackage{unicode-math}
\setmathfont{TeX Gyre Pagella Math}

\protected\def\mathbb#1{\text{\usefont{U}{msb}{m}{n}#1}}

\begin{document}
  $\hat{\mathbb{Z}}_{\mathbb{Z}}$
\end{document}

enter image description here

egreg
  • 1,121,712