splitted-code.tex 777 B

12345678910111213141516171819202122232425262728293031323334353637
  1. \documentclass[a5paper]{article}
  2. \usepackage{algorithm,algpseudocode}
  3. \usepackage{caption}
  4. \begin{document}
  5. \begin{algorithm}
  6. \caption{My algorithm}
  7. \begin{algorithmic}[1]
  8. \Procedure{Euclid}{$a,b$}\Comment{The g.c.d. of a and b}
  9. \State $r\gets a\bmod b$
  10. \While{$r\not=0$}\Comment{We have the answer if r is 0}
  11. \State $a\gets b$
  12. \State $b\gets r$
  13. \algstore{myalg}
  14. \end{algorithmic}
  15. \end{algorithm}
  16. \clearpage
  17. \begin{algorithm}
  18. \ContinuedFloat
  19. \caption{My algorithm (continued)}
  20. \begin{algorithmic}
  21. \algrestore{myalg}
  22. \State $r\gets a\bmod b$
  23. \EndWhile\label{euclidendwhile}
  24. \State \textbf{return} $b$\Comment{The gcd is b}
  25. \EndProcedure
  26. \end{algorithmic}
  27. \end{algorithm}
  28. \end{document}