参考:
Latex 算法过长 分页显示方法
1.引用algorithm
包;
2.在\begin{document}
前加上以下Latex代码:
\makeatletter
\newenvironment{breakablealgorithm}
{% \begin{breakablealgorithm}
\begin{center}
\refstepcounter{algorithm}% New algorithm
\hrule height.8pt depth0pt \kern2pt% \@[email protected] for \@[email protected]
\renewcommand{\caption}[2][\relax]{% Make a new \caption
{\raggedright\textbf{\[email protected]~\thealgorithm} ##2\par}%
\ifx\relax##1\relax % #1 is \relax
\addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##2}%
\else % #1 is not \relax
\addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##1}%
\fi
\kern2pt\hrule\kern2pt
}
}{% \end{breakablealgorithm}
\kern2pt\hrule\relax% \@[email protected] for \@[email protected]
\end{center}
}
\makeatother
3.使用\begin{breakablealgorithm}
和\end{breakablealgorithm}
替换\begin{algorithm}
和\end{algorithm}
.
2017.12
时间: 2024-10-08 16:10:03