The reason for this is that the vertical spacing between chapters in the list of figures (lof) and list of tables (lot) is added by the \chapter
command, and there simply is no such provision for the list of listings (lol).
How to fix this depends a bit on the document class you are using. If you are using the excellent memoir
class, hooks for this purpose are already provided:
\renewcommand{\memchapinfo}[4]{%
\addtocontents{lol}{\protect\addvspace{10pt}}}
If your listings are appearing in the appendices, you'll hook \memappchapinfo
instead of \memchapinfo
. (Consult section 18.25 of the memoir manual for a list of hooks available.)
If you're not using memoir
, you'll typically need to hook your class' \@chapter
command. This could look like, for example:
\makeatletter
\let\my@chapter\@chapter
\renewcommand*{\@chapter}{%
\addtocontents{lol}{\protect\addvspace{10pt}}%
\my@chapter}
\makeatother
You can easily check what is used for generating the lol by checking the .lol
file corresponding to your document. If your document is, for example, base.tex
, look into base.lol
. You should see something like:
\contentsline {lstlisting}{...}{...}
\contentsline {lstlisting}{...}{...}
\addvspace {10pt}
\contentsline {lstlisting}{...}{...}
Note the \addvspace
separating the content lines from different chapters.
As the actual code used to insert spacing between chapters also depends on the document class, adapt the actual \addvspace
command to be the same as in your .lof
or .lot
files.