I want to make an algorithm float and I use the algorithm2e package.
However, I can only use H for the algorithm.
If I use htbp, I will get a Missing number, treated as zero error at \begin{algorithm}.
Here is the example.
\documentclass[twoside]{article}
\usepackage{multicol}
\usepackage[ruled,vlined,linesnumbered]{algorithm2e}
\begin{document}
\begin{multicols}{2}
Test floating.
\begin{center}
\begin{minipage}{\columnwidth}
\begin{algorithm}[htbp]
\DontPrintSemicolon
\caption{Test Algorithm}
\KwIn{An Integer}
\KwOut{Hash Value}
\SetKwFunction{FFoo}{Foo}
\SetKwProg{Fn}{Function}{:}{}
\Fn{\FFoo{$i$}}{
\uIf{$i = 0$}{
\Return 0;
}
\Else{
\Return 1;
}
}
\end{algorithm}
\end{minipage}
\end{center}
\end{multicols}
\end{document}
minipage. And I also think thatmulticolsdoesn't like floats. – campa Nov 26 '20 at 09:42multicolsis from a template so I cannot modify it, whileminipagecan be removed. Hence, is there any solution to this problem? – Lesterth Nov 26 '20 at 10:46