Latex: Make \ listoffigures look like \ listoftables or \ lstlistoflistings

I have a list of lists at the end of my document, following my list of tables and my list of numbers. What really annoys me is that they look the same, except that the list of lists leaves no gap between sections.

I had a good google and people asked the same question but did not seem to answer.

Do they have any reason why they do not look the same and that should look concise?

+4
source share
1 answer

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 .

+6
source

Source: https://habr.com/ru/post/1312654/


All Articles