I'm trying to get the math 1 character in an rmarkdown file. \mathbb{1} just produces a simple 1, and \mathbbm{1} / \mathds{1} does not compile for some reason.

title: "A3"
  - \usepackage{mathtools}
  - \DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
  - \usepackage{dsfont}

closed as unclear what you're asking by ShreevatsaR, user156344, Kurt, Phelype Oleinik, Raaja Feb 27 at 17:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


Although I can’t tell for sure unless you post a MCVE, this looks like you aren’t including the font package you want.

For new documents, I recommend you use the modern toolchain, with either LuaLaTeX or XeLaTeX and the unicode-math package. With this, \mathbb{1} works out of the box. You can load any font you like as your \mathbb font with the [range=bb] option of \setmathfont.

If you need to use the legacy toolchain, the classic \mathbb command supports only capital letters. However, some font packages, including stix2, enable \mathbb{1}. The \mathds command is from dsfont.

It is also possible to load a double-struck font containing numbers as a symbol font and access its gliphs with \DeclareMathSymbol, or as a text font and wrap it in \mbox or \text to use in math mode.

If you’re converting to HTML in any case, you might try replacing dsfont with amssymb.

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