# mathbb not working and mathbbm/mathds not compiling in rmarkdown [closed]

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}
output:
html_document


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.