2

I am preparing my manuscript for submission to a conference. Here is the link to the style sheets required by the conference. In particular, they have the following lines in there:

\PassOptionsToPackage{algo2e,ruled}{algorithm2e}
\RequirePackage{algorithm2e}

I am not changing anything in my main LaTeX file, but when I write a sample algorithm, it doesn't appear with horizontal lines on top, as it should according to the definition of these options for algorithm2e package, which is what is used in the provided stylesheet. Here is a MWE. Note, it only compiles with the stylesheets (colt2018.cls, jmlr.cls, jmlrutils.sty) provided in the link above.

\documentclass[anon,12pt]{colt2018} % Anonymized submission
% \documentclass{colt2017} % Include author names

% The following packages will be automatically loaded:
% amsmath, amssymb, natbib, graphicx, url, algorithm2e

\title[Short Title]{Full Title of Article}
\usepackage{times}

 % Authors with different addresses:
 \coltauthor{\Name{Author Name1} \Email{[email protected]}\\
 \addr Address 1
 \AND
 \Name{Author Name2} \Email{[email protected]}\\
 \addr Address 2
 }

\begin{document}

\maketitle

\begin{abstract}
This is a great paper and it has a concise abstract.
\end{abstract}

\begin{keywords}
List of keywords
\end{keywords}

\section{Introduction}

\begin{algorithm}[h!]
  \KwData{this text}
  \KwResult{how to write algorithm with \LaTeX2e }
  initialization\;
  \While{not at end of this document}{
    read current\;
    \eIf{understand}{
      go to next section\;
      current section becomes this one\;
    }{
      go back to the beginning of current section\;
    }
  }
  \caption{How to write algorithms}
\end{algorithm}


% Acknowledgments---Will not appear in anonymized version
\acks{We thank a bunch of people.}


\bibliography{yourbibfile}

\end{document}

What am I doing wrong here?

1 Answer 1

2

I don't think you're doing anything wrong. In the documentation of the class you find the following somewhat cryptic comment:

Allow old command names in the event that the proceedings contains a mix- ture of papers that use old and new versions. (This means that editors need to install the newer version.) For some reason, loading algorithm2e causes the message

(\end occurred inside a group at level 1)

I don’t know why, but it’s outside the control of this class.

558 \PassOptionsToPackage{algo2e,ruled}{algorithm2e} 559 \RequirePackage{algorithm2e}

When you examine jmlrutils.sty definition of algorithm you find the following:

\newenvironment{algorithm}[1][htbp]%
{%
  \ifundef{\algocf}%
  {`algorithm2e' package is required if you want to
   use the algorithm environment}%
  {}%
  \begin{algocf}[#1]%
  \renewcommand\@makecaption[2]{%
    \hskip\AlCapHSkip
    \parbox[t]{\hsize}{\algocf@captiontext{##1}{##2}}%
  }%
}%
{%
  \end{algocf}%
}

This redefines \@makecaption so that the ruled caption is not used, despite the option being passed to the class.

The cryptic comment suggests that passing the ruled option to the package prevents the error, and that's all. It's not intended to actually make the algorithms ruled.

2
  • Great answer. Thank you for your effort (of downloading the stylesheets and looking at them so carefully!). Do you think there's a way to actually get the algortihms to be ruled? They look so ... naked now, there's no other way to put it.
    – lazulikid
    Jan 29, 2018 at 16:00
  • 1
    Well since I assume you're using the class to submit to the conference, and they've made it this way I wouldn't recommend changing it.
    – Alan Munn
    Jan 29, 2018 at 16:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .