# Long algorithm doesn't split into two pages

I wrote an algorithm but it is long and it can't fit in one page but my problem is that it doesn't split into two page .. what happen is that a part of the algorithm appears in the first page and the rest disappears as shown in the figure below .. any solution?

and this is the code of the algorithm:

\begin{algorithm}
\caption{Calculating Score}\label{euclid}
\begin{algorithmic}[1]
\Procedure{CheckBetaamplitude}{}
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(1) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(2) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(3) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(4) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(5) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(6) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(7) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(8) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(9) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(10) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(11) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(12) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(13) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(14) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(15) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(16) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(17) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(18) \gets n/length()$

\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(19) \gets n/length()$

\State $score4 \gets Average(s)$
\EndProcedure
\end{algorithmic}
\end{algorithm}

• To me this algorithm looks like a loop: for (j = 1; j < 20; ++j) { i = find(absolute()<maxamp); n = length(i); s(j) = n/length() } score4 = Average(s); Of course this doesn't answer your question, but would resolve the problem. Oct 22 '14 at 13:54
• Thanks for your comment but it doesn't work as I didn't add the parameter of the functions .. which is different in each line.
– SMH
Oct 22 '14 at 22:12
• – user13907
Oct 23 '14 at 1:27
• Can I have the complete MWE?
– hola
Jun 6 '19 at 16:02

here you go :)

\begin{algorithm}
\caption{Calculating Score}\label{euclid}
\begin{algorithmic}[1]
\Procedure{CheckBetaamplitude}{}
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(1) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(2) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(3) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(4) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(5) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(6) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(7) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(8) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(9) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(10) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(11) \gets n/length()$
\EndProcedure
\algstore{myalg}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\begin{algorithmic} [1]
\algrestore{myalg}
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(12) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(13) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(14) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(15) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(16) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(17) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(18) \gets n/length()$
\State $i \gets find(absolute()<maxamp)$
\State $n \gets length(i)$
\State $s(19) \gets n/length()$
\State $score4 \gets Average(s)$
\end{algorithmic}
\end{algorithm}

• Hello, in this I face a problem that the text that is written after it goes in front . How to get rid of it. Jun 6 at 16:56