10

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.)

6

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 .

1
  • 1
    @user49915 Yes, indeed. Let me fix it: I copied the first match, but didn't notice the case. – egreg Apr 12 '19 at 13:26
14

The difference is mainly historical. \BbbN was created for the original amsfonts, pre-LaTeX; it should be considered obsolete now. (Oops! @egreg points out in a comment that \BbbN has been defined for unicode-math, so I was thinking of \Bbb{N}. That surely should be considered obsolete.) The original LaTeX equivalent is \mathbb{N}, and should still be reliable.

\symbb{N} was defined for fonts developed after the blackboard bold alphabet was added to Unicode.

The symbol itself (which I can't represent because it's not available on the aged laptop I'm using) depends on having a utf-8 capable input device, and is not available for pdflatex, which is still limited to 8-bit input.

All forms are equivalent, and the one you use depends on which flavor of LaTeX you're using. There may also be some restrictions associated with the publisher, if you're submitting your document for publication.

This may not give an unambiguous answer to your question, but it should give you some idea of how the development of the blackboard bold fonts and their support affects the decision of which should be used in what circumstances.

1
  • 2
    \BbbN is a specific command in unicode-math. The command \Bbb (with an argument) is obsolete. – egreg Apr 12 '19 at 6:24
11

If you modify your file to have

\showoutput
\(ℕ \mathbb{N} \BbbN \symbb{N} \showlists\)

Then you get

\mathord
.\fam0 ℕ
\mathord
.\fam0 ℕ
\mathord
.\fam0 ℕ
\mathord
.\fam0 ℕ
### horizontal mode entered at line 20

Four identical N, same font and same math class (mathord).

I would say use if you like Unicode input and \symbb{N} if you prefer ASCII TeX command markup. So they are the preferred forms, but as they are all the same thing it doesn't matter much which you use.

Of course other font setups may make things differ. In general \symxx will give you characters from the same font using the math alphabet ranges, whereas \mathxx might do that or might (as in classic tex) use a different font.

4
  • I'd use \mathbbm of the bbm package for all blackboard bold letters: clean, nice, slender. Blackboard bold is nowhere bold on the blackboard, this is why we simply double some of the lines. \mathbb N makes the slanted line bold. – Máté Wierdl Apr 16 '19 at 20:32
  • @MátéWierdl bbm font is OK if it fits with the overall font design but if you use unicode-math \symbb then the blackboard bold N comes from the same font as the normal N and is chosen by the font designer to match. – David Carlisle Apr 16 '19 at 21:44
  • I see, @DavidCarlisle. How do I access \symbb in pdflatex? – Máté Wierdl Apr 18 '19 at 1:23
  • @MátéWierdl \symbb is unicode-math so just xetex or luatex, the whole point of \symxx commands is that they access the math alphabets from the same font, position 8469 in the case of ℕ that can not mean anything in pdftex which has at most 256 characters per font, and most math fonts only have 128 characters – David Carlisle Apr 18 '19 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy