2

The following MWE produces a "List of Algorithms" heading but no list below it.

\documentclass[a4paper,twoside,justified,marginals=raggedright,nofonts,nobib,]{tufte-book}

\RequirePackage[noend]{algpseudocode}
\RequirePackage[]{algorithm}

\begin{document}
\listofalgorithms

\chapter{Introduction}
\label{chap:intro}

\begin{algorithm}
    \caption[Short caption]{A long caption}
    \begin{algorithmic}[1]
        \Require 
        Some constants
    \end{algorithmic}
\end{algorithm}
\end{document}

Is there a way to fix it (such that the List of Algorithms looks like the List of Figures)?

Manuel Schmidt
  • 3,537
  • 1
  • 19
  • 33
  • tufte-book seems to be the culprit here. It works for book out of the box –  May 15 '16 at 08:12

2 Answers2

2

I copied this part from tufte-common.def and it seems to work

\makeatletter
\renewcommand\listofalgorithms{%
    \ifthenelse{\equal{\@tufte@class}{book}}%
    {\chapter*{\listalgorithmname}}%
    {\section*{\listalgorithmname}}%
    %  \begin{fullwidth}%
    \@starttoc{loa}%
    %  \end{fullwidth}%
}
\let\l@algorithm\l@figure
\makeatother
Manuel Schmidt
  • 3,537
  • 1
  • 19
  • 33
2

Apparently \l@algorithm gets lost and is undefined. A slight redefinition of \listofalgorithms cures this.

\documentclass[a4paper,twoside,justified,marginals=raggedright,nofonts,nobib]{tufte-book}

\usepackage[noend]{algpseudocode}
\usepackage[]{algorithm}

\makeatletter
\renewcommand{\listofalgorithms}{%
  \let\l@algorithm\l@figure
  \chapter*{\listalgorithmname}%
  \@starttoc{loa}%
}
\makeatother

\begin{document}
\listofalgorithms
\listoffigures

\chapter{Introduction}

\begin{figure}
\caption{figure}
\end{figure}
\label{chap:intro}

\begin{algorithm}
    \caption[Short caption]{A long caption}
    \begin{algorithmic}[1]
        \Require 
        Some constants
    \end{algorithmic}
\end{algorithm}
\end{document}