In the example below, I have a very long algorithm, probably spanning 3 pages. I tried manually splitting the code up, but each time, a new algorithm number is generated. How do you maintain the same algorithm number across the span of the three pages by having the caption "Algorithm 1 continued" and also have the algorithm line numbers continue from the last page?
Another issue is that the three algorithm appear in the Table of Contents (TOC). How to fix the code so that only "Algorithm 1" appears in the TOC?
Here is the code:
\documentclass{article}
\usepackage{amsmath, amsfonts, amssymb, amsthm, bm}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage[most]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{tikzmark,calc,,arrows,shapes,decorations.pathreplacing}
\tikzset{every picture/.style={remember picture}}
\usepackage[linesnumbered,ruled,vlined]{algorithm2e}
\newcommand\mycommfont[1]{\footnotesize\ttfamily\textcolor{blue}{#1}}
\SetCommentSty{mycommfont}
\definecolor{mybluei}{RGB}{0,173,239}
\def\justifiedandcolored#1{%
\setlength\fboxrule{0pt}%
\setlength\fboxsep{0pt}%
\tikz[background rectangle/.style={top color=red!20,bottom color=white},
tight background,
show background rectangle]
\node [inner sep=0pt] (0,0) {#1};%
}
\makeatletter
\def\munderbar#1{\underline{\sbox\tw@{$#1$}\dp\tw@\z@\box\tw@}}
\makeatother
\begin{document}
\listofalgorithms
\colorbox{mybluei!05}{\color{black}
\begin{minipage}{\textwidth}
\SetAlgoLined
\SetNlSty{textbf}{}{:}
\begin{algorithm}[H]
\caption{Coolest Algorithm ever}
\lipsum[1-4]
\end{algorithm}
\end{minipage}}
\colorbox{mybluei!05}{\color{black}
\begin{minipage}{\textwidth}
\begin{algorithm}[H]
\caption{Coolest Algorithm ever (continued)}
\SetAlgoLined
\SetNlSty{textbf}{}{:}
Normalization of eigenfaces
\lipsum[1-4]
\end{algorithm}
\end{minipage}}
\colorbox{mybluei!05}{\color{black}
\begin{minipage}{\textwidth}
\begin{algorithm}[H]
\caption{Coolest Algorithm ever (continued)}
\SetAlgoLined
\SetNlSty{textbf}{}{:}
Normalization of eigenfaces
\lipsum[1-4]
\end{algorithm}
\end{minipage}}
\end{document}