[Tex/LaTex] Undefined Control Sequence when using $\R$

math-modemath-operatorssharelatex

Using the following packages;

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{fancyhdr}
\usepackage{amsthm}     
\usepackage{float}
\usepackage[round]{natbib}
\usepackage{lastpage}
\usepackage{indentfirst}
\usepackage{graphicx}
\usepackage{amsmath}

It says undefined control sequence when writing

{It is called a simple arc of a curve, the set $C$ of points $M(x,y) \in \text{$\R$} ^2 $ 
(two-dimensional Euclidean space) satisfying the equation:} 

also changing this to the following doesn't work

{It is called a simple arc of a curve, the set $C$ of points $M(x,y) \in \R ^2 $ 

I have included

\usepackage{amsmath}

like it says to do to fix the issue on most forums

Best Answer

To expand on the excellent accepted answer: There are many alternatives to amsfonts for this symbol.

In the modern toolchain, there is no need to load any additional packages beyond unicode-math to get a ℝ that looks like the one from the early answer. It is already set up by default.

However, you can load the double-struck alphabet from any math font, or any display font that you’d rather use, with the range= option of \setmathfont. For example, to use Typoliner:

\documentclass[varwidth]{standalone}
\usepackage{unicode-math}

\defaultfontfeatures{Scale=MatchUppercase}

\setmathfont{Latin Modern Math}
\setmathfont[range=bb]{Typoliner-RW-Light.ttf}

\newcommand\setR{\symbb{R}}

\begin{document}
Let \(S \subset \setR\).
\end{document}

Typoliner sample

If you need compatibility with PDFLaTeX, or you would rather use a legacy NFSS font, you might want to use the mathalfa package to select your supplemental math alphabets.