GeneralNo page break after \listoffigures

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mro
Posts: 18
Joined: Thu Oct 16, 2008 10:49 pm

No page break after \listoffigures

Post by mro »

I want to save a few cents and not have a "list of tables" with only three entries on an extra page.
I first have the list of figures followed by the list of tables and would like the page break in between eliminated.
I tried something easy like this, to no avail.

Code: Select all

...
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\nobreak
\nopagebreak
%\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
...
Any ideas? Unfortunately, Google was not very helpful. (Not sure anyhow which command finally inserts the pagebreak, \listoffigures, or \listoftables, or... ?).

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

Re: No page break after \listoffigures

Post by daleif »

full minimal example please

we do not know anything about what document class you are using, so please provide a fully compilable minimal example
mro
Posts: 18
Joined: Thu Oct 16, 2008 10:49 pm

No page break after \listoffigures

Post by mro »

Code: Select all

\documentclass[12pt,twoside,a4paper,english]{book}

\usepackage{float}

\begin{document}

\begin{figure}
  \caption{Fig 1}
\end{figure}
\begin{figure}
  \caption{Fig 2}
\end{figure}
\begin{table}
  \caption{Tbl 1}
\end{table}
\begin{table}
  \caption{Tbl 2}
\end{table}

\cleardoublepage
\listoffigures

\nobreak
\nopagebreak
% dont want break here

%\cleardoublepage
\listoftables

\end{document}
phi
Posts: 577
Joined: Tue Oct 21, 2008 8:10 pm

No page break after \listoffigures

Post by phi »

I see two possibilities.
1. Switch to a document class that is more flexible (like memoir)
2. Temporarily redefine \cleardoublepage:

Code: Select all

\begingroup
\let\cleardoublepage\relax
\listoftables
\endgroup
daleif
Posts: 199
Joined: Wed Nov 19, 2008 12:46 am

No page break after \listoffigures

Post by daleif »

Form the book.cls source

Code: Select all

\newcommand\listoffigures{%
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename}%
      \@mkboth{\MakeUppercase\listfigurename}%
              {\MakeUppercase\listfigurename}%
    \@starttoc{lof}%
    \if@restonecol\twocolumn\fi
    }
which explains it (\chapter*)

I agree with phi as to what you should do.
mro
Posts: 18
Joined: Thu Oct 16, 2008 10:49 pm

Re: No page break after \listoffigures

Post by mro »

Thanks guys. At some point I will have to familiarize myself more deeply with these latex internals :roll:
illes.solt
Posts: 1
Joined: Sun May 10, 2009 3:50 pm

No page break after \listoffigures

Post by illes.solt »

For the report document class, one has to redefine \clearpage macro (while book uses \cleardoublepage as was discussed above):

Code: Select all

\clearpage
\begingroup
  \let\cleardoublepage\relax  % book
  \let\clearpage\relax        % report
  \listoftables
  \listoffigures
\endgroup
Post Reply