## In Mathematics, the set of real numbers is the set consisting of rational and irrational numbers. It is customary to represent this set with special capital R symbols, usually, as blackboard bold \(\mathbf{R} \) or double-struck \(\mathbb{R} \). In this tutorial, we will learn how to write the set of real numbers in LaTeX!

## 1. Double struck capital R (using LaTeX mathbb command)

The most popular symbol nowadays for representing the set of real numbers is the double-struck capital R (\(\mathbb{R}\). ), and you may wonder, how one can write this in LaTeX? **The short answer is by using the \mathbb{} command which produces the double-struck capital letters.** This command requires loading amssymb package, created by the American Mathematical Society, and basically contains a large set of common mathematical symbols. It also provides certain special fonts, like **\mathcal that produce calligraphic letters**.

In the following example, we put these two commands into practice:

% Real numbers symbol in LaTeX \documentclass{article} % Required package \usepackage{amssymb} \begin{document} Let $f:U\subseteq \mathbb{R}^{3} \to \mathbb{R}$ be a real-valued function. Consider also the set $\mathcal{F}(\mathbb{R}^{n},\mathbb{R})$ of all scalar-valued multivariable functions. \end{document}

Compiling this code yields:

## 2. Double struck capital R without package

As a more curious fact, we can also produce a similar double-struck capital R using the basic roman typeface, without having to add extra symbols from external packages. This can be accomplished by changing the typeface inside math mode to roman, and then writing a capital I and a capital R next to each other, deleting the space between them with the command \! .

This means that ${\rm I\!R}$ produces the output \(\rm I\!R\), which doesn’t look as nice as the one provided by amssymb, but still does the trick.

## 2. Bold version of real number symbol

The other version of the symbol of the real number, the bold one, is produced using the bold mathematical typeface: $\mathbf{R}$ produces the output \(\mathbf{R}\).

## 3. Set of real numbers in LaTeX, a simplified appraoch

In practice, if you are writing a mathematical text that contains the symbol several times, you will not want to write it every time. Rather, I suggest you define a shortcut for it using a \newcommand declaration in the preamble. For instance,

\newcommand {\R}{\mathbb{R}}

will make $\R$ produce the output \(\mathbb{R}\). Be aware that with this definition you will have to be inside math mode to produce the symbol; otherwise, you will get an error.

There is a very useful command, called \ensuremath, that ensures you are always inside math mode when using the command, thus interpreting the command as inside math mode when you use it within text mode. This means that a new definition:

\newcommand{\R}{\ensuremath{\mathbb{R}}}

will make \R produce the output \(\mathbb{R}\), even if we omit the math mode delimiters $…$.

We reached the end of this short tutorial, If you have any remarks or suggestions, please feel free to reach us via email at admin@latex-tutorial.com