# Remove the header of List of Listings

I'm using classichtesis and I would like to remove the header of List of Listings.

Before posting here, I tried the following strategies:

• The command \renewcommand\lstlistlistingname{}, suggested here, makes disappear also the title of the list.
• The command \markboth{}{} doesn't work.
• The command \thispagestyle{empty} before \begingroup or \lstlistoflistings doesn't work.

Here is the code I'm using:

\documentclass{scrbook}
\usepackage{classicthesis}
\usepackage{listings}
\usepackage{caption}

\makeatletter
\begingroup
\let\newcounter\@gobble\let\setcounter\@gobbletwo
\globaldefs\@ne \let\c@loldepth\@ne
\newlistof{listings}{lol}{\lstlistlistingname}
\endgroup
\let\l@lstlisting\l@listings
\let\lstlistoflistings\listoflistings
\makeatother
\renewcommand{\cftlistingspresnum}{\scshape\MakeTextLowercase}
\renewcommand{\cftlistingsfont}{\normalfont}
\renewcommand{\cftlistingspresnum}{Algorithm~}
\renewcommand{\cftlistingsafterpnum}{\cftparfillskip}
\setlength{\cftbeforelistingsskip}{\cftbeforesecskip}
\newlength{\listingslabelwidth}
\settowidth{\listingslabelwidth}{\cftlistingspresnum~99}
\cftsetindents{listings}{0em}{\listingslabelwidth}

\renewcommand\lstlistingname{Algorithm}
\renewcommand\lstlistlistingname{List of Algorithms}
\def\lstlistingautorefname{Algorithm}

\begin{document}

\begingroup
\let\clearpage\relax
\let\cleardoublepage\relax
\let\cleardoublepage\relax

\phantomsection
\listoffigures

\vspace*{5ex}

\phantomsection
\listoftables

\vspace*{5ex}

\phantomsection
\lstlistoflistings

\endgroup

\clearpage

\begin{lstlisting}[caption={First listing}]
for i = 1,...,n:
print 'Hello'
\end{lstlisting}

\begin{lstlisting}[caption={Second listing}]
for i = 1,...,n:
print 'Goodbye'
\end{lstlisting}

\end{document}


By compiling it, you can find the header of List of Listings in the second page. In my thesis is actually in the same page of List of Listings.

-

\makeatletter
\renewcommand{\cftmarklol}{%
\@mkboth{}{}%
}
\makeatother


This overrides the usual definition:

\@mkboth{\lstlistoflistingname}{\lstlistoflistingname}


Note that you may have to do this for other "List of ..."'s as well. In your MWE, the List of Listings (or Algorithms) actually overwrites and empties the header and since everything fits on a single page it works. However, if you other "List of ..."'s together span more than one page, it may require some work.

-
@mp87: the code provided by Werner must be enclosed inside \makeatletter, \makeatother (\makeatother is missing in your code). –  Gonzalo Medina Apr 17 '12 at 4:03
@GonzaloMedina: Thanks, now it works. –  mp87 Apr 17 '12 at 10:47