[Tex/LaTex] Procedure numbering in algorithm2e

algorithm2ealgorithmsnumbering

When I use the package algorithm2e, I find the algorithms can be easily numbered, but the procedure cannot. How can I number the Procedures in algorithm2e, like Procedure 1, Procedure 2, …

%% Procedure 1

\begin{procedure}

\end{procedure}

%% Procedure 2

\begin{procedure}

\end{procedure}

Best Answer

The procedure environment is a special form of the algorithm environment. Passing the option procnumbered to algorithm2e numbers procedures using the same counter as algorithms:

enter image description here

\documentclass{article}
\usepackage[procnumbered,ruled]{algorithm2e}
\begin{document}

\begin{procedure}
  \caption{myproc()}
  This is a procedure
\end{procedure}

\begin{algorithm}
  \caption{My algorithm}
  This is a procedure
\end{algorithm}

\end{document}