# How to get Roman line numbering in algorithmicx? What is the counter name?

I try to get Roman numbering but couldn't find how to change it in the package documentation. After some research, I figured out how to do it using the algorithm2e package. (Use algonl as optional command and then \renewcommand{\theAlgoLine}{\Roman{AlgoLine}}).

If I know the counter name for the algorithmicx package I could add the \renewcommand{thecountername}{\Roman{countername}} command.

I already wrote 8 algorithmns so if possible I would like to avoid rewriting them using the algorithm2e package.

My Example:

\usepackage[section]{algorithm}
\usepackage{algpseudocode}

\begin{document}

\begin{algorithm}
\caption{Algo-name}
\label{arnoldi}
\begin{algorithmic}[1]
\State algo
\end{algorithmic}
\end{algorithm}

\end{document}

-

Roman line numbering? Do you really think that this is a good idea? Arabic line numbering is hard coded. You will have to redefine either \ALG@step or \alglinenumber:

\documentclass{article}
\usepackage[section]{algorithm}
\usepackage{algpseudocode}
\makeatletter
%\renewcommand\alglinenumber[1]{\footnotesize\Roman{ALG@line}:}%alternative
\def\ALG@step%
{%
\ifthenelse{\equal{\arabic{ALG@rem}}{\ALG@numberfreq}}%
{\setcounter{ALG@rem}{0}\alglinenumber{\Roman{ALG@line}}}%<---
{}%
}%
\makeatletter
\begin{document}

\begin{algorithm}
\caption{Algo-name}
\label{arnoldi}
\begin{algorithmic}[1]
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\State algo
\end{algorithmic}
\end{algorithm}

\end{document}

-
The reason I want Roman line numbering is that I have equations as well and I want to give the equation arabic numbering since I have a lot equations so the Roman numbering gets big and looks stupid if I use \stackrel{}=. My algorithmns are relativly short (~15 lines of code tops) so I rather have them in Roman. I implemented your solution but I have one problem with it. When I refer to the algorithm lines its shown as an arabic number and not as a Roman number. – 1988WM Oct 22 '12 at 13:24
Well imho Roman looks numbering looks stupid too. To get the reference right add \renewcommand\theALG@line{\Roman{ALG@line}}. – Ulrike Fischer Oct 22 '12 at 13:36