3

I included algorithm2e and start getting error message of "algorithm2e.sty command\procedure already defined." Here are the list of packages in my latex file

\documentclass[useAMS,usenatbib]{coin.cls}
\def\bSig\mathbf{\Sigma}
\newcommand{\VS}{V\&S}
\newcommand{\tr}{\mbox{tr}}

%\usepackage[figuresright]{rotating}
\usepackage[vlined,ruled,linesnumbered, algo2e]{algorithm2e}
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{float}
\usepackage{hyperref}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{stfloats}
1
  • Welcome to TeX.SX! Can you add a pointer to coin.cls?
    – egreg
    Commented Jun 30, 2016 at 22:28

1 Answer 1

5

If you're referring to coin.cls that forms part of the Computational Intelligence group at Dalhousie University's Department of Computer Science, then the solution is fairly straight-forward if you want to keep using algorithm2e: set the \procedure and \endprocedure macros to \relax.

enter image description here

% https://projects.cs.dal.ca/ci/latex/template-files/coin.cls
\documentclass{coin}

\let\procedure\relax
\let\endprocedure\relax
\usepackage[algo2e]{algorithm2e}

\begin{document}

\begin{algorithm2e}[H]
  \SetAlgoLined
  \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{algorithm2e}

\end{document}

So if you're not going use these theorem-like structures, then there shouldn't be any other conflict.

Both the algorithm and procedure environments are predefined inside the coin document class as theorems:

\newtheorem{algorithm}{Algorithm}%[theorem]
%...
\newtheorem{procedure}{Procedure}%[section]

The algorithm environment definition is avoided by using the algo2e option of algorithm2e, which creates an algorithm2e float rather than algorithm.

0

You must log in to answer this question.

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