[Tex/LaTex] \mathbb{Z} yields undefined control sequence error

errorsmath-modesymbols

I am using WinEdt 6 for compiling my TeX documents. I am getting an error with contains the line $\mathbb{Z}$ showing that it is undefined control sequence. How should I rectify it? Should I include any math packages or something. I am a beginner in using TeX.

Best Answer

Load the amsfonts package, this provides that command:

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

Optionally you could load amssymb, as this in turn loads amsfonts.

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

For reference, the Comprehensive LaTeX Symbol List has also a table of mathematical alphabets, and the packages required for using them. In the current version (dated 25 June 2020) of the document, it is table 316 with the caption Math Alphabets. It is the final table in chapter 3 Mathematical symbols.