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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a command which does the same like \clearpage (typesetting all floats which have not been typeset yet) but then does not insert a pagebreak but continues with the following text/graphics on the same page?

share|improve this question
up vote 35 down vote accepted

Yes, and this is discussed as one of the advantages of the afterpage package. Use

\afterpage{\clearpage}

This will flush all processed floats after the current page has been completely set, technically avoiding a visible \clearpage. See the first use-case in the afterpage documentation (page 1):

Sometimes LaTeX's float positioning mechanism gets overloaded, and all floating figures and tables drift to the end of the document. One may flush out all the unprocessed floats by issuing a \clearpage command, but this has the effect of making the current page end prematurely. Now you can issue \afterpage{\clearpage} and the current page will be filled up with text as usual, but then a \clearpage command will flush out all the floats before the next text page begins.

share|improve this answer
1  
But \afterpage still issues a \clearpage. At least that's the case for me, and that's also how i understand the documentation. – noshky Aug 12 '14 at 20:41
3  
Unfortunately, didn't work as desired. @philipp described it below: if a new section starts in the middle of the page, the floats from that new section will still appear above the section title. The solution with \FloatBarrier solution did work as desired. – akhmed May 14 '15 at 0:02

I believe you may be after the \FloatBarrier command from the placeins package. It forces Tex to typeset all remaining floats at that point and doesn't include a \clearpage afterwards.

share|improve this answer
2  
thanks, I wish I could accept 2 answers at the same time. – MostlyHarmless Dec 30 '12 at 20:03
2  
Both ways are not equivalent. This one has the "advantage", that if a new section starts in the middle of the page, floats of this section do not appear above the section's headline. – Philipp Feb 9 '15 at 16:31
1  
Just want to add: you may need to install texlive-latex-extra to use placeins package since it is not part of the standard texlive-latex-recommended. – akhmed May 14 '15 at 0:07
1  
Note that the definition of \FloatBarrier in kpsewhich placeins.sty can in fact issue a \clearpage but only if "Some floats are stuck,"; else it seems to issue a \newpage. – sdaau Jun 17 '15 at 10:26

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.