Symbol for a set of integers in LaTeX
Some general comments and observations:
Assuming you use pdfLaTeX to compile your document, then unless you either load a font that natively provides "blackboard bold" (aka "double-struck") uppercase letters or load some other package which loads a suitable math font, you will need to load the
amsfonts
package in order to access the\mathbb
macro.Loading the
amssymb
package "works" too, sinceamssymb
loadsamsfonts
automatically.The pdfLaTeX kernel does not provide commands named
\N
and\Z
by default. (Aside: I have no idea why the website you provide a link to claims that one can use\N
directly in a LaTeX document.) However, as is shown below, it's rather straightforward to create macros named\N
and\Z
which, in turn, execute\mathbb{N}
and\mathbb{Z}
, respectively. (Or, if you prefer, load thedsfont
package and define\N
, say, via\newcommand{\N}{\mathds{N}}
.)If you can use either LuaLaTeX or XeLaTeX to compile your document, you may want to load the
unicode-math
package to get access to its\symbb
macro. This lets you create double-struck characters not just for uppercase letters but for lowercase letters and numerals as well. An example:$\symbb{ABCabc123}$
. A
The test program used to create the following screenshot employs pdfLaTeX and shows the symbols frequently used to denote the sets of integers ("Natürliche Zahlen" in German), whole numbers ("ganze Zahlen"), rational numbers, real numbers, and complex numbers.
\documentclass[border=1pt]{standalone}
\usepackage{amsfonts} % for "\mathbb" macro
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\C}{\mathbb{C}}
\begin{document}
$\N \quad \Z \quad \Q \quad \R \quad \C$
\end{document}
As said by others, \mathbb
is defined in amsfonts
. For example,
is obtained with the following code.
\documentclass{article}
\usepackage{amsmath,amsfonts}
\begin{document}
\(\mathbb{Z}\)
\end{document}
However, I think it's worth here to mention the existence of the mathalpha
package (see the documentation here) which allows to use many fonts with \mathbb
. For example,
\documentclass{article}
\usepackage[bb=ams]{mathalpha}
\begin{document}
\(\mathbb{Z}\)
\end{document}
gives the same output than on the image given earlier. But other fonts could be used, for example
is obtained by replacing bb=ams
with bb=boondox
in the preceding code, and
is obtained with bb=pazo
.
The other answers all say how to use legacy 8-bit fonts, which still work. If you’re using modern fonts with LuaLaTeX or XeLaTeX, it’s enough to load unicode-math
. It also defines \BbbZ
and lets you type in ℤ in your source.
You can also write \newcommand\Z{\mathbb Z}
if you want that alias.