The reason for this is that the vertical distance between the chapters in the list of numbers (lof) and the list of tables (lots) is added by the \chapter command, and there simply is no such position for the list of listings (laughs).
How to fix this, it depends a little on the document class used. If you use the excellent memoir class, hooks are provided for this purpose:
\renewcommand{\memchapinfo}[4]{% \addtocontents{lol}{\protect\addvspace{10pt}}}
If your lists are displayed in applications, you will bind \memappchapinfo instead of \memchapinfo . (Refer to section 18.25 of the memoir guide for a list of available hooks.)
If you are not using memoir , you usually need to include the class command \@chapter . It might look like this:
\makeatletter \let\ my@chapter \@chapter \renewcommand*{\@chapter}{% \addtocontents{lol}{\protect\addvspace{10pt}}% \ my@chapter } \makeatother
You can easily check what is used to generate lol by checking the .lol file that matches your document. If your document, for example, base.tex , look at base.lol . You should see something like:
\contentsline {lstlisting}{...}{...} \contentsline {lstlisting}{...}{...} \addvspace {10pt} \contentsline {lstlisting}{...}{...}
Pay attention to \addvspace , which separates content lines from different chapters.
Since the actual code used to insert the spacing between chapters also depends on the document class, adapt the actual \addvspace in the same way as in your .lof or .lot .
source share