Hello,
I am writing an article now by using LNCS template. This template is a one column page. I have about four algorithms written by using THE PACKAGE algorithm2e. In order to save the space, I need to write those two algorithms in two columns. I tried to use multicols package but I failed.
can anyone help ME .
Page Layout ⇒ Wrtiting an algorithms by algorithm2e in two columns
NEW: TikZ book now 40% off at Amazon.com for a short time.

- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Wrtiting an algorithms by algorithm2e in two columns
Can you show us a minimal working example to reproduce the current setup?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Wrtiting an algorithms by algorithm2e in two columns
For example, in the following code, we can have four algorithms written by using algorithm2e package. My aim is to write these four algorithm once in two columns between Start and End statements. The code>
Code: Select all
\documentclass{llncs}
\usepackage{multicol}
\usepackage[commentsnumbered,linesnumbered]{algorithm2e}
\newcommand{\funcname}[1]{\textsc{#1}}
\begin{document}
\title{Slicing Technique}
\author{Husni Khanfar}
\institute{{School of Innovation, Design, and Engineering,
M{\"a}lardalen University,\\
SE-721 23 V{\"a}ster{\aa}s, Sweden\\
\email{husni.khanfar@mdh.se}
}
}
\maketitle
\begin{multicols}{2}
\textbf{This is not related Text .. just to test} .. CNN: One year from now, we will all exhale with exhaustion, looking back at a 2016 that kept the entire world on edge. Maybe 2017 will bring more calm, we will muse, knowing that a brand new U.S. president will usher in a change in policies for addressing intensifying global conflicts that America cannot afford to ignore.
Predicting the future may be a fool's errand, but there is little doubt that 2016 is shaping up as a pivotal year. Here are what look poised to be the biggest stories of next year:
\end{multicols}
Start .................................................................................................................
\begin{multicols}{2}
{
\begin{algorithm}[h]
\caption{\funcname{Check1}($ src, var$)}
\If{var=src}{var:= 20;}
\Else{var:=50; }
\end{algorithm}
}
{
\begin{algorithm}[h]
\caption{\funcname{Check2}($ src, var$)}
\If{var=src}{var:= 30;}
\Else{var:=90; }
\end{algorithm}
}
{
\begin{algorithm}[h]
\caption{\funcname{Check3}($ src, var$)}
\If{var=src}{var:= 11;}
\Else{var:=22; }
\KwRet\;
\end{algorithm}
}
{
\begin{algorithm}
\caption{\funcname{Check4}($ src, var$)}
\If{var=src}{var:= 66;}
\Else{var:=77; }
\end{algorithm}
}
\end{multicols}
End .................................................................................................................
\end{document}
Last edited by Stefan Kottwitz on Fri Jan 01, 2016 7:23 pm, edited 2 times in total.
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Wrtiting an algorithms by algorithm2e in two columns
Can you please make the example compilable? Without knowing which packages are involved, this is a stubling through the mist. How to create a minimal, yet compilable example?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Re: Wrtiting an algorithms by algorithm2e in two columns
I have just updated again. Please, check it ..
- Johannes_B
- Site Moderator
- Posts: 4182
- Joined: Thu Nov 01, 2012 4:08 pm
Wrtiting an algorithms by algorithm2e in two columns
Tricky case.
multicols is a helpful thing, but it has a huge disadvantage: floats are not allowed. Package algorithm2e uses float to typeset algorithms.
To achieve a twocolumn document, option
I am pretty sure this can be done using package algorithmic, a double figure float and minipages. And package caption to set up the float type (maybe package algorithm has to be loaded).
llncs
is for publication with Springer, you should check if two column subissions are allowed. multicols is a helpful thing, but it has a huge disadvantage: floats are not allowed. Package algorithm2e uses float to typeset algorithms.
To achieve a twocolumn document, option
twocolumn
is usually used. In this case, the title will be typeset wrong, but this can be changed easily. Unfortunately, this is a deadly comnbination and no algorithms are typeset. I am pretty sure this can be done using package algorithmic, a double figure float and minipages. And package caption to set up the float type (maybe package algorithm has to be loaded).
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.