title: Assistance required to split long Latex algorithm (algorithm2e) into two pages
body: <p>I am trying to split the algorithm into two pages but it is not working. Can any one help me with that please? I have tried to &quot;breakablealgorithm&quot; method described in this <a href="https://tex.stackexchange.com/questions/33866/algorithm-tag-and-page-break/33869#33869">link</a> but still it did not work. I am free to change the package but I will be needing the vlined algorithm which makes it easy to read the loops and functions.</p>
  <pre><code>\documentclass[11pt, a4paper, BCOR=10mm, english]{scrbook}
  \usepackage[ruled,vlined]{algorithm2e}
  \begin{document}
      \begin{algorithm}[]
          \SetAlgoLined
          \KwResult{Automatic System Update}
          \textbf{Pseudocode:}\\~\\
          \SetKwFunction{FUpdateSYS}{UpdateSYS}
          \SetKwFunction{FBuildEnsembleClassifier}{BuildEnsembleClassifier}
          %       \textbf{Declare} temp\_results = 0;\\
          %       \textbf{Declare} YAGER\_Fusion\_Result = 0;\\~\\
          \eIf{(Highest Prediction Index DSET \textbf{Equals} Highest Prediction Index Yager) \textbf{And} (Highest Prediction Index Yager \textbf{Not Equals} Last Index)}{
              \eIf{(Highest Prediction Value DSET \textbf{Greater Than} Threshold Value) \textbf{Or} (Highest Prediction Value Yager \textbf{Greater Than} Threshold Value)}{
                  \eIf{\textit{Temp\_Buffer} \textbf{Not Empty}}{                 
                      \eIf{\textit{Temp\_Buffer} \textbf{Greater Equals} \textit{Buffer\_Level}}{
                          \FUpdateSYS($sample\_data$, $master\_labels$);\\
                          \textbf{return} &quot;\textit{Show Respective Label}&quot;;\\
                      }{
                          \textbf{return} &quot;\textit{Show Respective Label}&quot;;\\
                      }
                  }{
                      \textbf{return} &quot;\textit{Show Respective Label}&quot;;\\
                  }
              }{
                  \textbf{Initiate System Warning} &quot;Known fault detected below threshold level&quot;;\\
                  \textbf{return} &quot;\textit{Show Respective Label}&quot;;\\
              }
          }{
              Temp\_Buffer = $sample\_data$;\\
              \textbf{return} &quot;\textit{Show Respective Label}&quot;;\\
          }~\\
          \SetKwProg{Fn}{Function}{:}{}
          \Fn{\FUpdateSYS{$sample\_data$, $master\_labels$}}{
              \FBuildEnsembleClassifier;\\
              \textbf{Declare} matrix = $M1 * M2$;\\
              \textbf{Get} matrix length $n$;\\
              \textbf{Get} matrix \textbf{Sum} $ALL$;\\
              \textbf{Get} matrix \textbf{HorizontalCells} $HOR$ \textbf{Except Last column};\\
              \textbf{Get} matrix \textbf{VerticalCells} $VER$ \textbf{Except Last row};\\
              \textbf{Get} matrix \textbf{DiagonalCells} $DIA$;\\
              \textbf{Get} HOR \textbf{Sum} $H$;\\
              \textbf{Get} VER \textbf{Sum} $V$;\\
              \textbf{Get} DIA \textbf{Sum} $D$;\\
              \textbf{Declare} BlankCells =  $ALL - H - V - D$;\\
              %           \textbf{Declare} K =  $1 - BlankCells$;\\
              \textbf{Declare} M1M2 = [ ];\\
              \For {i \textbf{in} \textbf{range}(\textbf{length}(HorizontalCells))}{
                  M1M2 \textbf{Append} $(HOR[i] + VER[i] + DIA[i])$;\\
              }
              M1M2 \textbf{Append} $(DIA[n] + BlankCells)$;\\
              \textbf{return} $M1M2$;\\
          }
          \SetKwProg{Fn}{Function}{:}{}
          \Fn{\FBuildEnsembleClassifier{$sample\_data$, $master\_labels$}}{
              \textbf{Declare} matrix = $M1 * M2$;\\
              \textbf{Get} matrix length $n$;\\
              \textbf{Get} matrix \textbf{Sum} $ALL$;\\
              \textbf{Get} matrix \textbf{HorizontalCells} $HOR$ \textbf{Except Last column};\\
              \textbf{Get} matrix \textbf{VerticalCells} $VER$ \textbf{Except Last row};\\
              \textbf{Get} matrix \textbf{DiagonalCells} $DIA$;\\
              \textbf{Get} HOR \textbf{Sum} $H$;\\
              \textbf{Get} VER \textbf{Sum} $V$;\\
              \textbf{Get} DIA \textbf{Sum} $D$;\\
              \textbf{Declare} BlankCells =  $ALL - H - V - D$;\\
              %           \textbf{Declare} K =  $1 - BlankCells$;\\
              \textbf{Declare} M1M2 = [ ];\\
              \For {i \textbf{in} \textbf{range}(\textbf{length}(HorizontalCells))}{
                  M1M2 \textbf{Append} $(HOR[i] + VER[i] + DIA[i])$;\\
              }
              M1M2 \textbf{Append} $(DIA[n] + BlankCells)$;\\
              \textbf{return} $M1M2$;\\
          }
          \textbf{End Function}
          \caption{Automatic System Update}
          \label{algorithm:RBS}
      \end{algorithm}
  \end{document}
  </code></pre>