# Putting multiple algorithm2e procedures in figure

I want to put some algorithm2e procedures into a figure like:

\begin{figure}
\begin{procedure}
some code \;
\caption{abc (n).}
\end{procedure}

\begin{procedure}
some code \;
\caption{abc (n).}
\end{procedure}

\caption{some procedures.}
\end{figure}


-
–  Peter Grill Nov 3 '12 at 6:14
Thanks for the editing! –  wei wang Nov 3 '12 at 6:18
Your welcome. You can use select the code and then hit the {} to format the code -- refer to Markdown help for more detauls. And keep in mind that while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and all the appropriate packages. While solving problems is fun, setting them up is not. Then those trying to help can simply cut and paste your MWE and get started on solving problem. –  Peter Grill Nov 3 '12 at 6:34

The procedure environment like algorithm is already a float so you cannot place it inside figure or table directly. See this discussion for more details.

You can place your procedures in minipage environment and add caption using captionof command from caption package. and then enclose them in figure environment as follows,

\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\begin{figure}
\begin{minipage}{\linewidth}
\begin{procedure}[H]
some code \;
\caption{abc (n).}
\end{procedure}
\end{minipage}
\begin{minipage}{\linewidth}
\begin{procedure}[H]
some code \;
\caption{abc (n).}
\end{procedure}
\end{minipage}
\caption{some procedures.}
\end{figure}
\end{document}


You may also want to look at the answers for this question.

-