Open daleif opened 5 years ago
The issue is with any list based environment: a really minimal example is with trivlist
. The problem is obviously that \addvspace
in the list after the figure
cannot “see” the \addvspace
after the first list.
\documentclass{article}
\begin{document}
\begin{trivlist}
\item blablabla
\end{trivlist}
\begin{figure}
\rule{3cm}{3cm}
\end{figure}
\begin{trivlist}
\item bliblibli
\end{trivlist}
\begin{trivlist}
\item blublublu
\end{trivlist}
\end{document}
I think that has to be filed under limitations of LaTeX. The problem is that if there are two (list) environments in succession the vertical spaces generated by them interact and only the maximum of both is used. However, a float environment between the two means that the second environment can't see the space generated by the first whether or not that float actually ends up in that place.
Maybe there is a chance to give a followup environment that knowledge by some complicated extra housekeeping (so I'll like to keep this issue open for further consideration) but that area is more than fragile in LaTeX and in all honesty a change there is likely to do more harm than gain.
Right now the only answer is: do not place a float between two vertical environments if they come in direct succession.
@daleif Trying again! “just a workaround“? Not really, as Frank has pointed out.
Besides specifying the contents of the float, putting the environment at a point in the file defines the float’s “anchor point”. To pursue the nautical wording, putting an anchor point at some arbitrary point on the galley, surrounded only by glue, is rather like anchoring a boat with an anchor chain that is too short to reach the ocean floor. It is always best to anchor floating objects securely to rocks, consolidated sand, etc.: things that can be seen and are immovable, so that we know where the anchor is.
Back to the original example, putting a float between two objects, not firmly attached to either, will likely mean that it will very likely mean that it will end up right in a page-break and it will be rather arbitrary on which page the float will be “seen by latex”.
@FrankMittelbach Something for the documentation!
whether just an addition to the documentation or even some elaborate change in behavior, it should stay open for now (closing by Chris was unintentional)
For me a note in the documentation is fine. It should just be documented that this can happen. One might say that having theorem figure theorem is probably also not that common.
@daleif any suggestion on where that could be reasonably documented (other than in the LaTeX Companion)?
No idea, these days I often look in the source code rather than in the manual.
The graphics guide perhaps. But then again that does not cover floats.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
not stale, only slow ...
This issue has been automatically marked as stale because it has not had recent activity.
Brief outline of the bug
Placing a floating figure between two theorems may leave vertical spacing behind if the float placement is not "here".
Note that one can make the issue go away by adding the float inside the theorem environment. But that is just a workaround.
Minimal example showing the bug
This is just a bug report for an issue brought up on tex.stackexchange.com: https://tex.stackexchange.com/q/505243/3929
I've made the MWE a bit simpler
As it can be see in the PDF we have a top float, inserted between theorem 1 and 2, which cause larger spacing between theorems 1 and 2 than between theorems 2 and 3.
bug.log imf.pdf
Log file (required) and possibly PDF file
!! Use drag-and-drop (remember: .log file is required) !!