# mathbb-one `\mathbb{1}` for amssymb. amssymb's blackboard bold has no digits, so `\mathbb{1}` prints a stray symbol instead of the indicator 𝟙. mathbb-one adds the missing 1 and changes nothing else: ```latex \usepackage{amssymb} \usepackage{mathbb-one} $\mathbb{E}[\mathbb{1}_A] = \mathbb{P}(A)$ ``` The glyph is the 1 from Gilles F. Robert's bbm fonts, the usual choice for an indicator because it matches the Computer Modern style of `\mathbb`. bbm only exists as Metafont source, so pdfLaTeX embeds it as a 600 dpi bitmap. mathbb-one ships it as a Type 1 outline font instead. ![bbm bitmap (left) and mathbb-one (right), enlarged](doc/img/zoom.png) ## Compared with the alternatives Every answer to [TeX.SE question 26637](https://tex.stackexchange.com/q/26637), each set the way the answer suggests. Packages that replace `\mathbb` also change the letters next to the 1. ![blackboard-bold 1 options](doc/img/alternatives.png) ## Details - Works with pdfLaTeX, LuaLaTeX and XeLaTeX. Load it before or after amssymb. - `\mathbb{1}` works in subscripts and next to letters (`\mathbb{R1}`). Other `\mathbb` letters and ordinary digits are not affected. - `\Bbbone` is also defined, under the same name unicode-math uses. If unicode-math is loaded, mathbb-one does nothing and the math font's own 𝟙 is used. - Sizes follow amssymb: one design each for 5pt, 7pt and 10pt and up. So the 1 has the same weight relative to the letters as `\mathbb` does, in text and in subscripts. - mathbb-one doesn't need bbm or bbm-macros. ## OpenType version If you use LuaLaTeX or XeLaTeX with unicode-math, your math font already has a 𝟙. If you'd rather have bbm's, `opentype/mathbb-one.otf` provides just that glyph. Don't load mathbb-one.sty; take the 1 from the OpenType font instead: ```latex \usepackage{unicode-math} \setmathfont{NewCMMath-Regular.otf} \setmathfont[range="1D7D9]{mathbb-one.otf} % 𝟙 (U+1D7D9) comes from mathbb-one ``` This changes `\Bbbone`. unicode-math sets `\mathbb{1}` through its blackboard-digit alphabet instead, so if you write `\mathbb{1}`, use `range={"1D7D9,bb/num}`. The catch is that `\mathbb{0}`, `\mathbb{2}`, ... then come out empty, because the font only has the 1. XeLaTeX finds fonts by file name only if you write the `.otf` extension, as above. ## Install **From TeX Live or MiKTeX** (once mathbb-one is on CTAN): nothing to do, just `\usepackage{mathbb-one}`. If it's missing, run `tlmgr install mathbb-one` or use the MiKTeX console. **In a single project** (also Overleaf, or a journal submission): put these files **flat in the same folder as your main `.tex` file**, not in a subfolder: ``` paper.tex mathbb-one.sty mathbb-one.map mathbb-one5.tfm mathbb-one7.tfm mathbb-one10.tfm mathbb-one5.pfb mathbb-one7.pfb mathbb-one10.pfb ``` They're in this repo's `tex/`, `map/`, `tfm/` and `type1/` folders, and in the same folders of `mathbb-one.zip` from the [releases](https://github.com/t-a-beck/mathbb-one/releases). TeX finds them by name in the document's folder, but it doesn't search subfolders. To keep them in a subfolder instead, say `mathbb-one/`, add a file named `latexmkrc` next to your `.tex` file: ```perl # Let TeX find mathbb-one's files in the mathbb-one/ subfolder. foreach my $var ('TEXINPUTS', 'TFMFONTS', 'T1FONTS', 'TEXFONTMAPS') { ensure_path($var, './mathbb-one//'); } ``` This works when you build with `latexmk` (also via the LaTeX Workshop extension in VS Code, and on Overleaf, which reads a `latexmkrc` in the project root). **For all your documents:** run `make install`. It copies the files into your personal TeX tree (`TEXMFHOME`, usually `~/Library/texmf` on macOS or `~/texmf` on Linux), where they have to sit in the standard layout. To do it by hand, copy this repo's folders as follows: | This repo | Into `TEXMFHOME` | |---|---| | `tex/` | `tex/latex/mathbb-one/` | | `tfm/` | `fonts/tfm/public/mathbb-one/` | | `type1/` | `fonts/type1/public/mathbb-one/` | | `map/` | `fonts/map/dvips/mathbb-one/` | | `opentype/` | `fonts/opentype/public/mathbb-one/` | You don't need to run `updmap` or `mktexlsr`. `make uninstall` removes the files again. ## Building the fonts ```sh brew install potrace fontforge make fonts ``` `source/build.sh` renders the 1 of `bbm5`, `bbm7` and `bbm10` at high resolution with Metafont, traces it with potrace, and assembles a one-glyph `.pfb` with FontForge. `pk2pbm.py` needs only the Python standard library. `build_t1.py` runs inside FontForge's own Python. Run it from a path without spaces, because Metafont can't read them. `make doc` rebuilds the user guide [doc/mathbb-one.pdf](doc/mathbb-one.pdf) and the comparison sheet [doc/mathbb-one-compare.pdf](doc/mathbb-one-compare.pdf). `make ctan` builds `mathbb-one.zip`, the CTAN upload. `make release VERSION=x.y` builds that zip, tags `vx.y` and publishes a GitHub release with the zip and the user guide attached. Bump `\ProvidesPackage` in `tex/mathbb-one.sty` first. ## Licence See [LICENSE](LICENSE). In short, the bbm sources say: "You may freely use, modify and/or distribute this file." The fonts here are derived from them and are distributed on the same terms. `mathbb-one.sty` and the build scripts are under the LPPL 1.3c.