How can I use \lstlistoflistings
to create a list of listings, but not have this list as an entry in the table of content?
Normally, a star helps to hide things like that and I use memoir as document class which supports and helps hiding lists like \tableofcontents*
, \listoffigures*
, \listoftables*
, ... But adding the star like that: \lstlistoflistings*
does not help.
I don't want to patch any of the class file or other packages if not really needed. (I use tex seldom enough to get annoyed if I want to have the listings list in the toc and then can't remember anymore what I changed).
At the moment I use latexmk to typeset my files. And so I currently have a .latexmkrc file with a hook that delete this entry from the content before it gets added to the toc, like this:
add_cus_dep("toc", "toc", 0, "removelistingfromtoc");
sub removelistingfromtoc {
$origin = "$_[0].toc";
$dest = "$_[0].toc.unpatched";
system("mv '$origin' '$dest' && grep -v '\\contentsline.*{List of Listings}' ".
"'$dest' > '$origin'");
return 0;
}
This removes for example the following line from the toc file:
\contentsline {chapter}{List of Listings}{}{section*.3}
(I changed the name "Listing" to "List of Listings". Btw: Any author with english as their native language might help me to critic if this "List of Listings" is a proper and common term)