Is there a false loop in writing algorithms in IEEEtran

algorithmicxalgorithmsieeetran

The IEEEtran manual, suggests using algorithmicx.sty to write an algorithm and prohibits algorithm.sty:

However, do not use the floating algorithm environment of algorithm.sty or algorithm2e.sty as the only floating structures IEEE uses are figures and tables.

On the other hand, to use the layouts of algorithmicx.sty, e.g., algpseudocode, we have to use algorithm.sty, as according to the algorithmicx.sty manual:

To create floating algorithms you will need algorithm.sty

and without \usepackage{algorithm} it shows an error that

LaTeX Error: Environment algorithm undefined.

Then, how can we break this false loop?

Best Answer

You don't need algorithm. algorithm just provides a float to put stuff in, and that stuff can be virtually anything. The IEEE manual (section B. Algorithms) mentions:

IEEE publications use the figure environment to contain algorithms ...

So you'll need

\documentclass{IEEEtran}

% <some preamble stuff>

\usepackage{algpseudocode}

% <more preamble stuff>

\begin{document}

% <part of your document>

\begin{figure}
  \caption{<your algorithm caption>}
  \begin{algorithmic}[.]
    \State ...
    % <more pseudocode>
  \end{algorithmic}
\end{figure}

% <more of your document>

\end{document}