[Tex/LaTex] LyX: why does figure-wrap-float overrun the page


I find that when I add figure wrap floats to LyX documents, often they will be placed poorly such that they overrun the bottom of the page. This is always accompanied by some of the text on the next page wrapping around nothing, as if the float had continued on that page. Example:

screenshot of float overflow example

Can anyone tell me why this happens and how to avoid it? In the settings for the wrap float, I see 'Allow floating', so I presume the typesetting engine should be free to find a more suitable location. Note that this does not always happen, but in a document with several figures densely placed in the text, it is very likely to occur.

There is a similar question for which the suggested solution is to allow the wrap to float.

Best Answer

The floating capabilities of wrapfig and relatives are restricted; in particular, placement near a page break is problematic. The wrapfig documentation mentions these facts:

The ability to float is somewhat restricted, and you will get best results by giving exact manual placement, but floating is more convenient while revising the document. Any changes to the formatting can ruin your manual positioning so you should adjust the placement just before printing a final copy. Here are some tips for good placement:

• The environment should be placed so as to not run over a page break...