[table of contents]

5.10 Algorithm packages

Because the various algorithm formatting packages such as algorithm2e and algorithmicx (or its related packages) sometimes create incompatibilities with the memoir float methods, the class provides you with floating {algorithm} environment and the corresponding list of algorithms, so you do not have to create your own list of algorithms. Here are some specific important points about using algorithm2e and algorithmicx.

5.10.1 algorithmicx package

If you are using the algorithmicx package, any of its related packages (including its older predecessor algorithmic) which suggest that you use the algorithm package to create floating algorithms, you can load the float package to use the its float styling capabilities instead of loading the algorithm package. You should not however use the float package to create new floating environments. You must use the memoir methods to create new floating environments and only then load the float package.

If you would normally load the algorithm package to create floating algorithms do the following instead. If you are creating any other new floating environments (like listings as described above) you must create these environments first before loading the float package otherwise your document will not compile.

% This code should only appear AFTER you have created any other new lists 
\usepackage{float} 
\floatstyle{ruled}% or any of the predefined float styles 
\restylefloat{algorithm}

5.10.2 Algorithm caption delimiter

If you have changed the \msucaptiondelimeter to use a colon (see 5.7.1) then depending on the particular algorithm package you are using, there may be a mismatch between the format of the caption in the algorithm itself and in the List of Algorithms. The Graduate School thinks the presence or absence of a colon in captions and lists is of vital importance, and they may complain about this. Here are two options to use if they complain:

The first method removes the colon from the word Algorithm in the List of Algorithms:

% Use this code after loading any algorithm package and the float package 
% This removes the colon after the word Algorithm in the List of Algorithms 
\renewcommand*{\cftalgorithmaftersnum}{}

The second method adds a colon to the word Algorithm in the captions of the algorithms

% Use this code after loading any algorithm package and the float package 
% This removes the colon after the word Algorithm in the List of Algorithms 
% Change the [ruled] specification to the algorithm style you are using. 
\usepackage{caption} 
\captionsetup[ruled]{labelsep=colon}