“Missing number, treated as zero” error in algorithm using algorithm2e package

I am new to LaTeX. I am writing a paper for ACM Journal. I am using algorithm2e package for an algorithm which gives me "Missing number, treated as zero" error message for almost every line in the algorithm. See below for an example algorithm that I found online which is similar to what I have:

\documentclass[acmsmall, review, manuscript]{acmart}
\citestyle{acmauthoryear}
\usepackage{amsmath} \usepackage{amssymb} \usepackage{amsfonts} \usepackage{subfigure}
\usepackage{mathptm} \usepackage{epsfig} \usepackage{latexsym} \usepackage{wrapfig}
\usepackage{placeins} \usepackage{epstopdf} \usepackage {algpseudocode}
\usepackage{mathtools} \usepackage{graphicx} \usepackage{enumerate}
\usepackage{booktabs}

\usepackage[ruled,vlines,lined]{algorithm2e}
\renewcommand{\algorithmcfname}{ALGORITHM}

\begin{document}
\begin{algorithm}[h]
\caption{Procedure For Algo testing}
\label{proc:sabs}
\begin{algorithmic}[1]
\Procedure {BellmanKalaba}{$G$, $u$, $1$, $p$}\\
\ForAll {$v \in V(G)$}
\State $1(v) \leftarrow \infty$
\EndFor
\State $1(u) \leftarrow 0$
\Repeat
\For {$1 \leftarrow 1, n$}
\State $min \leftarrow 1(v_i)$
\For {$j \leftarrow 1, n$}
\If {$min > e(v_i, V_j) + 1(v_j)$}
\State $min \leftarrow e(v_i, v_j) + 1(v_j)$
\State $p(i) \leftarrow v_j$

\EndIf
\EndFor
\State $1’(i) \leftarrow min$
\EndFor
\State $changed \leftarrow 1 \not= 1’$
\State $1 \leftarrow 1’$
\Until{$\neg changed$}
\EndProcedure
\Statex
\Procedure {FindPathBK}{$v$, $u$, $p$}\\
\If {$v = u$}
\State \textbf{Write} $v$
\Else
\State $w \leftarrow v$
\While {$w \not= u$}
\State \textbf{Write} $w$
\State $w \leftarrow p(w)$
\EndWhile
\EndIf
\EndProcedure
\end{algorithmic}
\end{algorithm}
\end{document}


When I compile this file, I have an error message for almost every line like in this image:

I want line number for each line in the algorithm. I really appreciate any help.

Thank you

• Welcome to TeX.SE. Please don't post screenshots of code. You can copy the code in the editor and mark it as such! – user31729 Mar 13 '17 at 20:22
• The example is also used in the algorithmicx manual (currently page 22, ctan.org/pkg/algorithmicx), however there the preamble (everything before \begin{document}) is different. Could you try using the full code from the manual? – Marijn Mar 13 '17 at 21:56
• The example your are using is in algorithmicx syntax, but as you want to use the algorithm2e package, you have to use another syntax. Have a look at the manual (currently page 5/section 3) of the algorithm2e to update your code with the right format. – epR8GaYuh Mar 14 '17 at 9:50