In another post, @Jubobs suggested to use the multicol
package around an algorithmic
environment, to typeset the algorithm in two columns.
Recently, I faced a rather aesthetic issue: It might be the case that one column has a long line, while all lines in the other column are short. Example:
Here's the code for the above picture:
\documentclass[twocolumn]{article}
\usepackage[width=11cm]{geometry} % page width is reduced to show the effect
\usepackage{multicol}
\usepackage{algorithm}
\usepackage{algpseudocode}
\begin{document}
\begin{algorithm*}[t]
\caption{An algorithm with a long line.}
\label{alg1}
\begin{multicols}{2}
\begin{algorithmic}[1]
\If{$(x = y^2+1$ and $z=x^3+4y -12)$ }
\State $a \gets b + c$
\EndIf
\columnbreak
\State $x \gets 0$
\end{algorithmic}
\end{multicols}
\end{algorithm*}
\end{document}
Is it possible to typeset an Algorithmicx
environment in two columns, but with unequal widths? I tried the vwcol
package as suggested in this post, but I wasn't able to make it work for my case.