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 include three lists: \listoffigures, \listoftables, and \lstlistoflistings. However each list on a new page. I don't want to have a page break after each list but to list all three on one page.

After some googling I found out that this behavior is connected to the document class. My documents is using scrreprt and I cannot (don't want to) change the type.

If I'm not mistaken I need to rewrite / overwrite these commands to remove the page breaks. But I don't know how to do this.

share|improve this question
1  
The page break is due to a \clearpage which is placed inside the commands \listoffigures etc. You have to relax \clearpage. See the answer here: tex.stackexchange.com/questions/187602/…, especially at the end of the document, just replace the \printbibliography with your \listof.... commands and omit the \addcontentsline in it. –  Christian Hupfer Jul 4 at 6:48
    
Or see the approach here: tex.stackexchange.com/q/162681 (and please add an MWE, as always). –  LaRiFaRi Jul 4 at 6:49

1 Answer 1

up vote 4 down vote accepted

One way is to relax \clearpage, such that is doing nothing when called.

Other possibilities (not in here): Redefine the commands \listoftables etc. and remove the \clearpage in there or use etoolbox package in order to patch them or the answer given in the link in LariFaRi's comment.

Of course, the content lists will not fit on one page if there are a lot entries in them.

\documentclass[paper=a4,12pt]{scrreprt}

\usepackage{listings}
\usepackage{hyperref}


\begin{document}

\let\LaTeXStandardClearpage\clearpage
\let\clearpage\relax  % Do nothing when a \clearpage command appears 
\listoffigures
\listoftables
\lstlistoflistings

\let\clearpage\LaTeXStandardClearpage % Return to the old definition


\chapter{First}

\begin{figure}

\caption{Dummy figure}
\end{figure}

\newpage

\begin{table}

\caption{Dummy table}

\end{table}





\chapter{Second}
\section{First}

\begin{lstlisting}[language=C, caption={Hello World in C}]
#include <stdio.h>

\int main( void )
{
 printf("Hello World\n");
 return(0);
}


\end{lstlisting}

\end{document}

enter image description here

share|improve this answer

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.