# Wrapfigure and Math

Has anyone noticed that when using wrapfig around math environments (align, gather etc), when the argument is passed to constrain the number of 'lines', it fails to consider that math lines are generally bigger than the standard text lines.

Shouldn't the constraint be on size, rather than number of lines?

-

In order to make a cutout shape the tex `\parshape` primitive has to be used to set the line length and indent for the initial lines of a paragraph (with all later lines using the last set length). This makes it rather difficult to make the parameter be a length, in fact if it could be a length you would almost never need to set it manually as that can be measured. At this primitive level TeX always treats a (primitive) math display (from `\$\$`) as 3 lines whatever vertical size it takes up. As it is not possible to remove boxes from the main vertical list and measure them it would be very hard to use a length based input using the classic TeX facilities used by `wrapfig`.
If you allow TeX extensions such as `\pdfsavepos` it is possible to measure more things and it would perhaps be possible to have a more automatic setting in that context (but it would require multiple runs to set a table which might make the document very unstable as each setting would potentially affect the setting of all following paragraphs and all following page breaking, so it might take a lot latex runs for the entire document to stabilize.
A paragraph never starts with a TeX-primitive math display. If you try to start a paragraph with `\$\$` or `\[` you get a (white) line of "text" followed by "3" lines of math –  David Carlisle May 12 '13 at 20:06