Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Listings in table of contents

416 views
Skip to first unread message

Paulo Matos

unread,
Aug 3, 2009, 3:15:27 PM8/3/09
to
Hi all,

It seems that the listings package, doesn't give any command to
include a list of listings but without including it in the table of
contents. Is there a way to include a list of listings without the
table of contents line?

Cheers,

Paulo Matos

Ulrike Fischer

unread,
Aug 4, 2009, 4:42:09 AM8/4/09
to

I don't understand what you mean. The list of listings is not in the
table of contents:

\documentclass{article}
\usepackage{listings}
\begin{document}
\tableofcontents
\lstlistoflistings

\section{A}
\begin{lstlisting}[caption=Test lst]
a
\end{lstlisting}

\end{document}
--
Ulrike Fischer

Paulo Matos

unread,
Aug 4, 2009, 6:00:10 AM8/4/09
to

Hummf, interesting... I wonder why it's showing up. Maybe it's a
memoir thing...

Lars Madsen

unread,
Aug 4, 2009, 6:07:40 AM8/4/09
to


very interesting, I'll have a look at memoir after lunch


btw: it is always a good idea to include a minimal example. How should
we have known that you were using memoir.


--

/daleif (remove RTFSIGNATURE from email address)

LaTeX FAQ: http://www.tex.ac.uk/faq
LaTeX book: http://www.imf.au.dk/system/latex/bog/ (in Danish)
Remember to post minimal examples, see URL below
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=minxampl
http://www.minimalbeispiel.de/mini-en.html

Lars Madsen

unread,
Aug 4, 2009, 6:44:22 AM8/4/09
to

ahh, interesting feature

\lst@UserCommand\lstlistoflistings{\bgroup
\let\contentsname\lstlistlistingname
\let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lol}}%
\tableofcontents \egroup}

i.e. listings use \tableofcontents internally to typeset the
listoflistings, which is just to add a header to the \lst@temp{lol}

But in memoir this causes the \contentsname to be added to the main TOC.

and \tableofcontents* removes it from the TOC.

I'll see if we can come up with a switch to locally remove this feature
without having to change listings

Paulo Matos

unread,
Aug 12, 2009, 5:57:14 PM8/12/09
to

Thanks for your help. Sorry for not providing a small example in my
original post. From your reply it seems there is no way, currently, of
removing the listings entry from the table of contents (without
messing up with .toc manually)?

Lars Madsen

unread,
Aug 15, 2009, 4:25:38 AM8/15/09
to

you could redefine the macro above (I haven't tried it)

besides, the next version of memoir will have a feature that makes all
memoir created lists of into their starred counter parts (can be used
locally to solve your problem).

/daleif

0 new messages