# IEEE Algorithms in figure environment caption should read Algorithm

I need to write some pseudocode and am using the IEEE template. However, the guidelines say that algorithmic should be contained in a figure environment and that I am not supposed to use the algorithm package see here.

So far no problem just put everything in figure instead.

\begin{figure}
\begin{algorithmic}[1]
\item[\textbf{Input:}] some input
\item[\textbf{Output:}] Some output
\STATE $P \gets 1$
\STATE $X \gets 2$
\STATE \RETURN$X + P$
\end{algorithmic}
\caption{Algorithm that does stuff}
\label{MagicalAlg}
\end{figure}


The problem is that this gives me a caption reading Fig. 1. Algorithm that does stuff and I would like it to read Alg. 1. Algorithm that does stuff and not be numbered with the figures but separately.

Thanks for the help.

Edit: I have found a somewhat ugly workaround: I define a new environment based on the figure environment and rename the \figurename to Alg.. Then I needed to introduce two more counters, one as a placeholder(PlaceHolder) and one for keeping track of the actual numbering of the algorithms(BestAlgorithm). Otherwise the it would number algorithms and figure together.

\newcounter{BestAlgorithm}
\newcounter{PlaceHolder}

\newenvironment{BestAlgorithm}
{\setcounter{PlaceHolder}{\value{figure}}
\setcounter{figure}{\value{BestAlgorithm}}\begin{figure}
\renewcommand{\figurename}{Alg.} }
{\end{figure} \setcounter{figure}

After defining this in the beginning of the document, I can use BestAlgorithm instead of the figure environment.
• So the guidelines say to use the figure environment. Why are you changing something that might end up being changed back by them anyway? – Werner Jan 17 at 18:20