Consider this MWE:


\usepackage{setspace} %\singlespacing





\clearpage % \newpage % no effect %[1]
% \afterpage{\clearpage} % has effect, but page 1 doesn't end with [4], starts also \lipsum[5] %[2]

\begin{tabular}{p{0.5\textwidth} p{0.5\textwidth}}
  \vspace{0pt} \includegraphics[width=0.41\textwidth]{pic1.pdf} &
  \vspace{0pt} \includegraphics[width=0.41\textwidth]{pic1.pdf}
\caption[hda-beh]{Something something, something, something something;
(some) something and something something (thing); some thing:
something something, something something}




... where I'm using this pic1.pdf (an illustration I've had, with most content removed).

I'm using \clearpage because I want the page to end after the fourth paragraph; then I'd expect the floats to be on page 2, and I'd expect the text to continue from page 3. However, with the above code as is (choice %[1]), I actually get this (click on thumbnails for full size):

test10 test11 test12

... that is, unexpectedly, text is placed on page 2, and the floats on page 3.

If I use \afterpage{\clearpage} (that is, I uncomment %[2] and comment %[1]), I get this instead:

test20 test21 test22

... that is, now floats are on page 2, as expected - but page 1 does not end with paragraph 4, instead it includes a bit of paragraph 5 (circled in red), which I don't want!

So how do I tell latex: "end the page HERE, flush floats on next page, and start with text on the page after that"?

  • 1
    If you want to specify positions like this, you don't want to use a float environment since using one tells LaTeX 'move this around to wherever seems best to you'. So avoid figure and you can put the images where you want without worrying about the float mechanism. There are packages which let you specify captions outside floats for precisely this kind of reason. – cfr May 16 '14 at 19:53
  • 1
    \clearpage flushes all pending floats but it can't flush floats that LaTeX has not yet seen – David Carlisle May 16 '14 at 22:18

Put the \clearpage after the \end{figure} rather than before the \begin{figure}.

What's happening is that LaTeX treats figures and tables as floats. It sees that your figure needs to be on a page by itself, so it adds that figure to the queue of floats that need to be processed later. That "processed later" in this case is the end of the document.

You want to tell LaTeX, "No! Do it now!" So do that -- just after the figure has been defined. All that that \clearpage before you defined the figure accomplished was to start a new page. There were no unprocessed floats in the queue at the time it hit your \clearpage.

  • 1
    To make it worse the OP made the problem worse by preventing the float going on a page on its own by use of the optional argument to remove p Thus increasing the chance the float goes to end of document – David Carlisle May 16 '14 at 22:17
  • Many thanks, DavidHammen, @DavidCarlisle and @ cfr - I was quite unaware of the exact nature of float queuing, all of these comments help a lot. Cheers! – sdaau May 17 '14 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.