I am writing an algorithm with the algorithmic environment and Latex keeps pushing it on the last page, no matter what I do, this is just a short example.
\documentclass[a4paper,10pt, twoside]{book}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage[utf8]{inputenc}
\begin{document}
\begin{algorithm}[h]
\caption{my algorithm}
\label{alg:example}
\begin{algorithmic}
\STATE \REQUIRE \(F, G, j\)
\STATE \(B_{1} = \{b_{1}[1],\dots,b_{1}[|g_r|]\}\)
\STATE \(B_{1}\)
\FOR{\(i=1\) \TO \(n\)}
\STATE DO smoething...
\STATE
\ENDFOR
\ENDFOR
\end{algorithmic}
\end{algorithm}
\end{document}
The problem is that the algorithm is one page long, so I tried to put the h argument, and then after the algorithm a \newpage, so that everything else comes after it. But still it just ignores all my command and puts in on the last page, no matter what I try :S
algorithmis an environment with floating enabled. – Oct 05 '14 at 11:39hin the optional argument of thealgorithmenvironment. Let that environment "float". – jub0bs Oct 05 '14 at 11:42[h]tells latex the float isn't allowed at the top of a page (as not) or bottom (nob) or on a page of floats (nop) which gives latex very few places to place it so holding it to the end is quite likely – David Carlisle Oct 05 '14 at 11:49