I want text to flow picture, as it is in the book:
And with advice of @Johannes_B I did it with help of minipage, but It doesn't suit me at all things.
- See this. First page of my document. Do you see that it is wrong?

- I want to insert Pictures always on the outer side of the page! but this will do it never.
How to add mechanism of solving this problem to my super function of adding pictures. (Before this problem it solved all my problems, in lists, environments, items, etc)
WHY WITH POWER OF LATEX NOBODY KNOWS HOW TO INSERT PICTURE IDEALLY IN ANY SUTIATION?!
like Office 2014 - just press one button.
I don't believe that all of latex users do a lot of manual work when try to insert a picture. But I have been trying to do it for three weeks!
I have 2 hundread pictures to insert in my book, and if I will try to insert it manually , I'll go crazy!
I am really shocked, that there are a lot of sutiations when nothing works.
\documentclass{book} \usepackage{graphicx} \usepackage{mwe} \usepackage{amsmath} \usepackage{microtype} \usepackage{caption} \input{insbox.tex} \usepackage{threeparttable} \usepackage{changepage} \usepackage{xargs} \usepackage[showframe]{geometry} \usepackage{printlen} \newtheorem{thm}{Theorem}\newcounter{ct}
\newlength\imageheight
\newcount\narrowlinect \narrowlinect=0\relax \newcounter{pictnumber}
\newcommand{\wrapitem}{\apptocmd{\labelenumi}{\hskip\leftmargin}{}{}\item\apptocmd{\labelenumi}{\hskip-\leftmargin}{}{}} % \newcommandx{\InsertPictL}[4][1=0,3=0]{\refstepcounter{pictnumber}% \settoheight\imageheight{\includegraphics[width=#4\textwidth]{#2}} \narrowlinect=\imageheight\relax \setcounter{ct}{\numexpr((\narrowlinect)/\baselineskip+2)\relax} \setlength{\leftskip}{\leftmargin}\mbox{}\vspace{-\baselineskip}% \InsertBoxL{#1}{\begin{threeparttable}% \begin{tabular}{c@{}}\includegraphics[width=#4\textwidth]{#2}\end{tabular}% \caption*{Pict. \thepictnumber}\end{threeparttable}}[\numexpr(\value{ct}/2+#1+1)]\par \hspace{\itemindent} }%\newcommandx{\InsertPictR}[4][1=0,3=0]{\refstepcounter{pictnumber}%\settoheight\imageheight{\includegraphics[width=#4\textwidth]{#2}} \narrowlinect=\imageheight\relax \setcounter{ct}{\numexpr((\narrowlinect)/\baselineskip+2)\relax} \mbox{}\vspace{-\baselineskip}\setlength{\leftskip}{\leftmargin}% \InsertBoxR{#1}{\hskip-\leftmargin\begin{threeparttable}% \begin{tabular}{c@{}}\includegraphics[width=#4\textwidth]{#2}\end{tabular}% \caption{Pict. \thepictnumber}\end{threeparttable}\hskip\leftmargin}[\numexpr(\value{ct}/2+#1+1)] }%
\newcommandx{\InsertPict}[4][1=0,3=0]{% \strictpagecheck% \checkoddpage% \ifoddpage \InsertPictR[#1]{#2}[#3]{#4} \else% \InsertPictL[#1]{#2}[#3]{#4} \fi% }
\begin{document} \noindent \begin{minipage}[t]{0.7\textwidth} \begin{thm} \lipsum[1] \begin{equation} \int_\gamma f(z),dz = 0. \end{equation} \end{thm} \end{minipage}% \hfill% \begin{minipage}[t]{0.3\textwidth} \InsertBoxR{0}{\includegraphics[width=\dimexpr(\textwidth-2mm)]{example-image-a}} \end{minipage}
\newpage \begin{thm}\InsertPict{example-image-a}{0.3} \lipsum[1] \begin{equation} \int_\gamma f(z),dz = 0. \end{equation} \end{thm}
\newpage \begin{thm}\InsertPict{example-image-a}{0.3} \lipsum[1] \begin{equation} \int_\gamma f(z),dz = 0. \end{equation} \end{thm} \end{document}


wrapfigisn't suited to do the job, useminipages instead. – Johannes_B Mar 19 '16 at 11:06wrapfigseems to be the best solution.cutwinis also available, but i don't have any experience. On the other hand, be advised, that wrapping images always need manual interaction. – Johannes_B Mar 19 '16 at 14:17