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.

0
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

4
  • That destroys the proper math spacing!
    – MaxNoe
    Nov 29 '14 at 16:17
  • @MaxNoe What do you mean?
    – egreg
    Nov 29 '14 at 16:20
  • Compare $\mathbb{XYZ}$ with and without your command.
    – MaxNoe
    Nov 29 '14 at 16:54
  • @MaxNoe Did you try \mathbb{XYZ} with pdflatex? The spacing is the same as you get with my code. The TeX Gyre math fonts add spacing around blackboard bold letters, AMS doesn't.
    – egreg
    Nov 29 '14 at 16:57

This site is temporarily in read only mode and not accepting new answers.

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