1

I want to add a caption below algorithm environment that spans over two column page in \documentclass[10pt, conference, compsocconf]{IEEEtran}. I use the following:

\usepackage[Algorithm,ruled]{algorithm}
\usepackage{float}

\begin{figure*}
    \begin{algorithm*}[H]
            This is algorithm
    \end{algorithm*}
\caption{Caption here}
\end{figure*}

But I get error ./main.tex:164: LaTeX Error: Float(s) lost. How can I fix that?

Thank you very much.

1

2 Answers 2

-1

You can have a caption below an algorithm using the algorithm2e package

\documentclass{article}
\usepackage[]{algorithm2e}

\begin{document}
    \begin{algorithm}
            This is algorithm
            \caption{Algorithm caption}
    \end{algorithm}
\end{document}
1

The issue here is that you're placing a starred float environment (algorithm*) inside another starred float environment (figure*). You can get away with it by using figure* and the algorithm with the [H]ere float specifier:

\documentclass[conference]{IEEEtran}

\usepackage[ruled]{algorithm}
%\usepackage{float} % Already loaded by the algorithm package

\begin{document}

\begin{figure*}
  \begin{algorithm}[H]
    This is algorithm
  \end{algorithm}
  \caption{Caption here}
\end{figure*}

\end{document}

Note that your algorithm captions will be printed as a figure caption. However, that might be what you're after.

You must log in to answer this question.

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