# Roman numeral with Subscript

I'm trying to enter Roman numerals with subscripts, but doing $II_1$ is not working, as the II ends up being spaced out.

Is there any way to add a subscript, while making the Roman numeral elegant? Thanks!

## 2 Answers

The simple case is, as in comment, $\textrm{II}_1$. If you need use it many times, a macro may be useful:

\documentclass{article}

\begin{document}

\newcounter{myRom}
\newcounter{myarab}
\def\Rns#1#2{\setcounter{myRom}{#1}
\setcounter{myarab}{#2}\Roman{myRom}$_{\arabic{myarab}}$}

\Rns{3}{3}

\Rns{2016}{13}

\end{document}


The spacing is as a result of the letters being considered as factors in a multiplication. Since I in your case has a different meaning, you need to set it differently.

Below is a couple of macros that converts an integer to a roman numeral (\toroman or \toRoman) or sets it as \text (using amsmath) so it works in text or math mode:

\documentclass{article}

\usepackage{amsmath}

\newcommand{\toroman}[1]{\text{\romannumeral #1}}
\newcommand{\toRoman}[1]{\MakeUppercase{\toroman{#1}}}
\newcommand{\setRoman}{\text}

\begin{document}

Either \toroman{2016} or \toRoman{2016} and also $\toroman{2016}_1$ and $\toRoman{2016}_1$.
Finally, $\setRoman{II}_2$ is different from $\setRoman{mmxi}_3$.

\end{document}


Conversion from roman numerals to integer is also possible, if needed, using etoolbox. Also, if you wish to change the representation of the Roman numerals, consider reading Roman numerals with over- and underline.