This is my code:

 {\listoffigures  \listoftables \listofalgorithms} \end{spacing}

in the PDF file, i have: in the list of figure the space between fig2.1 and fig 2.2 is smaller than the space between fig2.2 and fig 3.1, but in the list of algorithm i have the same space everywhere, Have you an idea please ?

I would like to have the list of algorithms like the list of figure Thank you.



1 Answer 1


A patch to correct for this behaviour is provided by the etoolbox package. The default \chapter inserts a 10pt vertical gap between chapter breaks in the LoF and LoT. Merely add a similar gap as part of the macro \@chapter to the LoA:

enter image description here

\patchcmd{\@chapter}% <cmd>
  {\chaptermark{#1}}% <search>
   \addtocontents{loa}{\protect\addvspace{10\p@}}}% replace
  {}{}% <success><failure>
\usepackage[chapter]{algorithm}% http://ctan.org/pkg/algorithms
\chapter{A chapter}
\begin{algorithm}\caption{An algorithm}\end{algorithm}
\begin{algorithm}\caption{An algorithm}\end{algorithm}
\chapter{A chapter}
\begin{algorithm}\caption{An algorithm}\end{algorithm}
\begin{algorithm}\caption{An algorithm}\end{algorithm}

The original \@chapter command contains:


The \patchcmd searches for \chaptermark{#1} in \@chapter and replaces it with


effectively inserting the necessary chapter-wise gap in the LoA.

Make sure to load any package that affects the sectional unit \chapter after performing this patch. This is especially true if you use hyperref and minitoc. Other sectional packages like titlesec would not be compatible with the above patch.

  • 1
    i have added your code: \usepackage{etoolbox}% ctan.org/pkg/etoolbox \makeatletter \patchcmd{\@chapter}% <cmd> {\chaptermark{#1}}% <search> {\chaptermark{#1}% \addtocontents{loa}{\protect\addvspace{10\p@}}}% replace {}{}% <success><failure> \makeatother but the list of algorithm still the same!
    – researcher
    Jan 1, 2013 at 22:01
  • @researcher: Using your MWE with the added code? If so, why does mine show a gap? If not, what else are you loading? You could test whether the patch was successful or not, by using \patchcmd{..}{..}{..}{\typeout{success}}{\typeout{failure}} and then checking your .log file for the word success or failure.
    – Werner
    Jan 1, 2013 at 22:05
  • I have the same issue as the OP. The fix works in the MWE, but when I add it to main project, I get a 'failure'. I guess this is because I am loading other packages (and quite a few).
    – ckamath
    Mar 17, 2020 at 20:40
  • @Occams_Trimmer: Can you provide the detail to replicate the issue? The solution I provide relies on matching \chaptermark{#1} within \@chapter in order to add the spacing to the ToC. If \chaptermark{#1} doesn't exist in \@chapter, or \@chapter isn't used in the process of setting a chapter, then the patch won't work. But there are other work-arounds.
    – Werner
    Mar 17, 2020 at 20:42
  • I managed to isolate it to the pdfx package, which loads hyperref. I followed your suggestion at the end of answer and it now works.
    – ckamath
    Mar 17, 2020 at 20:50

You must log in to answer this question.

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