# Remove line numbering from algorithmicx procedure/function

I would like the lines of "procedure" and "end procedure", "function", and "end function" etc to not be numbered.

For example, the default behavior produces this:

1 procedure hasNext(v,V,s)
2  solution <-- findSolution()
3 end procedure

but I would like to have this:

procedure hasNext(v,V,s)
1    solution <-- findSolution()
end procedure

Is this possible?

-
Welcome to TeX.sx! – Andrew Uzzell Nov 9 '12 at 11:48

The following is a workaround, since this package does not seem to provide any option to show this behavior.

The \Procedure and \EndProedure control sequences are replaced by \Statex, which results in a line not being numbered. The drawback is that the procedure markup needs to be inserted by hand.

\documentclass{article}
\usepackage{algpseudocode}

\begin{document}

\begin{algorithmic}[1]
\Statex{{\bf procedure} Euclid ($a,b$)}\Comment{The g.c.d. of a and b}
\State $r\gets a\bmod b$
\While{$r\not=0$}\Comment{We have the answer if r is 0}
\State $a\gets b$
\State $b\gets r$
\State $r\gets a\bmod b$
\EndWhile\label{euclidendwhile}
\State \textbf{return} $b$\Comment{The gcd is b}
\Statex{\bf end procedure}
\end{algorithmic}

\end{document}
-
Thanks @guillem, it seems that there is no other way to do it. – Asterios Nov 9 '12 at 15:56
You're welcome. – guillem Nov 12 '12 at 6:33