[Tex/LaTex] Symbol for a set of integers in LaTeX

math-modesymbols

According to oeis.org, I should be able to write the symbols for the integers like so: \Z. However, this doesn't work. Here is my LaTeX file:

\documentclass{article}\usepackage{amsmath}
\begin{document}
$\mathcal {P} (\mathbb{Z})$
\Z
\end{document}

I have also tried following this question. However, again, no luck. Here is my code:

\documentclass{article}\usepackage{amsmath}
\begin{document}
$\mathbb{Z}$
\end{document}

I suspect I need to import a package. However, I don't know which, and none of the sources I have mentioned seem to refer to a package I need to import. How should I proceed?

Best Answer

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, since amssymb loads amsfonts 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 the dsfont 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.

enter image description here

\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}
Related Question