I have several algorithms written down in a single file and would like latex to spread them across the document to save spaces. For example an algorithm can be just 3 or 4 lines and another can be 20 to 30 lines. So how do I tell latex to squeeze the smaller algorithms among the text in a document.
\documentclass{llncs}
\usepackage{llncsdoc}
\usepackage{lipsum}
\usepackage[ruled,vlined,linesnumbered,noresetcount]{algorithm2e}
\AlgoDisplayBlockMarkers
\begin{document}
\lipsum
\begin{algorithm}
\caption{alg1\label{1}}
...\;
...\;
...\;
...
\end{algorithm}
\begin{algorithm}
\caption{alg2\label{2}}
...\;
...\;
...
\end{algorithm}
\begin{algorithm}
\caption{alg3\label{3}}
...\;
...\;
...\;
...
\end{algorithm}
\begin{algorithm}
\caption{alg4\label{4}}
...\;
...\;
...\;
...\;
...
\end{algorithm}
\lipsum
\end{document}
{algorithm}[h]then it interleaves them with text, but if I just specify{algorithm}it puts all the algorithms together. – arunmoezhi Jul 22 '14 at 17:51