# Wrap figure moves all the following text

Eventhough I have found few similar question I still cannot handle my problem. Need help.

I want simply to place couple of lines on the right from my picture and begin new page with new section afterwards. Somehow I get as the result all the following text shifted.

\subsection{Estimation of gradient}
\begin{equation}
L'(\theta) = \lim\limits_{h \to 0} \dfrac{L(\theta + h) - L(\theta)}{h} \hspace{4mm} \text{ or}  \hspace{4mm}L'(\theta) = \lim\limits_{h \to 0} \dfrac{L(\theta + h/2) - L(\theta - h/2)}{h}
\end{equation}
Multivariate function

\begin{wrapfigure}{L}{0.35\textwidth}
\vspace{-10pt}
\includegraphics[width=0.33\textwidth]{olcar_L8-51}
\end{wrapfigure}

\begin{align}
\nabla L (\theta_1, \theta_2, \cdots , \theta_p ) = \left [ \frac{\partial L}{\partial \theta_1} , \frac{\partial L}{\partial \theta_2} , \cdots , \frac{\partial L}{\partial \theta_p} \right ]^T
\end{align}

\newpage
\section{Finite Difference (FD) Method}
\begin{itemize}
\item Perturb the parameter vector along each axes individually and estimate the cost gradient in that direction
\begin{align}
& \theta^{i+} =  [\theta^1, \cdots , \theta^{i-1} , \theta^i , \theta^{i+1} + c, \cdots , \theta^p] \notag \\
& \theta^{i-} =  [\theta^1, \cdots , \theta^{i-1} , \theta^i , \theta^{i+1} - c, \cdots , \theta^p]
\end{align}
\begin{align*}
[\nabla J (\theta)]_i = \frac{J(\theta^{i+}) - J(\theta^{i-})}{2c}
\end{align*}
\item This is Kiefer-Wolfowitz (KW) Method
\item Needs $p+1$ or $2p$ measurements for computing gradient vector in one point
\end{itemize}


I get this: • in this case, where you know that the text to the side of the figure will not exceed the depth of the figure, it's more reliable to use two minipages side by side rather than calling on wrapfigure. – barbara beeton Nov 21 '13 at 13:35
• You can specify as an optional argument the number of lines that will be shortened. – Bernard Aug 7 '15 at 13:25
• @Bernard is right – PMC1234 Jan 4 '16 at 19:57

It seems if you have math following wrapfigure, it moves all text following it. If you add even a single line of text it solves the problem.

• You can have math following a wrapfigure environment - it's the display style of it that's problematic. – Werner Nov 10 '14 at 6:23
• Moreover, it's a little wired to add any text into the document just because you cannot format it otherwise. LaTeX is supposed to fulfill our needs, and to vise versa. Using minipages solved the problem. – Foont Nov 11 '14 at 14:36
• @Foont latex aims to support users’ needs for typesetting. it was coded in the 1980s, and wrapfigure (iirc) is a product of the 1990s and not part of latex. if you have been told that latex is “supposed” to do anything, the person who told you is mistaken. latex aims fulfill our needs, and in the large it does a pretty good job. if it already fulfilled every possible need, and had no bugs or infelicities, there would be no need for this site. – wasteofspace Jan 9 '15 at 9:30

specifies the number of lines in wrapfigure option , adjust the number if necessary

\begin{wrapfigure}{L}{0.35\textwidth}
\vspace{-10pt}
\includegraphics[width=0.33\textwidth]{olcar_L8-51}
\end{wrapfigure}