TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
remove unwanted contents from list of listings

How can I hide a listing from the listoflistings, similar to using \section*{Title} to hide a section from the table of contents?

I want to do this in order to use a listing as an example in the preface of my thesis. As this isn't really an actual listing, I don't want it to show up in my list of listings because it doesn't really concern the content.

share|improve this question

marked as duplicate by Peter Grill, Thorsten, diabonas, Marco Daniel, percusse Sep 18 '12 at 1:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Use title=Title of this listing instead of caption=Title of this listing. Please, provide an example of what you're doing, if this is unclear or doesn't work. – egreg Sep 17 '12 at 8:01
This is not a duplicate -- see egreg's answer. – lockstep Sep 17 '12 at 11:27
up vote 4 down vote accepted

The answer in the linked question doesn't really apply here, as the nolol=true setting will still number the listing. For an unnumbered listing one can use the keyword title.

\title{A title}
\author{A. U. Thor}


Here we have an unnumbered listing that won't go in the list of listings.

\begin{lstlisting}[title=Preliminary listing]
Hello world


Here we have a real listing.

\begin{lstlisting}[caption=Real listing]
Hello world


enter image description here

share|improve this answer
Perfect! Thanks! – Florian Peschka Sep 17 '12 at 9:59

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