算法未继续到 IEEE 期刊的下一页

算法未继续到 IEEE 期刊的下一页

我有一个很长的算法,它从 IEEE 期刊模板中获取了超过一页的双栏格式内容。该算法不会继续到下一页,而是将文本推到页面底部。

请参见下面的示例这里我也试过这个方法. 有什么建议可以解决这个问题吗?

\documentclass{IEEEtran}
\pagestyle{empty}
\usepackage{algorithmic}

\newsavebox{\ieeealgbox}
\newenvironment{boxedalgorithmic}
  {\begin{lrbox}{\ieeealgbox}
   \begin{minipage}{\dimexpr\columnwidth-2\fboxsep-2\fboxrule}
   \begin{algorithmic}}
  {\end{algorithmic}
   \end{minipage}
   \end{lrbox}\noindent\fbox{\usebox{\ieeealgbox}}}

\begin{document}

\begin{boxedalgorithmic}
\REQUIRE $n \geq 0 \vee x \neq 0$
\ENSURE $y = x^n$
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH

\end{boxedalgorithmic}

\end{document}

在此处输入图片描述

答案1

该解决方案使用 tcolorbox。

\documentclass{IEEEtran}
\pagestyle{empty}
\usepackage{algorithmic}
\usepackage{tcolorbox}
\tcbuselibrary{breakable}

\newsavebox{\ieeealgbox}
\newenvironment{boxedalgorithmic}
  {\begin{tcolorbox}[breakable]
   \begin{algorithmic}}%
  {\end{algorithmic}%
   \end{tcolorbox}}

\begin{document}

\begin{boxedalgorithmic}
\REQUIRE $n \geq 0 \vee x \neq 0$
\ENSURE $y = x^n$
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH
\STATE FFFFYJTFYH

\end{boxedalgorithmic}

\end{document}

相关内容