I am trying to wrap pictures around list environments. I've found this question: Wrapping itemize around figure using floatflt in multicol environment - figure doesn't show And the answer of this question is working almost perfectly.
One of the problems I've noticed is that if I am trying to make two points with \itempicture (from my code) in one list then something makes the second number point be further away from the text.
Can somebody point out why and help to fix this?
PS. I see that \end{enumerate}\vspace*{-\baselineskip}\begin{enumerate}[resume*] between itempictures actually solves this problem. But I'm genuinely interested what am I missing.
MY MWE
\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem}
\usepackage{graphicx}
\input{insbox.tex}
\usepackage{xargs}
\usepackage{etoolbox}
\usepackage{calc}
\usepackage[margin=1cm, footskip = 1 cm]{geometry}
\usepackage[font=footnotesize]{caption}
\usepackage{microtype}
\usepackage{threeparttable}
\usepackage{changepage}
\usepackage{printlen}
\newcommand*\wrapitem{%
\apptocmd\labelenumi{\hskip\leftmargin}{}{}% add a correction
\item
\patchcmd\labelenumi{\hskip\leftmargin}{}{}{}% remove the added hskip
}
\makeatletter
\newcommand{\InsertListR}[3][0]{%
\mbox{}%
\vspace*{-\baselineskip}%
\setlength{\leftskip}{\leftmargin}%
\InsertBoxR{#2}{\hskip-\leftmargin#3\hskip\leftmargin}[#1]%
}%
\newcommand{\itempicture}[3][5]{
\wrapitem
\InsertListR[#1]{0}{\begin{threeparttable}\begin{tabular}{c@{}}\captionsetup{type=figure}\includegraphics[width=#3\textwidth]{#2}\end{tabular}\captionof{figure}{}\label{#2}\end{threeparttable}}
}
\begin{document}
\begin{enumerate}
\itempicture[5]{example-image-a}{0.15}
\lipsum[1]
\itempicture[5]{example-image-a}{0.15}
\lipsum[1]
\end{enumerate}
\end{document}
