[Tex/LaTex] Algorithm with Latex ( Package algorithmicx)

algorithmicx

This is my algorithm:

 \usepackage{graphicx}
 \usepackage[linesnumbered,ruled,vlined]{algorithm2e}
 \usepackage{algorithmicx}
 \usepackage{algpseudocode}
 %\usepackage{algorithmic}
 \usepackage{float}
 \begin{document}
 \begin{algorithm}
 \caption{Euclid's algorithm}\label{euclid}
 \begin{algorithmic}[1]
 \Procedure{Euclid}{$a,b$}
 \State $r\gets a\bmod b$
 \While{$r\not=0$}
 \State $a\gets b$
 \State $b\gets r$
 \State $r\gets a\bmod b$
 \EndWhile
 \State \textbf{return} $b$\Comment{The gcd is b}
%\EndProcedure
 \end{algorithmic}
 \end{algorithm}
 \end{document}

i have this error:

./llncs1.dem: 102: Missing number, treated as zero /EndWhile

Have you an idea please ?

Best Answer

You could simply do this:

\documentclass{article}
\usepackage{algorithm} %ctan.org\pkg\algorithms
\usepackage{algpseudocode}
\begin{document}

\begin{algorithm}
 \begin{algorithmic}[1]
 \Procedure{Euclid}{$a,b$}
 \State $r\gets a\bmod b$
 \While{$r\not=0$}
 \State $a\gets b$
 \State $b\gets r$
 \State $r\gets a\bmod b$
 \EndWhile
 \State \textbf{return} $b$ \Comment{The gcd is b}
 \EndProcedure
 \end{algorithmic}
 \caption{Euclid's algorithm}
 \label{euclid}
\end{algorithm}

\end{document}

Some packages define these kinds of floating environments, like alg, but that conflicted also.