2

My publisher recommends that my text is not split by floats. More precisely, a sentence should end before the float and a new sentence should start after the float. The float is allowed to be moved into another paragraph and even split paragraphs, but only after a full stop (question mark, exclamation mark).

Take this MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx}

\begin{document}
\raggedbottom

\lipsum[1-2]
\begin{figure}[htb]
\centering
\includegraphics[width=0.8\textwidth]{example-image-a}
\caption{Hello World 42}
\end{figure}
\lipsum[4-5]

\end{document} 

You should see that one sentences is split by this figure:

Morbi vel justo vitae lacus

[Figure]

tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

What I want is (for every float):

Morbi vel justo vitae lacus tincidunt ultrices.

[Figure]

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Maybe related:

How to forbid LaTex from placing floats in the middle of sentences?

How to protect text from being split by a float?

Edit according to Mico's answer:

What I forget to mention is, that the option "raggedbottom" is permitted/desired. I am not sure if this effects the answer. If I change the MWE to

\documentclass{article}
\usepackage{lipsum}
\usepackage{graphicx}

\begin{document}
\raggedbottom
\lipsum[1-5]

\begin{figure}[tb]
\centering
  \includegraphics[width=0.8\textwidth]{example-image-a}
  \caption{Hello World 42}
\end{figure}

\lipsum[6-10]

\end{document}

The float appears on top of one page, but still breaks a sentence. If I understand the comments to the answer correctly, I am requesting something which is not achievable, am I not?

The publisher showed my some examples where no sentences are split by figures, even if they appear on top or on bottom of a page. If I really want this, I would have to to insert paragraph breaks manually? If so, I might think about not fulfilling this recommendation.

7
  • 2
    This doesn't happen if you place the float surrounded by blank spaces in your code... something that should be common practice when thinking that the floats are considered to be separate from the regular, flowing text. The only place it will happen is around page breaks really. – Werner Jan 15 at 20:53
  • Welcome to TeX.SE. – Mico Jan 15 at 21:26
  • 1
    The stipulation that a float may split a paragraph only after a sentence-ending punctuation mark -- "full stop", aka "period", but presumably exclamation (!) and question (?) marks as well, right? -- seems slightly unusual, to put it politely. I'd rephrase and strengthen it to require that within-page paragraphs must not be split by a float. That way, the publisher's stipulation will be satisfied automatically. – Mico Jan 15 at 21:36
  • 3
    @Werner if a float is paced top or bottom of a page there is essentially no way t stop it being mid-sentence. – David Carlisle Jan 15 at 22:19
  • 2
    there is definitely no way to do that automatically in latex. if you use the float package and use [H] then the floating is disabled completely and you get full manual control. So you can insert the figures at whatever point you want but still you need to break the paragraph to insert them. – David Carlisle Jan 16 at 10:01
2

I think you have two main, not mutually exclusive options:

  • Don't use the h placement specifier. I.e., in your example code, change [htb] to [tb] (or [tbp]).

  • As @Werner has already suggested in a comment, make sure to surround the figure and table options by all-blank lines, which will generate implicit paragraph breaks.

The following code implements both ideas:

\documentclass{article}
\usepackage{lipsum,graphicx}

\begin{document}
\lipsum[1-2]

\begin{figure}[tb]
\centering
\includegraphics[width=0.8\textwidth]{example-image-a}
\caption{Hello World 42}
\end{figure}

\lipsum[4-5]
\end{document} 
7
  • 1
    I do not think this achieves the stated aim of stopping a float being inserted mid-paragraph (which is not really implementable in latex) – David Carlisle Jan 15 at 22:20
  • 1
    @DavidCarlisle - I interpreted the OP's requirements as permitting floats to be placed at the very top of bottom of a page even if doing so generates a paragraph break. Of course, my interpretation may be wrong. – Mico Jan 15 at 22:23
  • 2
    Yes perhaps. I re-read question, hopefully the OP means that as otherwise there is no answer:-) – David Carlisle Jan 15 at 22:26
  • Updated the question. @DavidCarlisle I Think I might be asking something unachievable. Could you confirm or deny? – Dragoner Jan 16 at 8:52
  • 1
    The answer does not achieve the unachievable but brings me most closely to it. – Dragoner Jan 16 at 9:03

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.