Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Blackboard Bold Digits and the Indicator Symbol in LaTeX: Working Alternatives to \mathbb

Tech 1

Why \mathbb often "fails" for digits and lowercase

With amsfonts/amssymb, \mathbb is typically available only for uppercase letters. Lowercase letters and numerals are not provided by the default Computer Modern-based blackboard bold font. For example, this compiles, but lowercase and digits won’t appear in double-struck style:

\usepackage{amssymb}  % or amsfonts

$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
$\mathbb{abcdefghijklmnopqrstuvwxyz}$\\
$\mathbb{0123456789}$

If you need a blackboard bold "1" for an indicator/characteristic function, or you want double-stroked digits/lowercase, you must load a different font.


Options that provide blackboard bold digits and lowercase

Fonts differ in coverage and visual style. Below are commonly used packages and how to use them.

1) bbm

  • Command: \mathbbm
  • Typical use case: indicator symbol (\mathbbm{1})
\usepackage{bbm}

% Examples
$\mathbbm{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
$\mathbbm{abcdefghijklmnopqrstuvwxyz}$\\
$\mathbbm{0123456789}$\\

% Indicator function of a set A
$\mathbbm{1}_{A}$

Notes:

  • \mathbbm is widely used for the indicator symbol. Glyph coverage for lowercsae and digits depends on this font; check your output for consistency across all characters.

2) dsfont

  • Command: \mathds
  • Provides a distinct double-stroke design, including digits and lowercase in many setups
\usepackage{dsfont}

% Examples
$\mathds{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
$\mathds{abcdefghijklmnopqrstuvwxyz}$\\
$\mathds{0123456789}$\\

% Indicator function
$\mathds{1}_{S}$

Notes:

  • \mathds is a frequent choice for \mathds{1}. Visual style differs from \mathbbm. Exact coverage can vary by distribution and font version.

3) bbold or mathbbol

  • Command: \mathbb (redefined by these packages)
  • Broader coverage but a stylized look some consider unsuitable for formal documents
% Choose one of the following:
% \usepackage{bbold}
% \usepackage{mathbbol}

% Examples (these packages redefine \mathbb)
$\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
$\mathbb{abcdefghijklmnopqrstuvwxyz}$\\
$\mathbb{0123456789}$\\

% Indicator function
$\mathbb{1}_{E}$

Notes:

  • These packages override \mathbb, which can affect other math fonts. Evaluate appearance and compatibility for your target venue.

4) newtxmath (common in ACM’s acmart)

  • Command: \vmathbb (or \varmathbb in some releases)
  • newtxmath often ships with article classes/templates (e.g., acmart), making it a convenient choice when external font packages are restricted
\usepackage{newtxmath}

% Provide a fallback alias in case your newtxmath defines \varmathbb instead
\providecommand{\vmathbb}{\varmathbb}

% Examples
$\vmathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
$\vmathbb{abcdefghijklmnopqrstuvwxyz}$\\
$\vmathbb{0123456789}$\\

% Indicator function
$\vmathbb{1}_{B}$

Notes:

  • If your template already loads newtxmath (e.g., acmart), you can use \vmathbb/\varmathbb without adding non-whitelisted packages. Confirm which macro your newtxmath version defines.

Quick macro for the indicator function

Pick one package and define a single macro for portability:

% Option A: bbm
\usepackage{bbm}
\newcommand{\ind}{\mathbbm{1}}

% Option B: dsfont
% \usepackage{dsfont}
% \newcommand{\ind}{\mathds{1}}

% Option C: mathbbol or bbold (redefines \mathbb)
% \usepackage{mathbbol}
% \newcommand{\ind}{\mathbb{1}}

% Option D: newtxmath
% \usepackage{newtxmath}
% \providecommand{\vmathbb}{\varmathbb}
% \newcommand{\ind}{\vmathbb{1}}

% Usage: \ind_{A}, \ind_{x>0}, etc.

One document to compare fonts side by side

The following sample prints uppercase, lowercsae, and digits with several packages. Uncomment the ones you want to try. Avoid loading conflicting packages simultaneously when producing final documents.

\documentclass{article}

% Comment/uncomment packages to compare
%\usepackage{amssymb}   % Standard \mathbb (capitals only)
%\usepackage{bbm}       % \mathbbm
%\usepackage{dsfont}    % \mathds
%\usepackage{bbold}     % or \usepackage{mathbbol} — redefines \mathbb
%\usepackage{mathbbol}
%\usepackage{newtxmath} % \vmathbb (or \varmathbb)

% Provide \vmathbb alias if \varmathbb is the provided macro
\providecommand{\vmathbb}{\varmathbb}

\begin{document}

% amsfonts/amssymb (capitals only)
% \noindent\textbf{amssymb/amsfonts + \string\mathbb:}\\
% $\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
% $\mathbb{abcdefghijklmnopqrstuvwxyz}$\\
% $\mathbb{0123456789}$\\[6pt]

% bbm
% \noindent\textbf{bbm (\string\mathbbm):}\\
% $\mathbbm{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
% $\mathbbm{abcdefghijklmnopqrstuvwxyz}$\\
% $\mathbbm{0123456789}$\\[6pt]

% dsfont
% \noindent\textbf{dsfont (\string\mathds):}\\
% $\mathds{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
% $\mathds{abcdefghijklmnopqrstuvwxyz}$\\
% $\mathds{0123456789}$\\[6pt]

% bbold/mathbbol (redefined \mathbb)
% \noindent\textbf{bbold/mathbbol (\string\mathbb):}\\
% $\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
% $\mathbb{abcdefghijklmnopqrstuvwxyz}$\\
% $\mathbb{0123456789}$\\[6pt]

% newtxmath
% \noindent\textbf{newtxmath (\string\vmathbb or \string\varmathbb):}\\
% $\vmathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\\
% $\vmathbb{abcdefghijklmnopqrstuvwxyz}$\\
% $\vmathbb{0123456789}$\\[6pt]

% Indicator examples (choose the matching macro for the active package)
% $\mathbbm{1}_{A} \quad \mathds{1}_{B} \quad \mathbb{1}_{C} \quad \vmathbb{1}_{D}$

\end{document}

Notes on compilers and templates

  • These packages work with pdfLaTeX; they also function under XeLaTeX/LuaLaTeX, though system font setup may affect appearance.
  • Some publication templates restrict nonstandard fonts. If using acmart, newtxmath is typically preloaded, so \vmathbb/\varmathbb is a practical route to a blackboard bold "1."

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.