I use the algorithm
float environment for pseudocode and want some algorithms to span two pages. That works fine with \algstore
and \algrestore
. However, I would like to omit these borders at the end of the first part of the algorithm and at the top of the continuing part.
Is there a way to remove them while keeping the remaining border lines?
What I have is something like:
\documentclass{article}
\usepackage{algorithm}
\usepackage{algcompatible}
\newcommand{\algoallowbreak}{\algstore{myalg}\end{algorithmic}\end{algorithm}
\begin{algorithm}
\begin{algorithmic}\algrestore{myalg}
}
\begin{document}
\begin{algorithm}[h]
\caption{Algorithm 1}
\begin{algorithmic}[1]
\State $a \gets b$
\State some other code
\algoallowbreak
\State some code that could possibly be wrap onto the next side
\end{algorithmic}
\end{algorithm}
\end{document}
And I want to remove the both border lines between algorithm line 2 and 3.
Best Answer
Here's one possible solution; it requires for you to issue
\BreakAlgo
before an algorithmth that will have the new specifications:The idea was to define two new styles for algorithms (one suppressing the bottom rule, the other one, suppressing the top rule) and applying these new styles conditionally depending on
\BreakAlgo
I also added an optional argument to
\algoallowbreak
so as to specify numbering in the continuation part; notice that this fixes the alignment problem you had in your original settings for the continuation. If the numbering will always be present, you don't need the optional argument and in this case the definition would beAnd then, in your document: