43

How can a figure be forced to appear alone on a separate page? \begin{figure}[p!] forces it to a separate page, but it does not guarantee that some other small figures (which I'd like to be included inline in the text) will not accidentally end up on the same figure page.

4 Answers 4

14

Setting the interfloat space \@fpsep to at least \textheight guarantees that figures on float pages will appear alone on a page:

\makeatletter
\@fpsep\textheight
\makeatother

Also here, the figure remains vertically centered, this is not affected. You can change \@fpsep also mid-document. Using \afterpage (requiring loading the afterpage package) for changes could be handy, such as:

\makeatletter
\afterpage{\global\setlength\@fpsep{8\p@ \@plus 2fil}}
\makeatother
7
  • 4
    Nice. Can this be done for only one specific float? Jul 3, 2011 at 8:54
  • Can \@fpsep be changed mid-documnet?
    – lockstep
    Jul 3, 2011 at 8:54
  • @lockstep: yes! @Martin: yes: we could modify \@floatsep again but let a \clearpage before the next figure(s). Or we do it by \afterpage{\global\setlength\@fpsep{...}} I added it to the answer.
    – Stefan Kottwitz
    Jul 3, 2011 at 9:26
  • Where should I put this code? I've tried putting the first block of code you've given as an example within the figure, right before the figure, and right before the chapter starts which is a few pages before where the image is currently placed. Nothing of them worked — the image is still not on a separate page. Aug 2, 2013 at 6:02
  • @StrawberryFieldsForever Try as I wrote in my previous comment.
    – Stefan Kottwitz
    Aug 2, 2013 at 7:06
28

I think your best shot is to use the \afterpage command from the afterpage package, which will put your actions as soon as the current page is over. This avoids that you ends with half pages blank. So I suggest you do the following:

\afterpage{%
\begin{figure}
...
\end{figure}
\clearpage
}

The problem of the other pictures is not completely solved if you have floats which are not placed before the \afterpage command, but it should ensure that no floats after this command are placed on the same page of the picture you want alone.

3
  • I found that this method throws an error message, but is fine if the \clearpage is placed above the figure. This seems to agree with the documentation page found here mirror.utexas.edu/ctan/macros/latex/required/tools/… Jul 17, 2018 at 21:40
  • This answer works well for me, but why is the clearpage required?
    – lucidbrot
    Nov 24, 2020 at 9:17
  • 1
    @lucidbrot The idea is to have the picture on picture-only pages, and the text or other pictures on other pages (per the question asked). If you don't use clearpage, you will end up with your following text after the picture, which will not be alone. You could use newpage to create a new page, but if you have other floats (for instance, picture), they might appear on the new page, which clearpage avoids. You can remove clearpage if you don't mind having the text on the same page of the picture (after it), but it kinds of defeat the purpose.
    – Martigan
    Nov 24, 2020 at 12:22
12

\clearpage

The \clearpage command ends the current page and causes all figures and tables that have so far appeared in the input to be printed.

1
  • 1
    If I place the \clearpage right after the figure block, it'll break the text (cause half an empty page). I don't want to break the flow of the text, just insert a separate page, reserved only for one figure. The p! option of figure will give me that separate figure page, but it won't guarantee that no other figures will end up on the same figure page.
    – Szabolcs
    Jul 3, 2011 at 7:40
7

Short answer:

\renewcommand{\floatpagefraction}{0.1}

Long answer:

You can control in some extent page floats by means of \floatpagefraction that is the minimum part of a page that has to be occupied by floating objects before a ‘float page’ is produced, or in two columns documents also with \dblfloatpagefraction, that indicates the minimum part of a page that has to be occupied by two column wide floating objects (figure*) before a float page.

Disclaimer: With this approach, if the next float is enough small and have also the [p] option, obviously still it could be included in the same float page. Unfortunately, another easy options as \setcounter{totalnumber}{1} and set \floatsep seem to work only for normal text pages. If this is a problem, it must be enough put text between both page floats (to fill at least one page) or be sure that the next float have not the [p] option, or forget this approach and set \@fpsep as perfectly explained by Stefan (or \@dblfpsep for texts in two columns).

A MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\renewcommand{\floatpagefraction}{0.1}

\begin{document}

\lipsum[1]

\begin{figure}[hbt]
\centering
\includegraphics[width=8cm]{A}
\caption{A normal float}
\end{figure}

\begin{figure}[p]
\centering
\includegraphics[width=8cm]{B}
\caption{A page float}
\end{figure}

\begin{figure}[hbt]
\centering
\includegraphics[width=8cm]{C}
\caption{Another normal float}
\end{figure}

\lipsum[2-10]

\end{document}

You must log in to answer this question.

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