I am using the listings package. I want to print out a list of listings, which I can do. The thing is that in the other listings the typesetter "groups" figures/tables by chapter. Is it possible to achieve a similar behaviour with the list of listings?

Here is an example

Example of how I want it

Here is how it is now

How it is


Write into the preamble:

  • This solution seems better as it works automatically for every chapter. I need to learn how to make those kinds of macros, where should I start? – Tiago Veloso Feb 3 '11 at 10:58
  • Difficult to say, because there are tons of manuals ... For TeX related stuff: http://tex.stackexchange.com/questions/7695/ and for LaTeX see http://mirror.ctan.org/info/ – user2478 Feb 3 '11 at 11:05

Add the following to your preamble (adjusted for the book and report class):



EDIT: The "chapter gap" mechanism of the KOMA-Script classes works for any "listofsomething".

  • 1
    Your hack worked. Unfortunately the listings package only provides a \lstlistoflistings which does not match the \listofsomething rule. Is there a better package for listings? – Tiago Veloso Feb 3 '11 at 10:43
  • @Tiago: I shouldn't have use code tags for "listofsomething". The KOMA-Script classes control the layout of \lstlistoflistings. – lockstep Feb 3 '11 at 10:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.