% mathbb-one user guide. Build with `make doc` (needs doc/mathbb-one-compare.pdf).
\documentclass[11pt]{article}
\usepackage[margin=2.5cm]{geometry}
\usepackage{amssymb,mathbb-one}
\usepackage{graphicx,hyperref}
\hypersetup{hidelinks}
\newcommand\pkg[1]{\textsf{#1}}
\newcommand\cs[1]{\texttt{\textbackslash#1}}
\title{The \pkg{mathbb-one} package\\[2pt]\large $\mathbb{1}$ for \pkg{amssymb}'s \cs{mathbb}}
\author{Thomas Beck\\\url{https://github.com/t-a-beck/mathbb-one}}
\date{v1.0, 2026/11/04}
\begin{document}
\maketitle

\section{Usage}
\pkg{amssymb}'s blackboard bold has no digits, so \verb|\mathbb{1}| prints a stray
symbol instead of an indicator function. Load \pkg{mathbb-one} and it works:
\begin{verbatim}
\usepackage{amssymb}
\usepackage{mathbb-one}
...
$\mathbb{E}[\mathbb{1}_A] = \mathbb{P}(A)$
\end{verbatim}
gives $\mathbb{E}[\mathbb{1}_A] = \mathbb{P}(A)$, and in a display
\[
  \mathbb{1}_{A\cap B} = \mathbb{1}_A\,\mathbb{1}_B, \qquad
  \sum_{i=1}^n \mathbb{1}\{X_i > t\} \le n .
\]
The package changes nothing else. Other \cs{mathbb} letters stay \pkg{amssymb}'s, and
an ordinary 1 is not affected.

\cs{Bbbone} is also defined, under the same name \pkg{unicode-math} uses, so the
source keeps working if the document later moves to Lua\LaTeX{} with
\pkg{unicode-math}. In that setup \pkg{mathbb-one} does nothing and the math font's own
1 is used.

\pkg{mathbb-one} works with pdf\LaTeX, Lua\LaTeX{} and Xe\LaTeX, and can be loaded before or
after \pkg{amssymb}. It has no options and needs neither \pkg{bbm} nor
\pkg{bbm-macros}.

\section{OpenType version}
Under Lua\LaTeX{} or Xe\LaTeX{} with \pkg{unicode-math} the math font already has a 1.
If you want bbm's instead, don't load \pkg{mathbb-one}; take the glyph from the OpenType
font \texttt{mathbb-one.otf}, which contains only U+1D7D9:
\begin{verbatim}
\usepackage{unicode-math}
\setmathfont{NewCMMath-Regular.otf}
\setmathfont[range="1D7D9]{mathbb-one.otf}
\end{verbatim}
This changes \cs{Bbbone}. \pkg{unicode-math} sets \verb|\mathbb{1}| through its
blackboard-digit alphabet instead, so for \verb|\mathbb{1}| use
\verb|range={"1D7D9,bb/num}|. Then \verb|\mathbb{0}|, \verb|\mathbb{2}|, \dots\ come
out empty, because the font contains only the 1.

\section{The glyph}
The 1 is the one from Gilles F.~Robert's \pkg{bbm} fonts, the closest match to the
Computer Modern style of \pkg{amssymb}'s letters. \pkg{bbm} exists only as Metafont
source, so pdf\LaTeX{} embeds it as a 600\,dpi bitmap. \pkg{mathbb-one} ships the 1 as
Type~1 outlines, traced from high-resolution Metafont output. Its metrics are
unchanged.

The 1 has three sizes, made from \texttt{bbm5}, \texttt{bbm7} and \texttt{bbm10}. Like
\pkg{amssymb}'s \texttt{msbm}, the 10\,pt design is scaled for every size from 8\,pt up,
so the 1 keeps the same weight relative to the letters at every size.

\begin{center}
  \includegraphics[page=1,width=\textwidth,trim=0 330 0 88,clip]{mathbb-one-compare.pdf}
\end{center}

\section{Alternatives}
Every answer to TeX.SE question 26637, each set as the answer suggests, next to its \cs{mathbb}
letters:
\begin{center}
  \includegraphics[page=2,width=\textwidth,trim=30 100 30 100,clip]{mathbb-one-compare.pdf}
\end{center}

\section{Licence}
\pkg{mathbb-one.sty} is distributed under the \LaTeX{} Project Public License 1.3c or
later. The fonts are derived from the \pkg{bbm} sources, which state ``You may freely
use, modify and/or distribute this file'', and are distributed on the same terms.
\end{document}
