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.

This is my code:

 \documentclass[12pt,a4paper]{book} 
 \usepackage[T1]{fontenc}
 \usepackage[chapter]{algorithm}
 \renewcommand{\baselinestretch}{1.5} 
 \begin{document}
 \begin{spacing}{1.2}
 \tableofcontents
 \backmatter 
 {\listoffigures  \listoftables \listofalgorithms} \end{spacing}
 \include{Chapter1}
 \include{Chapter2}
 \end{document}

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.

Similar:

share|improve this question
    
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. –  Jubobs Apr 18 at 20:49
    
it's done :) Thanks –  researcher Apr 18 at 20:51
add comment

1 Answer

up vote 8 down vote accepted

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

\documentclass[12pt,a4paper]{book}
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\patchcmd{\@chapter}% <cmd>
  {\chaptermark{#1}}% <search>
  {\chaptermark{#1}%
   \addtocontents{loa}{\protect\addvspace{10\p@}}}% replace
  {}{}% <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}

The original \@chapter command contains:

%...
\chaptermark{#1}%
\addtocontents{lof}{\protect\addvspace{10\p@}}%
\addtocontents{lot}{\protect\addvspace{10\p@}}%
%...

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

\chaptermark{#1}%
\addtocontents{loa}{\protect\addvspace{10\p@}}%

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

share|improve this answer
    
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 '13 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 '13 at 22:05
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.