I am trying to wrap pictures in environments. I've seen people there recommend using insbox.tex in different answers. Everything is fine with my code below. However, when picture is introduced right after \begin{group} it simply doesn't work.
Edit: I don't to \leavevmode that.
Look at my MWE:
\documentclass{book}
\usepackage{amsthm}
\usepackage{lipsum}
\newtheorem{thm}{Theorem}
\usepackage{graphicx}
\usepackage[font=footnotesize]{caption}
\input{insbox.tex}
\usepackage{threeparttable}
\usepackage{xargs}
\newcommand\insertpictureR[3][5]{
\InsertBoxR{0}{\begin{threeparttable}\begin{tabular}{c@{}}\includegraphics[width=#3\textwidth]{#2}\end{tabular}\captionof{figure}{}\end{threeparttable}}[#1]%
}
\newcommand\insertpictureL[3][5]{
\InsertBoxL{0}{\begin{threeparttable}\begin{tabular}{c@{}}\includegraphics[width=#3\textwidth]{#2}\end{tabular}\captionof{figure}{}\end{threeparttable}}[#1]%
}
\begin{document}
\begin{thm}
\insertpictureR{example-image-a}{0.2}
\lipsum[1]
\end{thm}
\begin{proof}
\insertpictureL{example-image-a}{0.2}
\lipsum[1]
\end{proof}
\end{document}


wrapfigpackage in this case solve the problem? My best regards. – Sebastiano Jun 27 '19 at 21:03insboxoften works better, because it's based on plain TeX. – Bernard Jun 27 '19 at 21:17I still use it :) But today I've got this problem. Well, probably I need to try another approach at all... like dividing it into 2 minipages, but that seems to be so unnecessary.
– Jun 27 '19 at 21:26