3

This question already has an answer here:

I have a long algorithm that's taking three quarter of a page and so it's taking a whole page with an empty quarter. I want it to be continued with the previous text without leaving any empty place, that means that it will be divided into two pages.

I found answers here that allow to divide the algorithm into two previously set parts, however, I want the algorithm to dynamically fit into the two pages. How I can do that?

Here is an example of the situation that I am having:

\documentclass[a4paper,12pt]{report}
\usepackage{natbib}
\usepackage[francais]{babel}
\usepackage{url} 
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage{amsmath}
%\linespread{1.15}
\onehalfspacing
\usepackage{makecell}
\usepackage{tabularx}
\usepackage{amsmath}
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{blindtext}
\usepackage{enumitem}


\begin{document}
\blindtext
Qu’est que c’est?. C’est une phrase fran ̧cais avant le lorem ipsum. Loremipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisissem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdiet minec ante. Donec ullamcorper, felis non sodales commodo, lectus velit ultricesaugue, a dignissim nibh lectus placerat pede. Vivamus nunc nunc, molestie ut,ultricies vel, semper in, velit.
\begin{algorithm}[H]
\caption{XXX}\label{alg:ChainProcess}
\begin{algorithmic}[1]
\State \textbf{Entrées:} XXX
\State \textbf{Sortie:} XXX
\State XXX

\For{\texttt{(\textit{i allant de 1 à (T-1)})}}
    \State  XXX

    \For{\texttt{( XXX}}
        \State \textit{XXX}XXX
        \For{\texttt{(XXX)}}        
            \If{XXX)}

                \State \textit{XXX} XXX
                \State XXX

            \EndIf

        \EndFor

        \If{(XXX) } 
            \State xXX
        \EndIf
    \EndFor 
    %\State 
\EndFor 

\end{algorithmic}
\end{algorithm}

\end{document}

marked as duplicate by Community Jun 7 '17 at 9:03

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.