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.

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:

EDIT: Added some more information.

\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{\cftlistingsleader}{\hspace{1.5em}}
\renewcommand{\cftlistingspresnum}{Algorithm~}
\renewcommand{\cftlistingsafterpnum}{\cftparfillskip}
\setlength{\cftbeforelistingsskip}{\cftbeforesecskip}
\newlength{\listingslabelwidth}
\settowidth{\listingslabelwidth}{\cftlistingspresnum~99}
\addtolength{\listingslabelwidth}{2.5em}
\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
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures

\vspace*{5ex}

\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables

\vspace*{5ex}

\phantomsection
\addcontentsline{toc}{chapter}{List of Listings}
\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.

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Add the following to your document preamble,

\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.

share|improve this answer
1  
@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
add comment

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.