0

when I use the placeins package and use the \FloatBarrier, there is a strange (for me) behavior when a float moves to the next page.

Look at this example:

\documentclass[
12pt,
pdftex,
a4paper,
twoside,
openright,
parskip=half,
]{scrreprt}

\usepackage{showframe}
\usepackage{blindtext}
\usepackage{placeins}

\begin{document}
\section{First chapter}
\Blindtext[1][3]

\begin{figure}[htbp]
    \rule{14cm}{8cm}
    \caption{Here is some caption.}
\end{figure}
Just some text to force the page break to occure. \\
Just some text to force the page break to occure. \\
\Blindtext[1][1]
\FloatBarrier
\section{Second section}
\Blindtext[2][1]

\end{document}

There is no vertical correction (\flushbottom} at the end of page 1. If the \FloatBarrier is removed, the layout is fine.

With \FloatBarrier: With \FloatBarrier

And without: Without \FloatBarrier

I know in this case, \FloatBarrier is not needed, but I have some cases where I need it and this looks strange. Of course I could replace the \FloatBarrier with \pagebreak in this cases, but is this the expected behaviour?

  • So does \clearpage. You could add \vspace{0pt plus -1fil} to eat the extra space. – John Kormylo Jun 24 '17 at 13:58
  • Thanks for this tip. I can also use \pagebreak in most cases. With \clearpage I understand it, I just thought that the \FloatBarrier would act like \pagebreak instead. – Benedikt Jun 24 '17 at 14:08
  • It is the coded behaviour. placeins uses \newpage (and \clearpage) which adds a \vfill. You could define a \FloatBarrierFlush which uses \pagebreak instead of the \newpage and test if it works ... – Ulrike Fischer Jun 24 '17 at 14:12
1

It is the expected behaviour and it's not clear how in general that could be changed.

\FloatBarrier is essentially: If there are pending floats, then \clearpage else do nothing

So the reason why the page looks short is because \clearpage always adds space at the bottom of the page before the break. Really it has to do this.

As you know there are pending floats here you can easily test what it would look like if \clearpage did not pad the end of the page by using

\pagebreak\FloatBarrier

on your test file that produces

enter image description here

Which might seem like an improvement but this only works as the forced page break happened to be close to the natural end of page, so maintaining the flush bottom setting works.

in general there may only be a small amount of text on the page before the forced break, and then putting the space at the bottom of he page is the only possibility.

If I change your test file to

\documentclass[
12pt,
pdftex,
a4paper,
twoside,
openright,
parskip=half,
]{scrreprt}

\usepackage{showframe}
\usepackage{blindtext}
\usepackage{placeins}

\begin{document}
\section{First chapter}
\Blindtext[1][1]

\begin{figure}[p]
    \rule{14cm}{8cm}
    \caption{Here is some caption.}
\end{figure}
\Blindtext[1][1]

%\pagebreak
\FloatBarrier
\section{Second section}
\Blindtext[2][1]

\end{document}

Then you see exactly the same situation that the page is forced short:

enter image description here

But in this case it is clearly much worse if you would change \clearpage to preserve the flushbottom setting as you could check by uncommenting \pagebreak to get the flushbottom setting

Underfull \vbox (badness 10000) has occurred while \output is active

enter image description here


So in general leaving the page short is the only possible default but in specific cases if the page is not "too short" you could put \pagebreak before the barrier to force a flush bottom page.

  • Ok, I see. Thanks for your answer/ explanation! – Benedikt Jul 3 '17 at 8:25

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.