I'm having a problem with the package multicol
. I'm trying to split an algorithm into two columns. In particular, this algorithm is made up by two procedures. Unfortunately, in this particular case, one procedure is definitely longer than the other.
I'd like to know if there is a way to force multicol
to split this algorithm evenly, and better if I can chose whether to split evenly or split by function on a case-by-case basis.
I've tried using \columnbreak
in the middle but it did not work.
\documentclass[10pt,twoside]{report}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,width=150mm,top=25mm,bottom=25mm,bindingoffset=6mm]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage[numbers]{natbib}
\usepackage{color}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage[ruled]{algorithm2e}
\usepackage{multicol}
\begin{document}
\begin{algorithm}
\caption{My lovely procedure}
\begin{multicols}{2}
\SetKwFunction{funone}{MyFunction}
\SetKwFunction{funtwo}{OtherFun}
\SetKwProg{main}{Algorithm}{}{}
\main{\funone{b}}{
\KwData{MyData b}
\nl \While{this is true}{
\nl Do X\;
\nl Do X\;
}
\nl Do X\;
}
\setcounter{AlgoLine}{0}
\SetKwProg{foo}{Procedure}{}{}
\foo{\funtwo{h, s, d}}{
\KwData{MyData h, s, d}
\nl Do X\;
\nl Do X\;
\nl \If{Is his true?}{
\nl \eIf{Is this true?}{
\nl Do X\;
}{
\nl Do X\;
\nl Do X\;
\nl Do X\;
}
}
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
\nl Do X\;
}
\end{multicols}
\end{algorithm}
\end{document}