Using unicode ℝ as commands \mathbb{R}

\documentclass{article}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{ℝ}{\mathbb{R}}
\begin{document}

$ \mathbb{R} =1$ 

$ ℝ = 1 $

\end{document}

For XeLaTeX you can just remove the inputenc package, but in this case is simpler the David's suggestion of use unicode-math.


If you are using

\usepackage[utf8]{inputenc}

then just add

\DeclareUnicodeCharacter{211D}{\mathbb{R}}

With unicode TeX engines it is probably advisable to use unicode-math which would allow ℝ to be typeset directly, but if you are using 8bit math fonts still then you can use

\catcode`ℝ=13
\newcommandℝ{\mathbb{R}} 

Tags:

Macros