During the IEEEtrans.tex, there is a comment below package algorithmic saying that

Do NOT use the algorithm floating environment provided by algorithm.sty (by the same authors) or algorithm2e.sty (by Christophe Fiorio) as IEEE does not use dedicated algorithm float types and packages that provide these will not provide correct IEEE style captions.

How can I make a beautiful box to show the pseudo code while using only the algorithmic package?


2 Answers 2


You can try something like this:




\REQUIRE $n \geq 0 \vee x \neq 0$
\ENSURE $y = x^n$


enter image description here

  • Many thanks for sharing! I still have a problem about the caption. Which part should I modify if I want to reference this box? Could I write the box part into a Table?
    – datcn
    Commented Jan 6, 2012 at 13:05
  • Update: I find the way of adding the title and caption. Move the box part into a '\begin{table}' and '\end{table}' is OK. Thanks again for your help.
    – datcn
    Commented Jan 6, 2012 at 13:20

Instead of Table, you can use a Figure, in which you can add caption and label.

\REQUIRE $n \geq 0 \vee x \neq 0$
\ENSURE $y = x^n$
\STATE $y \leftarrow 1$
\IF{$n < 0$}
\STATE $X \leftarrow 1 / x$
\STATE $N \leftarrow -n$
\STATE $X \leftarrow x$
\STATE $N \leftarrow n$
\WHILE{$N \neq 0$}
\IF{$N$ is even}
\STATE $X \leftarrow X \times X$
\STATE $N \leftarrow N / 2$
\ELSE[$N$ is odd]
\STATE $y \leftarrow y \times X$
\STATE $N \leftarrow N - 1$
\caption{My algorithm}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .