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


closed as unclear what you're asking by ShreevatsaR, JouleV, Kurt, Phelype Oleinik, RaajaFeb 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.

• Welcome to TeX.SE! Can you please show us some TeX code resulting in errors? If this is a pure r question please ask on a r page ... – Kurt Dec 29 '18 at 12:56
• @Kurt I can't seem to find any error. It just comes out as \mathds in red in the output file – George Dec 29 '18 at 13:15
• I do not know what r does with that file you shows. To change this question to a valid question here (LaTeX and friends!) please show us the resulting, complete and compilable TeX code we can test on our own computer. Then we can help you. I for example do not have r installed and can not help as it stands now ... – Kurt Feb 27 at 16:37

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.