This is a follow up to https://tex.stackexchange.com/a/266431/3929
Consider the MWE below. For now, ignore that we cannot provide arguments to \wrapfigure, what I'm trying to understand is this:
Why is it that if I set \intextsep globally to zero, then no extra vertical padding is added to the wrapped figure. But it is not enough to set it to zero inside it wrapper env. Ulrike has already answered by it does disappear in the very first one in the example. But try adding the section and the image will be shifted down.
Why?
\documentclass{article}
\usepackage{wrapfig}
\usepackage{kantlipsum}
\newcommand\fig{\rule{3cm}{15mm}}
%\setlength\intextsep{0pt}
\newenvironment{mw}{%
\setlength\intextsep{0pt}
\wrapfigure[4]{l}{3cm}
}{\endwrapfigure}
\begin{document}
%\section{Test}
\begin{mw}
\fig%
\end{mw}
\kant[1]
\begin{mw}
\fig%
\end{mw}
\kant[1]
\end{document}
The result of the MWE:
The result of adding a section
The result of globally setting \intextsep to zero




\noindentright after themwenv, then the image disappears. – daleif Nov 13 '15 at 16:03\intextsep. Actually, in this particular case we could just set\intextsepto zero, as the user is not a fan ofhfloats – daleif Nov 13 '15 at 16:12\parshapelocal so everything likely to go bad. If you want a local setting of \intextsep just do\skip0=\intextsep ..... \intextsep=\skip0or an allocated register rather than skip0 to save the value. – David Carlisle Nov 13 '15 at 16:17