1

I have a very long algorithm that takes more than a page in a double column format from an IEEE journal template. Instead of continuing to the next page, the algorithm pushes the text towards the bottom of the page.

Please see example below taken from here. I also tried this method. Any advise to handle this issue?

\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}

enter image description here

1
  • 2
    fbox, lrbox and minipage all create unbreakable boxes (must go on one page). framed and tcolorbox can handle mutiple pages/columns. – John Kormylo Jan 8 at 3:57
1

This solution uses 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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.