5

I use the algorithm and algorithmicx packages to type algorithms in a paper and my main document class is amsart. All is well until I try to use \listofalgorithms. This returns a variety of error messages, some of which I've been able to work around thanks to other threads on this website. I am now stuck at the following and here is a (very) minimal working example:

\documentclass{amsart}
\usepackage{algorithmic}
\let\chapter\section               % Conflict fix found on this site.
\usepackage[norelsize]{algorithm}  % [norelsize] fixes another conflict.

\begin{document}
\listofalgorithms                  % This is the problematic command.
\end{document}

This MWE uses algorithmic but the same behavior occurs with algorithmicx. Running this through pdflatex returns the error

! Missing } inserted.
<inserted text> 
            }
l.7 \listofalgorithms

I'm hoping someone has a hint as to how to fix this.

Thanks!

3
  • I made an update to my answer changing some settings to make the list of algorithms behave more as the list of figures, or tables. Nov 26, 2012 at 23:52
  • algorithm knows the options plain, ruled and boxed for the appearance of algorithms; nothing, part, chapter, section, subsection and subsubsection for their numbering; any other option is taken as the algorithm name (for a different language than English, for instance).
    – egreg
    Nov 27, 2012 at 0:03
  • @GonzaloMedina I was doing the same. I'm currently working with \def\l@algorithm{\@tocline{1}{0pt}{1pc}{2.1em}{}} which seems to be compact and looks like the table of contents.
    – Dominique
    Nov 27, 2012 at 0:03

1 Answer 1

5

Some redefinitions are necessary (notice that I didn't use the norelsize option):

\documentclass{amsart}
\usepackage{algorithmic}
\let\chapter\section               % Conflict fix found on this site.
\usepackage{algorithm}  % [norelsize] fixes another conflict.

\makeatletter
\def\listofalgorithms{\@starttoc{loa}\listalgorithmname}
\def\l@algorithm{\@tocline{0}{3pt plus2pt}{0pt}{1.9em}{}}
\makeatother

\begin{document}

\listofalgorithms

\begin{algorithm}
\caption{test algorithm one}
\end{algorithm}
\begin{algorithm}
\caption{test algorithm two}
\end{algorithm}

\end{document}

enter image description here

1
  • Awesome. Thanks! Indeed using norelsize changed "List of Algorithms" to "List of Norelsizes" in my case!!! Now I just have to tweak the appearance of the list.
    – Dominique
    Nov 26, 2012 at 23:53

You must log in to answer this question.

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