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}

1
  • 1
    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. Commented Oct 13, 2014 at 22:55

1 Answer 1

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}
1
  • 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, ... Commented Oct 14, 2014 at 13:43

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.