2

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}

  • When asking questions it is better to provide a full minimal working example (MWE) both in order to demonstrate what you are trying to do and to help others help you. The MWE should like like \documentclass...\begin{document}...\end{document}, it should compile and contain close to the minimal amount of code needed to explain/demonstrate what you are asking. This saves a lot of time for everyone. – Andrew Oct 13 '14 at 22:55
3

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}
  • Thanks. Is there a way of using two different counters for algorithms and procedures, say, Algorithm 1, Procedure 1, Algorithm 2, Procedure 2, Procedure 3, Algorithm 3, ... – John Smith Oct 14 '14 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.