Latex 算法过长 分页显示方法

参考:

Algorithm tag and page break

Latex 算法过长 分页显示方法

1.引用algorithm包;

2.在\begin{document}前加上以下Latex代码:

\makeatletter
\newenvironment{breakablealgorithm}
  {% \begin{breakablealgorithm}
   \begin{center}
     \refstepcounter{algorithm}% New algorithm
     \hrule height.8pt depth0pt \kern2pt% \@fs@pre for \@fs@ruled
     \renewcommand{\caption}[2][\relax]{% Make a new \caption
       {\raggedright\textbf{\ALG@name~\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% \@fs@post for \@fs@ruled
   \end{center}
  }
\makeatother

3.使用\begin{breakablealgorithm}\end{breakablealgorithm}替换\begin{algorithm}\end{algorithm}.

2017.12

posted @ 2017-12-16 16:34  Wasdns  阅读(12029)  评论(0编辑  收藏  举报