[Tex/LaTex] How to forbid LaTex from placing floats in the middle of sentences

floatspositioning

I'm finding image floats being placed in a paragraph… OK this is normal. But they're being placed inside sentences which looks terrible. So I have been fishing a round for some time but haven't had people complain about this. This type of answer usually comes up:
How to protect text from being split by a float?

I'm using:

\usepackage{placeins}
\usepackage{flafter}

eg.

enter image description here

Any thoughts?

Best Answer

your example shows that the break you are concerned about occurs at a page break. let us assume that you are not concerned about a float splitting a paragraph in the middle of a page.

there are several possibilities, depending on the particular conditions:

  • the location of the reference to the float;

  • the size of the float;

  • the length of the split paragraph;

  • the number of lines split to one page or the other.

if the reference to the float occurs earlier than the last paragraph on the "first" page, and the space after that paragraph is sufficient to hold the float, the float instructions might be moved to precede the paragraph in which the reference appears, and the float placement option [b] specified to try to move it onto the same page.

if only one or two lines goes onto the "next" page, you could try to make the first page a line or so longer by using \enlargethispage{1\baselineskip} somewhere on that page.

if the split paragraph has only a line or two on the "first" page, you could encourage a page break before it by inserting \goodbreak before the split paragraph. or, in desperation, you could specify \newpage.

if the split paragraph doesn't start on the first page of a chapter, you could try making adjustments to one or more of the preceding pages (making them a line shorter or longer -- and matching the length of facing pages) to change the conditions that resulted in the unwanted break.

there's an obsolete command \samepage that, placed somewhere in a paragraph, is supposed to keep all lines of the paragraph on the same page. the key instruction in the definition of \samepage is \interlinepenalty=10000, so using that by itself is somewhat less forceful. the affected paragraph should always be enclosed in a group (with braces {...\par} or \begingroup ... \par\endgroup) to limit the scope of the penalty, and remember that a paragraph must be ended for proper operation of paragraph-scoped instructions (\baselineskip, changes in line width, and similar, in addition to \interlinepenalty).

or, when all else fails, rewrite.

Related Question