1

In the AAAI template, if the algorithm is slightly long, but much shorter than the height of a column, it is pushed to the next column, no matter how short the current text is. How can I avoid this?

Here is an example:

\documentclass[letterpaper]{article}

\usepackage{aaai17}  %Required
\usepackage{times}  %Required
\usepackage{helvet}  %Required
\usepackage{courier}  %Required
\usepackage{url}  %Required
\usepackage{graphicx}  %Required
\frenchspacing  %Required
\setlength{\pdfpagewidth}{8.5in}  %Required
\setlength{\pdfpageheight}{11in}  %Required


\usepackage[vlined,ruled,linesnumbered]{algorithm2e}

\begin{document}

some texts.

\begin{algorithm}[htb]
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
  \KwRet{A}\;
\end{algorithm}

\end{document}

enter image description here

  • If you write more text than some texts. then the column will fill, so there does not seem to be a real problem, although it would be better to make the float 6pt smaller vertically – David Carlisle Mar 25 '17 at 20:27
  • @DavidCarlisle If you remove one line in the algorithm, it will be moved to the left. You can add some more texts and you will see that there are still significant amount of spaces unused in the column. – xuhdev Mar 25 '17 at 20:31
  • I deleted earlier comment, just to confirm do you get (\end occurred inside a group at level 1) at the end of the log ? that denotes a serious bug in the package... – David Carlisle Mar 25 '17 at 20:40
  • the group bug is reported here but still not fixed in texlive it seems tex.stackexchange.com/questions/299516/… – David Carlisle Mar 25 '17 at 21:05
2

You get a warning about an unclosed group due to a long reported but apparently unfixed bug in algorithm2e

enter image description here

The float is then over-sized so always ends up in a float column and vertically centred, not at the top. In this case you can use ! to over-ride the usual constraints and let it be placed h ere as above.

So I just changed your example to

\begin{algorithm}[!htb]

after changing line 1061 of algorithm2e from

\newboolean{algocf@displaygroupmarkers}{\setboolean{algocf@displaygroupmarkers}{false}

to

\newboolean{algocf@displaygroupmarkers}\setboolean{algocf@displaygroupmarkers}{false}
  • The bug in algorithm2e doesn't seem relevant. But annoying nonetheless. – egreg Mar 25 '17 at 21:37
  • @egreg true but I'd raised that in a now deleted comment before I'd downloaded the aaai package (which is only involved as far as it sets the page height) so I thought I should also address that here. – David Carlisle Mar 25 '17 at 21:51
  • Thank you for your answer. Actually the error message does not occur and simply putting ! before h solves the problem. – xuhdev Mar 25 '17 at 22:54

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.