\documentclass[a4paper, 10pt, 3p, final, twocolumn, times]{elsarticle}
\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithm}[htbp]
\caption{somealg}
\label{alg}
\begin{algorithmic}[1]
\REQUIRE input
\ENSURE output
\STATE statement 1
\FOR {i = 1 to $l$}
\STATE statement in loop 1
\STATE statement in loop
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}
I want to add line number in my algorithm and the line number of the statement inside the "for" loop should be 2.1 instead of 3. How should I do? Thank you.
Best Answer
The following does not allow for nesting of loop structures within each other, but provides the sub-numbering of a pseudo-code grouping (like
\FOR
,\WHILE
,\LOOP
and\REPEAT
):