LaTeX wrapfigure debugging

LaTeX wrapfig.sty \wrapfigure is a great way to save space, but has several quirks to workaround. Overleaf also notes the touchiness of wrapfigure. The typical failure mode is that the wrapped figure will not appear, and the document text is wrapped for a few pages with blank column. The LaTeX log doesn’t give an error, just a warning about a missing figure reference.

Workarounds

  1. Don’t have wrapfigure next to a list (enumerated or itemized).
  2. put a blank line before and after wrapfigure stanza in the document body

Example

For #2, in the .tex file have like

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ut faucibus ex.

\begin{wrapfigure}{R}{0.5\textwidth}
\includegraphics{...}
...
\end{wrapfigure}

Donec sed commodo eros. Sed vehicula elit ac tincidunt lacinia.