Search code examples
latextableofcontentslstlisting

Including \lstlistoflistings and reference it in the table of contents


I have a question about including a directory for listings in my table of content. I'm using \lstlistoflistings and \tableofcontents and the \usepackage{listings}. Now my question: When I generate the list of listings, it is filled with the listings in my document, but it isn't referenced in my table of contents. There is no entry in my table of contents for the list of listings. Can someone imagine, what i've done wrong? Or is there a special trick for including ist? Thank you!


Solution

  • It depends a lot on the \documentclass you are using. But for the standard classes (book,article, etc.) this should suffice.

    Add this line:

    \addcontentsline{toc}{section}{Listings}
    

    right before \lstlistoflistings.

    This will probably not work for other classes. If it doesn't work, please tell which class you are using.