1つのアルゴリズムに対して\algstoreと\algrestoreを何度も使用する

1つのアルゴリズムに対して\algstoreと\algrestoreを何度も使用する

3 つのページで構成されるアルゴリズムがあります。use と を\algstore\algrestore度も使用して、このアルゴリズムをこのページに分割できますか?

答え1

はい、何度でもこれを実行できます。

サンプル出力

\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}

行番号も追跡され、より大きな増分でも追跡されることに注意してください。

関連情報