3

I am writing my first book. I need to wrap figures. I want text to flow it. I am searching in the internet the best way to do it. I need it in theorems with formulas. And way from the topic below is the best, but here is problem. It doesn't work with formulas properly! Look at the screenhot. Awful! I can't correct it manually.

PS. I do not need exactly this way of adding pictures. If you know correct way which works with theorems, formulas, tell me please.

How to wrap around a figure in a theorem-like environment?

this:

enter image description here

and this:

enter image description here

this is normal, but without formulas:

enter image description here

\documentclass{article}
    \usepackage[T2A]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage[russian]{babel}


\usepackage[]{graphicx}
\usepackage{amsmath,amsthm,amssymb,amscd}   
\usepackage{caption}
\usepackage{picins}   
\usepackage{microtype}
\usepackage{cutwin}


\newbox\mybox 
\newdimen\myboxwidth    

\newcommand\addpicture[3]{% 
\setbox\mybox=\hbox{\includegraphics[scale=#3]{#2}}
\myboxwidth\wd\mybox    
\renewcommand\windowpagestuff{% 
\includegraphics[scale=#3]{#2}
\captionof{figure}{}}
\parpic[#1]{% 
\begin{minipage}{\myboxwidth}
 \windowpagestuff 
\end{minipage} 
} }

\theoremstyle{plain}
\newtheorem{thm}{Теорема}
\renewcommand{\thethm}{\arabic{thm}}

\begin{document}
\begin{thm}[о существовании и единственности неявной функции, заданной одним уравнением]\label{yaa14th1}
Пусть функция $F(x,y)$ определена и непрерывна в некоторой $\delta$-окрестности точки $(x_0,y_0)$, и пусть $F(x_0,y_0)=0$. Тогда, если $F(x,y)$ при каждом фиксированном $x$ строго монотонна по $y$, то у точек $x_0$ и $y_0$ существуют окрестности $\Delta$ и $(a;b)$ такие, что на множестве $\Delta\times(a;b)$ уравнение $F(x,y)=0$ определяет единственную неявную функцию $y=f(x),\; x\in\Delta$, и эта функция  $f$ непрерывна на $\Delta$. 
\end{thm}

\begin{proof}

По условию функция $F(x_0,y)$ строго монотонна и равна нулю при  $y_0$.\addpicture{r}{ch9pict1.png}{0.47} Пусть для определенности, она строго возрастает. Тогда $F(x_0,y)>0$ для всех допустимых $y>0$ и $F(x_0,y)<0$ для всех допустимых $y<y_0$.
Выберем некоторые $a$ и $b$ такие, что $a<y_0<b$ и точки $(x_0,a)$, $(x_0,b)$ лежать в $\delta$-окрестности точки $(x_0,y_0)$. Тогда
$$
F(x_0,a)<0<F(x_0,b).
$$



Функции $F(x,a)$ и $F(x,b)$ непрерывны в точке $x_0$, поэтому существуют окрестности $\Delta'$ и $\Delta''$ точки $x_0$ такие, что (рис.)
$$
F(x,a)<0 \quad \forall x\in \Delta', \qquad F(x,b)>0\quad \forall x\in \Delta''.
$$



Отсюда следует, что $F(x,a)<0<F(x,b)$ для любого $x$ из интервала $\Delta = \Delta'\cap\Delta''$. А так как функция $F(x,y)$ при каждом фиксированном $x\in\Delta$ по $y$ непрерывна и строго монотонна, то для каждого $x\in \Delta$ существует единственное $y$, которое обозначим $f(x)$, такое что $f(x)\in(a;b)$ и $F(x,f(x))=0$. Следовательно, на прямоугольнике $\Delta\times(a;b)$ уравнение $F(x,y)=0$ определяет единственную неявную функцию $y=f(x)$. Докажем, что она непрерывна в точке $x_0$

Выберем некоторую окрестность $(\alpha;\beta)$ точки $y_0$. Не ограничивая общности, будем считать, что $(\alpha;\beta)\subset (a;b)$. Тогда точно также, как и для интервала $(a,b)$, строится окрестность $\Delta=\Delta(\alpha;\beta)$ точки $x_0$ такая, что $\forall x\in\Delta \quad f(x)\in(\alpha;\beta)$. А это и означает, что функция $f$ непрерывна в точке $x_0$.

Непрерывность функции $y=f(x)$ в любой точке $x_1\in\Delta$ следует из того, что в точке с координатами $x_1$ и $y_1=f(x_1)$ выполнены все условия теоремы, поэтому, согласно доказанному, у точки $(x_1,y_1)$ существует прямоугольная окрестность, в которой уравнение $F(x,y)=0$ определяет единственную функцию $y=f(x_1),\;x\in\Delta_1$, которая непрерывна в точке $x_1$. Очевидно, что $f_1(x)=f(x)\quad \forall x\in\Delta\cap\Delta_1$, и поэтому функция $f(x)$ непрерывна в точке $x_1\in\Delta$.

Теорема доказана.
\end{proof}

\end{document} 
  • Side note: you ought to find out a way to include example pictures everyone has. There should be some way to include pictures that come with a package or the likes. – MickG Mar 06 '16 at 12:53
  • For code readability, I would suggest putting the \addpictures on a line by themselves instead of in the middle of the text. – MickG Mar 06 '16 at 12:58
  • And I will get the second printscreen with your suggestion. It is worse... –  Mar 06 '16 at 13:00
  • Hm, doesn't change anything on my computer… – MickG Mar 06 '16 at 13:10
  • Unfortunately, picins is not well-documented, and I have no idea what the other parameters to \parpic are for. \parpic(<dimen>,<dimen>)(<dimen>,<dimen>)[…][……]{………} is the full syntax. It appears the third dimen moves the picture sideways and the fourth one moves it vertically, but the first two I have no idea what they are for, and the …… is a mystery. – MickG Mar 06 '16 at 13:18
  • You'll have to wait for someone else to see this, I can't answer… – MickG Mar 06 '16 at 13:19
  • oh, I do not need exactly this way of adding pictures. If you know correct way which works with theorems, formulas, tell me please. –  Mar 06 '16 at 13:22
  • \parpic(width,height)(x-offset,y-offset)[Options][Position]{Picture} –  Mar 06 '16 at 13:26
  • Actually, I don't know. I usually just wrap them in a center, never mixed them with text. But you can try using wrapfig or atbegshi (just naming packages I have seen named in wrapping picture questions). – MickG Mar 06 '16 at 13:28
  • (width,height) of what? – MickG Mar 06 '16 at 13:29
  • <<If the width and height are not given [in which case also no offsets can be given] or if they are given as 0pt, the actual size of the Picture is used.>>

    I guess, of area for picture...

    –  Mar 06 '16 at 13:31
  • OK. atbegshi is a wrong memory I had. Nothing to do with pictures :). – MickG Mar 06 '16 at 13:34
  • and wrapfig does not work in theorems... –  Mar 06 '16 at 13:35
  • Seems it works in no environment at all… – MickG Mar 06 '16 at 13:35
  • Tried floatflt but the result was even stranger. – MickG Mar 06 '16 at 13:45

1 Answers1

2

Here is a solution which relies on the threeparttable package and the insbox set of macros. I define a \myaddpicture command, which uses an optional argument and two mandatory arguments (the graphic file and its scaling). The optional argument is a correction for the number of shorter lines (5 by default, in order to place the caption).

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian]{babel}
\usepackage[demo]{graphicx}
\usepackage{amsthm}
\usepackage{caption}
\usepackage{microtype}

\theoremstyle{plain}
\newtheorem{thm}{Теорема}
\renewcommand{\thethm}{\arabic{thm}}

\input{insbox.tex}
\usepackage{threeparttable}
\newcommand\myaddpicture[3][6]{%
\InsertBoxR{0}{\begin{threeparttable}\begin{tabular}{c@{}}\includegraphics[scale=#3]{#2}\end{tabular}\captionof{figure}{}\end{threeparttable}}[#1]
}

\begin{document}

\begin{thm}[о существовании и единственности неявной функции, заданной одним уравнением]\label{yaa14th1}
  Пусть функция $F(x,y)$ определена и непрерывна в некоторой $\delta$-окрестности точки $(x_0,y_0)$, и пусть $F(x_0,y_0)=0$. Тогда, если $F(x,y)$ при каждом фиксированном $x$ строго монотонна по $y$, то у точек $x_0$ и $y_0$ существуют окрестности $\Delta$ и $(a;b)$ такие, что на множестве $\Delta\times(a;b)$ уравнение $F(x,y)=0$ определяет единственную неявную функцию $y=f(x),\; x\in\Delta$, и эта функция $f$ непрерывна на $\Delta$.
\end{thm}

\begin{proof}

  По условию функция $F(x_0,y)$ строго монотонна и равна нулю при $y_0$.%\addpicture{r}{ch9pict1.png}{0.47}
  \myaddpicture{ch9pict1.png}{0.47}
  Пусть для определенности, она строго возрастает. Тогда $F(x_0,y)>0$ для всех допустимых $y>0$ и $F(x_0,y)<0$ для всех допустимых $y<y_0$.
  Выберем некоторые $a$ и $b$ такие, что $a<y_0<b$ и точки $(x_0,a)$, $(x_0,b)$ лежать в $\delta$-окрестности точки $(x_0,y_0)$. Тогда
  $$
  F(x_0,a)<0<F(x_0,b).
  $$



  Функции $F(x,a)$ и $F(x,b)$ непрерывны в точке $x_0$, поэтому существуют окрестности $\Delta'$ и $\Delta''$ точки $x_0$ такие, что (рис.)
  \[
  F(x,a)<0 \quad \forall x\in \Delta', \qquad F(x,b)>0\quad \forall x\in \Delta''.
   \]

  Отсюда следует, что $F(x,a)<0<F(x,b)$ для любого $x$ из интервала $\Delta = \Delta'\cap\Delta''$. А так как функция $F(x,y)$ при каждом фиксированном $x\in\Delta$ по $y$ непрерывна и строго монотонна, то для каждого $x\in \Delta$ существует единственное $y$, которое обозначим $f(x)$, такое что $f(x)\in(a;b)$ и $F(x,f(x))=0$. Следовательно, на прямоугольнике $\Delta\times(a;b)$ уравнение $F(x,y)=0$ определяет единственную неявную функцию $y=f(x)$. Докажем, что она непрерывна в точке $x_0$
  \myaddpicture{ch9pict1.png}{0.47}

  Выберем некоторую окрестность $(\alpha;\beta)$ точки $y_0$. Не ограничивая общности, будем считать, что $(\alpha;\beta)\subset (a;b)$. Тогда точно также, как и для интервала $(a,b)$, строится окрестность $\Delta=\Delta(\alpha;\beta)$ точки $x_0$ такая, что $\forall x\in\Delta \quad f(x)\in(\alpha;\beta)$. А это и означает, что функция $f$ непрерывна в точке $x_0$.

  Непрерывность функции $y=f(x)$ в любой точке $x_1\in\Delta$ следует из того, что в точке с координатами $x_1$ и $y_1=f(x_1)$ выполнены все условия теоремы, поэтому, согласно доказанному, у точки $(x_1,y_1)$ существует прямоугольная окрестность, в которой уравнение $F(x,y)=0$ определяет единственную функцию $y=f(x_1),\;x\in\Delta_1$, которая непрерывна в точке $x_1$. Очевидно, что $f_1(x)=f(x)\quad \forall x\in\Delta\cap\Delta_1$, и поэтому функция $f(x)$ непрерывна в точке $x_1\in\Delta$.

  Теорема доказана.
\end{proof}

\end{document} 

enter image description here

Bernard
  • 271,350
  • I am sorry, but I get only black squares. How can I get pictures :( –  Mar 06 '16 at 14:07
  • This comes from the demo option for graphics, as I don't have your pictures. Remove the option. – Bernard Mar 06 '16 at 14:13
  • Oh, I didn't know. And it works! Thanks, man. And If I put \myaddpicture exactly after \begin{proof} I will get awful effect. But It is not a big deal. –  Mar 06 '16 at 14:17
  • Add \leavevmode before \myaddpicture. Naturally, you can have pictures on the left with the \InsertBoxL command instead of InsertBoxR (but you'll have some problems at the beginning of the proof environment). – Bernard Mar 06 '16 at 14:23
  • And last question. How can I refer this picture? Usual way \label \ref do not work properly –  Mar 06 '16 at 14:30
  • I don't see at the moment how to add labels to the macro. I don't really have time at the moment, and will give a try tomorrow. – Bernard Mar 06 '16 at 15:10
  • Oh, it will be great. And there is another question. See your screenshot. Words "Пусть для определенности" are on another line, another paragraph. But I do not want to break paragragh, because it is not a new paragraph . And I do not want to see the word "Доказательство" alone on a line by itself. Heh, may be it is too much. but if it is possible... –  Mar 06 '16 at 15:56
  • And I hope, last. I want to do InsertBoxR on odd pages. and InsertBoxL on the even pages. How can I differ this (except manually)? –  Mar 06 '16 at 16:38
  • http://tex.stackexchange.com/questions/297627/how-to-wrap-pictures-in-lists-in-theorems-with-formulas @Bernard see it please –  Mar 06 '16 at 21:11