2

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?

enter image description here

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. – Ronald 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
  • Related? tex.stackexchange.com/questions/29816/algorithm-over-2-pages – user13907 Oct 23 '14 at 1:27
  • Can I have the complete MWE? – xxx--- Jun 6 '19 at 16:02
5

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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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