When defining a macro, is it possible to restrict the value of an argument, so that if the thing followed it is a number, then it takes it as an argument, but if it is not, then it is just empty.
To be concrete, I defined
\newcommand{\R}[1]{\ensuremath{\mathbb{R}^{#1}}}
for a real vector space, so the \R2
and \R3
give the 2-dim and 3-dim real spaces respectively. But what do I do if I want to input \R
only?