# Add Caption below algorithm environment

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.

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}


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}

\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.