[Tex/LaTex] Do ℕ, \mathbb{N}, \BbbN, \symbb{N} effectively differ, and is there a “canonical” specification of the naturals

amssymbblackboard;symbolsunicode-mathxetex

Continuing https://math.meta.stackexchange.com/a/22167/, as far as I understand, all the four of , \mathbb{N}, \BbbN, \symbb{N} work now, and \BbbN is advised against. Is there any reasonably default context (e.g., a self-constructed context that would redefine these macros and symbols wouldn't count) in which some of , \mathbb{N}, \BbbN, \symbb{N} produce different results than some others when using amssymb+unicode-math+{xe|lua}latex? Compiling the example

\documentclass{book}
\usepackage{fontspec}
\usepackage{amssymb}
\usepackage{unicode-math}
\usepackage{microtype}
\setmainfont{TeX Gyre Termes}
\setsansfont{TeX Gyre Heros}[Scale=0.88]
\setmonofont{TeX Gyre Cursor}
\setmathfont{TeX Gyre Termes Math}
\setmathfont{Asana Math}[
  range={\setminus},
]
\setmathfont{XITSMath-Regular}[
  Extension=.otf,
  range={"2A3E},
  BoldFont=XITSMath-Bold,
]
\begin{document}
\(ℕ \mathbb{N} \BbbN \symbb{N}\)
\end{document}

with xelatex, e.g., I get visibly indistinguishable letters

ℕℕℕℕ

I cannot distinguish them either when I put them as subscripts or superscripts.

Moreover, is there a consensus in the {xe|lua}[La]TeX world to name any of these ways as the standard way to denote the set of natural numbers?

(Of course, I leave aside the question whether the zero should belong to this set or not; it could flame up a war here and is up to the author anyway.)

Best Answer

tl;dr

It's completely the same.

Why do those four inputs produce the same output?

In unicode-math-table.tex we find

\UnicodeMathSymbol{"02115}{\BbbN}{\mathalpha}{/bbb n, open face n}

Every Unicode code point relevant for math has a name, so that unicode-math can do, in this case, the equivalent of

\Umathchardef`ℕ = "7 "0 "02115

(the second number could change in case range=bb is used to select a different font for these characters).

If you add \show\mathbb to your sample TeX file (after \begin{document}), you'll get

> \mathbb=\long macro:
->\symbb .

This almost answers your question. At least we know that

  1. typing or \BbbN is the same
  2. typing \mathbb{N} or \symbb{N} is the same

It only remains to discover what's the relationship between the two cases above. Simple: \symbb{N} does \BbbN. Not really by chaining N to Bbb, but something like that (it's more complicated because one can use range=bb to use a different font for blackboard bold letters).

Now we know that typing

$ℕ \BbbN \mathbb{N} \symbb{N}$

is exactly the same. The alias name \mathbb for \symbb is for backwards compatibility with older code.

Some explanation is in order. unicode-math used to have just \mathXX commands. However, it was realized that distinguishing between \mathXX and \symXX is necessary. The first form is about words used in math, the second form for single characters (and doesn't enforce ligatures if used for more characters in a row); these forms can point to different fonts. Typically, for instance, \mathbf will use the boldface text font, whereas \symbf{x} will use \mbfx, pointing to U+1D431 in the math font.

While the distinction is necessary for boldface, in the case of blackboard bold there is no usage of it as a text font, so no distinction is made between \mathbb and \symbb, by default. You (or a package) might redefine \mathbb to do something else (not that I recommend it).

What's the preferred form?

I'd avoid \BbbN and probably prefer \symbb for newer documents, unless it's possible to directly type in .

Related Question