This is my code:
\documentclass[11pt]{llncs}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{dsfont}
\usepackage{multicol}
\usepackage{fixltx2e}
\usepackage{multicol}
\newcommand\blfootnote[1]{%
\begingroup
\renewcommand\thefootnote{}\footnote{#1}%
\addtocounter{footnote}{-1}%
\endgroup
}
\usepackage[T1]{fontenc}
\usepackage{comment}
\usepackage{amsmath}
\setcounter{MaxMatrixCols}{20}
\usepackage[margin=1in]{geometry}
\usepackage[boxruled, linesnumbered]{algorithm2e}
\usepackage{xcolor}
\usepackage{setspace}
\usepackage{hyperref}
\definecolor{bl}{rgb}{0.0,0.2,0.6}
\definecolor{dark-red}{rgb}{0.4,0.15,0.15}
\definecolor{dark-blue}{rgb}{0.15,0.15,0.4}
\definecolor{medium-blue}{rgb}{0,0,0.5}
\usepackage{sectsty}
\hypersetup{
colorlinks, linkcolor={dark-red},
citecolor={dark-blue}, urlcolor={medium-blue}
}
\usepackage{graphicx}
\usepackage[compact]{titlesec}
\begin{document}
\begin{multicols}{2}
\begin{algorithm}[!h]
\label{alg:quad}
\SetAlgoLined
\KwData{\textsc{Something} $S$, \textsc{Another thing} $A$}
do something with $S$\;
do another thing with $A$\;
\end{algorithm}
\columnbreak
\begin{algorithm}[!h]
\label{alg:cbl}
\SetAlgoLined
\KwData{\textsc{Something} $S$, \textsc{Another thing} $A$}
do something with $S$\;
do another thing with $A$\;
\end{algorithm}
\end{multicols}
\end{document}
The page appears blank.
When I remove \begin{multicols}...\end{multicols}
, the page returns to normal.
What I'm trying to do is to display those very short two algorithms side by side.
What shall I do?
Best Answer
The
multicol
package complains in the.log
:This happens even though you think you're forcing a placement
h
ere in the text, which seems like things shouldn't float. However, as is discussed in How to influence the position of float environments like figure and table in LaTeX?, placing a floath
ere doesn't always have the expected output nor does it change it's floating status.algorithm2e
provides a forced, non-floatH
ere placement though, which provides the desired output:If you're only after a side-by-side setting of two algorithms, then you can just set them using separate
minipage
s:The above
minipage
s are made to fit the original columns with a gap between them equalling\columnsep
.