[Tex/LaTex] Loading amsfonts after mathbbol does not reset \mathbb

amsfontsmath-mode

I'm using the mathbbol package so I can use \mathbb with Greek and lower-case letters. The package documentation states

Without options, the following commands are defined:

  • \mathbb{A} to produce blackbord bold A. All upper and lowercase latin letters are accessible this way. It overwrites AMS-LaTeX's
    \mathbb (and can be overwritten if you load amsfonts after mathbbol)

I am not seeing this functionality

\documentclass{article}

%\usepackage[bbgreekl]{mathbbol}
\usepackage{amsfonts}

\begin{document}

%$\mu = \bbnu(a,b,c)$
$\mathbb{K}$

\end{document}

Specifically:

  • With the mathbbol package commented out, \mathbb{K} prints the amsfonts verion (with
    serifs)
  • With mathbbol, \mathbb{K} prints the mathbbol verion (without
    serifs), even though amsfonts is loaded afterwards

How can I keep the normal amsfonts versions for upper-case \mathbb{} but also add the lower-case and Greek letters from mathbbol?

Best Answer

Simply add the lines

\DeclareSymbolFontAlphabet{\mathbb}{AMSb}
\DeclareSymbolFontAlphabet{\mathbbl}{bbold}

in your preamble and use \mathbbl instead of \mathbb for lowercase latin letters.

MWE

\documentclass{article}

\usepackage[bbgreekl]{mathbbol}
\usepackage{amsfonts}

\DeclareSymbolFontAlphabet{\mathbb}{AMSb}
\DeclareSymbolFontAlphabet{\mathbbl}{bbold}

\begin{document}

$\mu = \bbnu(a,b,c)$

$\mathbb{K}$

$\mathbbl{k}$

\end{document}

enter image description here

The reason why simply loading amsfonts doesn't work is that in amsfonts.sty you have

\@ifundefined{mathbb}{%
    \DeclareSymbolFontAlphabet{\mathbb}{AMSb}%
}{}

which means to set the \mathbb alphabet to AMSb only if it has not been defined.

But it has been already defined by mathbbol to be

\DeclareSymbolFontAlphabet{\mathbb}{bbold}

so it doesn't work without that additional line.