Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

can someone tell me, how to create an entry for the \lstlistoflistings command in the TOC? I want, that you can see the page number where the list can be found.

share|improve this question
    
Which documentclass do you use? –  Marco Daniel Feb 9 '13 at 12:30
    
I use \documentclass{scrreprt} –  Benny Neugebauer Feb 9 '13 at 12:53

1 Answer 1

The solution depends on your documentclass. If you are using a KOMA-class you can use the option listof. Of course you can set this key local to \lstlistoflistings

\documentclass[listof=totoc]{scrartcl}
\usepackage{scrhack}
\usepackage{listings}
\begin{document}
\tableofcontents
\lstlistoflistings

\section{foo}
text
\begin{lstlisting}[caption={A listing}]
(Listing content)
\end{lstlisting}
\end{document}

enter image description here

For the standard classes the standard command \addcontentsline should be used.

\documentclass{article}
\usepackage{listings}
\begin{document}
\tableofcontents
\addcontentsline{toc}{section}{Listings}
\lstlistoflistings

\section{foo}
text
\begin{lstlisting}[caption={A listing}]
(Listing content)
\end{lstlisting}
\end{document}
share|improve this answer
    
Thanks for the info but how do I get the listings entry without numbering? –  Benny Neugebauer Feb 9 '13 at 12:57
    
@BennyNeugebauer: Which number do you mean? –  Marco Daniel Feb 9 '13 at 12:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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