In Adjust intextsep for wrapfigure only, @Peter Grill provided an option to modify \intextsep for wrapfigure only and leave figure unaffected.
However it does not really work for me: as soon as a wrapfigure happens in the document, subsequent figure are affected too, so the setting obviously “leaks” into the environment. I have asked about this in comments to his answer, and he asked me to open a new question about my issue with a MWE, so here we are.
Here is a MWE showing the issue:
\documentclass{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\BeforeBeginEnvironment{wrapfigure}{\setlength{\intextsep}{0pt}}
\begin{document}
Some text initially.
\begin{figure}[hbt]
\centering
\includegraphics[width=.5\linewidth]{example-image-a}
\caption{Notice how it is properly spaced above and below.}
\end{figure}
Now let’s add some wrapped figure.
\begin{wrapfigure}{r}{.3\linewidth}
\includegraphics[width=\linewidth]{example-image-a}
\end{wrapfigure}
Asperiores est aspernatur dolorum sit. Expedita dolorum voluptatem iste. Eum
laudantium ipsum ea omnis aut fugiat harum quis. Ut repellendus est incidunt.
Esse cum a omnis. Explicabo odio inventore asperiores ex ad. Quidem quia
voluptatibus incidunt. Est dolores est perferendis dicta ullam inventore.
Deleniti ab enim accusantium sint qui voluptatem. Qui sed assumenda adipisci ad
reiciendis velit magnam. Nobis aut nihil quae est. Molestiae possimus quo quia
magnam et dicta odio. Est quia quasi rem vel omnis eveniet. Quasi rerum tempore
velit consequatur consequatur consectetur veritatis. Sed blanditiis et sed
libero consequatur sed. Numquam et ipsam rem. Sed facere aut ipsam. Tenetur
rerum et sed est aspernatur ipsa quia. Hic error ut maiores doloremque quas.
Error eum quae rerum modi debitis.
And now, a figure again.
\begin{figure}[hbt]
\centering
\includegraphics[width=.5\linewidth]{example-image-a}
\caption{Notice how it is \emph{not} properly spaced above and below.}
\end{figure}
See the issue ?
\end{document}



lthookshas nothing regardingpatchcmd, but I’ve found great explanations here https://tex.stackexchange.com/a/152811/56823. – Archange Apr 13 '23 at 15:20\WF@putfigmaybe(from wrapfig). – John Kormylo Apr 13 '23 at 19:46