1

I'm using

\cleardoublepage
\renewcommand{\lstlistlistingname}{Quellcodeverzeichnis}
\enlargethispage{\baselineskip} %EITHER
\lstlistoflistings
\enlargethispage{\baselineskip} %OR THIS
\addcontentsline{toc}{chapter}{Quellcodeverzeichnis}
\cleardoublepage

but this doesn't work: I get ONE listing-reference on the new page. It has a new chapter number, thus there's probably one empty line inbetween. That's why I also tried to increase by \enlargethispage{3\baselineskip}: Doesn't work either. Any idea? Thanks!

1 Answer 1

3

Your problem seems to be of squeezing the list in one page only; neither method works:

  • \enlargethispage before \lstlistoflistings only enlarges the page preceding the list, because \lstlistoflistings issuea a \cleardoublepage command;
  • \enlargethispage after \lstlistoflistings enlarges the second page of the list, which is useless.

Here's a way out:

\begingroup
\cleardoublepage
\let\cleardoublepage\relax
\enlargethispage{\baselineskip}
\lstlistoflistings
\endgroup

We issue beforehand the \cleardoublepage, then we make the command a no-op, we ask to enlarge the page and then we print the list. The end of the group restores the previous meaning of \cleardoublepage.

Another method is to say

\lstlistoflistings
\addtocontents{lol}{\protect\enlargethispage{\baselineskip}}

that adds the required commands for the next time the list is typeset. After the first compilation all should be in its place. If the list of listings is at the end of the document, issue the \addtocontents command immediately after \begin{document}.

1
  • First method works like a charm! Thanks a lot!
    – tim
    Commented Jul 20, 2011 at 20:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .