# Algorithm spanning two columns error with \prevdepth [closed]

I am trying to use the algorithm command to display an algorithm that spans two columns in a two column document. However, I am getting an error message with \prevdepth that I do not understand. Below is a minimal example that illustrates the problem. Note that this example uses the sigplanconf.clf class file:

\documentclass[preprint]{sigplanconf}
\usepackage{subfigure}
\usepackage{fixltx2e}
\usepackage{algorithm}

\begin{document}

\title{a title }

\authorinfo{an author}
\maketitle

\begin{abstract}
abstract
\end{abstract}

\section{a section }

\begin{algorithm*}
\begin{verbatim}
a long line of text goes here that will take up too much space and need to span columns
\end{verbatim}
\end{algorithm*}

\end{document}


If I run latex with algorithm instead of algorithm* (note the difference with *) I do not get any error messages. However the algorithm text gets mixed with text in the right hand column.

However, if I use algorithm* I get the following error message that I do not understand:

! Improper \prevdepth. <recently read> \prevdepth
\subfig@end@float ...-\@Miv \@tempdima \prevdepth
\vbox {}\prevdepth \@tempd...

\end@dblfloat ...\expandafter \@gobble \end@float
\fi \else \end@float \fi  \end #1->\csname end#1\endcsname
\@checkend {#1}\expandafter \endgroup \if@e... l.291 \end{algorithm*}
?  ! Emergency stop. <recently read> \prevdepth
\subfig@end@float ...-\@Miv \@tempdima \prevdepth
\vbox {}\prevdepth \@tempd...

\end@dblfloat ...\expandafter \@gobble \end@float
\fi \else \end@float \fi  \end #1->\csname end#1\endcsname
\@checkend {#1}\expandafter \endgroup \if@e... l.291 \end{algorithm*}


I guess there is some conflict with the combination of subfigure fixltx2e and algorithm because when I was creating an example to illustrate the problem I found that if I removed either fixltx2e or subfigure the problem disappeared. So I will check my paper to see if I need both of those packages (I'm helping with editing so I'm not sure if they are needed). But if anyone happens to look at this example and understands what is causing the error I would be interested in understanding the root cause.

-
Can you work out a minimal example we can play with? – egreg Nov 28 '12 at 22:56
As egreg mentioned, we need a minimal example; the following simple test document doesn't produce any errors: \documentclass[twocolumn]{article} \usepackage{algorithm} \usepackage{algpseudocode} \begin{document} \begin{algorithm*} \begin{algorithmic} \State x \end{algorithmic} \end{algorithm*} test \end{document}. – Gonzalo Medina Nov 28 '12 at 22:58
okay I'll work on getting a minimal example together. – Gabriel Nov 28 '12 at 23:06
You get that error for trying to read \prevdepth when you are in horizontal (LR) rather than vertical mode \hbox{\dimen0=\prevdepth} being the simplest thing. So it is presumably related to your float layout (subfig?) – David Carlisle Nov 28 '12 at 23:12
The problem seems to be with the (obsolete) package subfigure; you may try with \usepackage[caption=false]{subfig} in its place, changing the \subfigure or \subtable commands into \subfloat. – egreg Nov 28 '12 at 23:50