Double-struck zero and one [duplicate]

I am trying to typeset double-struck digits in math mode. They have to come from the same font.

I tried

\mathbbm{0}


from the bbm package and

\mathds{0}


from the dsfont package.

The document compiles OK, but the characters do not show up. Interestingly, the versions for 1 do work.

The minimal examples are:

\documentclass{article}
\usepackage{dsfont}
% or: \usepackage{bbm} with mathbbm below
\begin{document}
$\mathds{0}$  % doesn't print
$\mathds{1}$  % prints
\end{document}


The log file has error messages of the kind:

Missing character: There is no 0 in font bbm10!


I guess that's the problem, but I don't know how to fix it.

• Please help us to help you and add a minimal working example (MWE) that illustrates your problem. In particular, it is important to see which packages and fonts you are loading. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. Oct 7 '14 at 15:35
• Did you happen to notice messages such as Missing character: There is no 0 in font bbm10! and Missing character: There is no 0 in font dsrom10! in the log file?
– Mico
Oct 7 '14 at 15:39
• @darthbith I have added the MWE. Oct 8 '14 at 11:45
• @Mico Thanks, I have added output from the log file. Oct 8 '14 at 11:45
• @ziutek - So there you have it: the dsfont and \bbm packages simply don't provide a double-struck (aka blackboard bold) 0. I suggest you peruse the documentation of the mathalfa package to choose a font package that does feature a double-struck 0 -- and 1.
– Mico
Oct 8 '14 at 11:55

I think the most elegant version (since it does not overwrite \mathbb) is the following:

\DeclareMathAlphabet{\mymathbb}{U}{BOONDOX-ds}{m}{n}
\begin{document}
$\mymathbb{0}$ \\
$\mymathbb{1}$
\end{document}

• Btw, use \DeclareMathAlphabet{\mymathbb}{U}{bbold}{m}{n} to use the bbold font instead of boondox Nov 6 '17 at 12:40
• This is a very nice answer. Welcome to the site! Nov 6 '17 at 12:50
• @dafrick You saved my life, THANK YOU!!!
– Y2H
Jun 8 '20 at 14:23

Thanks to @Mico, I found the following solution.

\documentclass{article}
\usepackage[bb=boondox]{mathalfa}
\begin{document}
$\mathbb{0}$ $\mathbb{1}$
\end{document}


\usepackage{bbold}

\begin{document}
$\mathbb{0}$ \\
$\mathbb{1}$
\end{document}


This also works. It's not the same font as used in the mathalfa package, but it also produces double struck 0s and 1s.