Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

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

share|improve this question

marked as duplicate by Svend Tveskæg, karlkoeller, Jesse, Mico, Kurt Jan 21 at 12:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

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

share|improve this answer
    
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

Not the answer you're looking for? Browse other questions tagged or ask your own question.