码迷,mamicode.com
首页 > 其他好文 > 详细

伪代码跨页显示

时间:2019-01-29 23:05:49      阅读:514      评论:0      收藏:0      [点我收藏+]

标签:contents   add   doc   dep   bre   content   str   break   tle   

1.在\begin{document}前面加入以下代码

 1 \usepackage{algorithm}
 2 \usepackage{algorithmic}
 3 \usepackage{float}
 4 \makeatletter
 5 \newenvironment{breakablealgorithm}
 6 {% \begin{breakablealgorithm}
 7     \begin{center}
 8         \refstepcounter{algorithm}% New algorithm
 9         \hrule height.8pt depth0pt \kern2pt% \@fs@pre for \@fs@ruled
10         \renewcommand{\caption}[2][\relax]{% Make a new \caption
11             {\raggedright\textbf{\ALG@name~\thealgorithm} ##2\par}%
12             \ifx\relax##1\relax % #1 is \relax
13             \addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##2}%
14             \else % #1 is not \relax
15             \addcontentsline{loa}{algorithm}{\protect\numberline{\thealgorithm}##1}%
16             \fi
17             \kern2pt\hrule\kern2pt
18         }
19     }{% \end{breakablealgorithm}
20         \kern2pt\hrule\relax% \@fs@post for \@fs@ruled
21     \end{center}
22 }
23 \makeatother

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

伪代码跨页显示

标签:contents   add   doc   dep   bre   content   str   break   tle   

原文地址:https://www.cnblogs.com/Advancingxq/p/10335936.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!