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

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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer
    
First method works like a charm! Thanks a lot! –  tim Jul 20 '11 at 20:09

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.