multiple algorithm2e algorithms in two column documents
algorithm2e
provides its own [H]
float parameter, which sidesteps setting its contents as a float. However, in twocolumn
mode, it produces an error. I'm not sure why. You can avoid this by setting \@latex@error
to \@gobble
temporarily. Using your example, I've added a \removelatexerror
macro inside a \begingroup
...\endgroup
. More specifically, the definition
\makeatletter
\newcommand{\removelatexerror}{\let\@latex@error\@gobble}
\makeatother
is placed inside a group, inside \myalgorithm
:
\newcommand{\myalgorithm}{%
\begingroup
\removelatexerror% Nullify \@latex@error
\begin{algorithm*}[H]
%...
\end{algorithm*}
\endgroup}
Also, since you're spreading the 4 algorithms across both columns, it's best to use figure*
rather than figure
:
Obviously you won't be using \myalgorithm
in your actual document. You could just place \removelatexerror
inside each of the subfigure
environments.
I had similar issues...
I simply removed [H] from the code as below.
\begin{algorithm*}[H]
to
\begin{algorithm*}
Then the issue solved.