"Missing number, treated as zero." in LaTex

Tim picture Tim · May 3, 2010 · Viewed 24.5k times · Source

I want to get the Roman number of 2. So I use $\Roman{2}$ inside text. But then I got an error

Missing number, treated as zero.

How can I fix it?

Thanks and regards!

Answer

Olivier Verdier picture Olivier Verdier · May 3, 2010

I would suggest to use that snippet:

\makeatletter
\newcommand{\rmnum}[1]{\romannumeral #1}
\newcommand{\Rmnum}[1]{\expandafter\@slowromancap\romannumeral #1@}
\makeatother

now you can call:

\Rmnum{2} % II
\rmnum{2} % ii