3
\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.

Gonzalo Medina
  • 505,128
researcher
  • 4,555

1 Answers1

2

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}

enter image description here

Gonzalo Medina
  • 505,128
  • 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 04 '13 at 11:04