# Divide an algorithm on two pages [duplicate]

\usepackage{algorithm}
\usepackage{algorithmic}
\begin{document}
\begin{algorithm}[H]
\caption{My algo}
\begin{algorithmic}[1]
\STATE instruction 1
\STATE instruction 2
......................Many instructions
\end{algorithmic}
\end{algorithm}
\end{document}


My algorithm occupies an entire page, is that it is possible to divide it on two pages? Thank you so much.

-

## marked as duplicate by Svend Tveskæg, karlkoeller, Jesse, Mico, KurtJan 21 '15 at 12:09

I would suggest you to use algorithmicx and its algcompatible variant instead of algorithmic; the former is more versatile and powerful, offers you a lot of possibilities for customization and an easy way to split algorithms, using \algstore and \algrestore; a little example:

\documentclass{article}
\usepackage[paperheight=6\baselineskip]{geometry}% just for the example
\usepackage{algorithm}
\usepackage{algcompatible}

\begin{document}

\begin{algorithm}[H]
\caption{My algo}
\begin{algorithmic}[1]
\STATE instruction 1
\STATE instruction 2
\algstore{testcont}
\end{algorithmic}
\end{algorithm}

\begin{algorithm}[H]
\caption{My algo - Part 2}
\begin{algorithmic}[1]
\algrestore{testcont}
\STATE instruction 3
\STATE instruction 4
\end{algorithmic}
\end{algorithm}

\end{document}


-
Thank you so much for answer :) Please i have one more question: when i divide the algorithm after an IF and before an EndIF, i have an error , have you an idea please? – researcher Dec 11 '12 at 15:36
Please, i'd like to ask if it's possible to have Algorithm1 My algo: Part2 ? – researcher Jun 4 '13 at 11:04