I've been using this forum for a year, and it's very helpful. I have a question about floating figures and tables. It seems to have already been addressed here: Floats – how to restrict floating to subsection only in one section of the document?
However, I find a lot of cases where \FloatBarrier
does not work with wrapfig and wraptable. Is there something I'm obviously missing? Below is my minimum working example. The wraptable will not go into its designated section, even with an explicit \FloatBarrier
command. Any thoughts? Thank you!
\documentclass[12pt]{report}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{float}
\usepackage[section]{placeins}
\begin{document}
\section{Characterization of Porosity}
\Blindtext
\begin{wraptable}{L}{0.4\textwidth}
\caption{Comparison of porosity parameters.}
\begin{center}
\begin{tabular}{lccc}
Fabric & $K_{n}$&$K_{c}$ \\ \hline
A & 0.53 & 0.772 \\
B & 0.56 & 0.533 \\
B, speckled & 0.56 & 0.485 \\
\end{tabular}
\end{center}
\label{t:porosity_label}
\end{wraptable}
\FloatBarrier
\section{Strain Effect on Porosity}
\Blindtext
\end{document}
Best Answer
1) A slightly different MWE
AFAIU, it demonstrates the same sort of behavior you're talking about:
Same in overleaf.
The result looks fine if those line is commented out:
But the image jumps to the very end if that line is uncommented: Sometimes, this "jump" is triggered by adding just one character. And, personally, jumping that far is not the behavior I expect.
2)
\WFclear
Donald Arseneau (wrapfig dev) suggested to use built-in undocumented
\WFclear
command for that.Same in overleaf.
And at the first glance, this is all you need. It just puts the image separately from the text, if there's no suitable paragraph:
And uses the first suitable, if any:
However, there's still a caveat, associated with too short paragraphs:
Same in overleaf.
3)
\WFfill
The same Donald's post proposes a fix for this:
Same in overleaf.
Now short paragraph case is not looking that bad:
And if the first-suitable, but too-short paragraph is followed by another one, it also perfectly works:
4) Put it inside
\section
Just like
FloatBarrier
, these commands could be embedded in\section
:Same in overleaf.