
Tenho um algoritmo composto por três páginas, posso usar use \algstore
e \algrestore
muitas vezes para dividir esse algoritmo nestas páginas?
Responder1
Sim, você pode fazer isso quantas vezes quiser:
\documentclass{article}
\usepackage{algorithm,algpseudocode}
\begin{document}
\begin{algorithm}
\caption{Part 1}
\begin{algorithmic}[1]
\If {$a>b$}
\ForAll{x}
\State y
\EndFor
\algstore{part1}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\caption{Part 2}
\begin{algorithmic}[1]
\algrestore{part1}
\Else
\ForAll{z}
\State t
\EndFor
\algstore{part2}
\end{algorithmic}
\end{algorithm}
\begin{algorithm}
\caption{Part 3}
\begin{algorithmic}[1]
\algrestore{part2}
\State R
\EndIf
\end{algorithmic}
\end{algorithm}
\end{document}
Observe que ele ainda controla os números das linhas e também fará isso com incrementos maiores.