# Increase spacing between different algorithms in List of Algorithms in the same chapter

In the result below

coming from the MWE

\documentclass[12pt]{book}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\@chapter}% <cmd>
{\chaptermark{#1}}% <search>
{\chaptermark{#1}%
{}{}% <success><failure>
\makeatother
\usepackage[chapter]{algorithm}% http://ctan.org/pkg/algorithms
\begin{document}
\tableofcontents
\listofalgorithms
\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}
\end{document}

(both figure and MWE from https://tex.stackexchange.com/a/88563/11886) I would like to have more space between items 1.1 and 1.2 (which are in the same chapter/section), as well as 2.1 and 2.2 (which are in the same chapter/section, but different from previous). I don't want the line spacing to change anywhere else in the document.

• Do you have algorithms in chapters 3 etc. as well? Is there more than one caption in an algorithm environment? – user31729 Jun 13 '17 at 4:11
• @ChristianHupfer Yes, there are several more chapters, but each algorithm has only one caption, as of now. Would that change the answer? – Omid Jun 13 '17 at 5:01
• No, my answer is alright then for your purposes. – user31729 Jun 13 '17 at 5:04

If there is only one \caption usage per algorithm environment an additional

inserted with \AtEndEnvironment at the end of the algorithm environment adds more space between the loa entries.

I have defined two lengths for this in order to allow easier changing of spaces:

\newlength\insanelyhugespacebetweenchapters
\newlength\insanelyhugespacebetweenalgorithms
\setlength{\insanelyhugespacebetweenchapters}{15pt}
\setlength{\insanelyhugespacebetweenalgorithms}{5pt}

Of course, the current values are changeable.

As is, the last loa entry will add an additional space, however, which might to a page break for the List of Algorithms. Normally, there is a page break any way, so this is no real issue.

\documentclass[12pt]{book}
\usepackage{etoolbox}
\newlength\insanelyhugespacebetweenchapters

\newlength\insanelyhugespacebetweenalgorithms

\setlength{\insanelyhugespacebetweenchapters}{15pt}
\setlength{\insanelyhugespacebetweenalgorithms}{5pt}

\makeatletter
\patchcmd{\@chapter}% <cmd>
{\chaptermark{#1}}% <search>
{\chaptermark{#1}%
{}{}% <success><failure>
\makeatother
\AtEndEnvironment{algorithm}{%