Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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!

share|improve this question
    
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. –  Gonzalo Medina Nov 26 '12 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 '12 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 '12 at 0:03
add comment

1 Answer

up vote 5 down vote accepted

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

share|improve this answer
    
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 '12 at 23:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.