# Figures (floats) break my theorems, definitions and remarks apart!

When I insert figures with graphics in a text it frequently happens that in the compiled document they split definitions and theorems (and maybe remarks) apart. This, of course, happens because LaTeX somehow "knows" where the to place the graphic in a typographical "correct" way. I could disable the automatic placement completey, but that is something I don't want. LaTeX should have some leway deciding where to put the graphic - as long as it doesn't split definitions and theorems (and maybe remarks) apart.

Is there a way to accomplish this ?

• Maybe I'm missing something, but how do you propose to make known to LaTeX which definitions and theorems "belong" together and are not allowed to be split and which are fine to split. Otherwise your documents would have to appear after the last definition and theorem because otherwise the float would float between a definition and a theorem. – moewe Aug 22 '15 at 14:37
• The float placement algorithm has essentially no information about the contents of the page on which floats are placed. – David Carlisle Aug 22 '15 at 15:29
• 2 bad idea, 1) control floats may be with [H] option 2) control theorem like environment by using minipage. – touhami Aug 22 '15 at 19:51
• – John Kormylo Aug 23 '15 at 16:16
• @moewe Well, the idea is that I have a few paragraphs of text between consecutive definitions and theorems, so I would my float to split this in-between text rather than splitting the definition – l7ll7 Aug 24 '15 at 5:28

This will turn off top floats for the duration. The default for article class is 2, but amsclass uses 4. Use

\makeatletter\the\c@topnumber\par\makeatother


to find out.

\documentclass{article}
\usepackage{mwe}

\begin{document}
\lipsum[1-3]% at least 0.7 of first page
\begin{figure}[t]\includegraphics{example-image-a}\end{figure}
\setcounter{topnumber}{0}% no more top figures
\lipsum[4-7]
\setcounter{topnumber}{2}% allow top figures again
\lipsum[8-12]
\end{document}