![算法未继续到 IEEE 期刊的下一页](https://linux22.com/image/426796/%E7%AE%97%E6%B3%95%E6%9C%AA%E7%BB%A7%E7%BB%AD%E5%88%B0%20IEEE%20%E6%9C%9F%E5%88%8A%E7%9A%84%E4%B8%8B%E4%B8%80%E9%A1%B5.png)
我有一个很长的算法,它从 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}