1

I have the following MWE with \listoffigures and \listofalgorithms. In the output, the list of figures are grouped based on the chapter they are in. However, when I add list of algorithms with the algorithms numbered based on the chapters they are defined in (using \usepackage[chapter]{algorithm}), it is not grouped at all. Is there some way to display it grouped as in \listoffigures?

\documentclass{memoir}
\usepackage[chapter]{algorithm}

\begin{document}
\tableofcontents
\listoffigures
\listofalgorithms

\chapter{First chapter}
\begin{figure}[ht]
  \caption{A figure}
\end{figure}

\begin{algorithm}[ht]
  \caption{Another algorithm}
\end{algorithm}

\section{Next section}

\begin{figure}[ht]
  \caption{Another figure}
\end{figure}

\begin{algorithm}[ht]
  \caption{An algorithm}
\end{algorithm}

\chapter{Second chapter}
\begin{figure}[ht]
  \caption{A figure}
\end{figure}

\begin{algorithm}[ht]
  \caption{Another algorithm}
\end{algorithm}

\section{Next section}

\begin{figure}[ht]
  \caption{Another figure}
\end{figure}

\begin{algorithm}[ht]
  \caption{An algorithm}
\end{algorithm}
\end{document}
Werner
  • 603,163
ckamath
  • 167

1 Answers1

2

You need to add this manually as part of \insertchapterspace. So, within your preamble, add

\makeatletter
\g@addto@macro\insertchapterspace{%
  \addtocontents{loa}{\protect\addvspace{10pt}}}
\makeatother

For the default document classes, see The line spacing in the list of algorithms.

Werner
  • 603,163