8

Working with XeLaTex, I use the package unicode-math in my document. Everything is fine except for the mathbb characters, which I would like to have the ordinary way. With unicode-math, \mathbb{R} produces:

enter image description here

while I'd like to have:

enter image description here

(but still use unicode-math for everything else). Now I want to add a command like:

\setmathfont[range=\mathbb]{??Computer Modern??}

where ??Computer Modern?? has to be replaced by the appropriate font name, in order to get back the mathbb symbols which are used before unicode-math is loaded. The problem is, I don't know the appropriate font name of the standard math font (should be Computer Modern or Latin Modern Math or something like that). I have already tried loads of different strings, including "cm", "lmr", "Computer Modern" etc. Any suggestions for the font name which is required by \setmathfont here?

6
\documentclass{article}
\usepackage{amssymb}
\let\mathbbalt\mathbb
\usepackage{unicode-math}
%\let\mathbb\mathbbalt% UNIVERSAL RESET TO ORIGINAL \mathbb
\begin{document}
\begin{equation}
\mathbb{R}\quad\mathbbalt{R}% OR JUST CALL ON INDIVIDUAL ORIGINAL GLYPHS
\end{equation}
\end{document}

As written above, one can access the original \mathbb glyphs via \mathbbalt.

enter image description here

Uncommenting the "UNIVERSAL RESET" line gives this result:

enter image description here

  • Strange... If I do precisely that then I get nothing. Neither version of the letter R appears, there is just a white background, no errors or warnings either. (If I uncomment the UNIVERSAL RESET line then I get the ugly R, but the one I want does not show up.) The log, however, contains the following line: "Missing character: There is no R in font msbm10!" – user50982 Mar 27 '17 at 11:34
  • @user50982 Does it compile and render properly if you comment out the \usepackage{unicode-math} line? – Steven B. Segletes Mar 27 '17 at 11:41
  • Yes, then I get the nice R I want! – user50982 Mar 27 '17 at 11:44
  • @user50982 is your unicode-math package up to date? My log file indicates Package: unicode-math 2015/09/24 v0.8c Unicode maths in XeLaTeX and LuaLaTeX. Likewise, Package: amssymb 2013/01/14 v3.01 AMS font symbols – Steven B. Segletes Mar 27 '17 at 11:47
  • my unicode-math is 2013/05/04 v0.7e, So I'll have to get a newer version, I guess. – user50982 Mar 27 '17 at 11:53
5

You can undefine \mathbb and then redefine it to do the same it does with amsfonts:

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

\AtBeginDocument{%
  \let\mathbb\relax
  \DeclareMathAlphabet{\mathbb}{U}{msb}{m}{n}%
}

\begin{document}

\[
\mathbb{R}
\]

\end{document}

You can still get the standard unicode-math bb letters by \symbb.

enter image description here

  • Like in Steven B. Segletes answer this just gives me an empty white page, no errors or warnings. The log contains the line "Missing character: There is no R in font msbm10!" – user50982 Mar 27 '17 at 11:43
  • @user50982: Probably your system is too old. I see the R with a current miktex, but it disappears in texlive 2014. – Ulrike Fischer Mar 27 '17 at 11:49
  • I will have to get a newer version of unicode-math. – user50982 Mar 27 '17 at 11:54
2

In addition to the previous answers (which did not work for me, since my unicode-math is outdated), I found the following workaround (I cannot install a newer version of unicode-math so easily, since I don't have administrator rights). What I did was insert the line

\setmathfont[range=\mathbb]{texgyrepagella-math.otf}

This gave me (despite a warning that the font is not found and "defaults are substituted"), the nice \mathbb{R} I wanted (no idea what the substitute font is called, but it's obviously the right one).

Thanks again also for the other answers which are, of course, the way to go on an up-to-date installation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.