# Wrap figure interfering with text

I wanted to wrap my figure and just write text around it but this happens:

Here's my code:

\subsection{Príklad č.2}
\textbf{Zadanie:} Na obrázku \ref{koleno} je znázornené koleno.\\

\begin{wrapfigure}{r}{0.40\textwidth}
\includegraphics[width=0.9\linewidth]{uloha2.png}
\caption{Koleno (zdroj: Zadania bonusových príkladov )}
\label{koleno}

\end{wrapfigure}

\begin{tabular}{l l}
$D_1 = 20 \quad mm$   & $p= 49 900 \quad Pa$\\
$D_2 = 10 \quad mm$   & $V_k =1.8 \cdot 10^{-5} \quad m^3$\\
$H = 0.1 \quad m$ & $\rho = 998 \quad kg\cdot m^{-3}$ \\
$h = 25 \quad mm$ &  $g = 9.81 \quad m \cdot s^{-1}$\\
\end{tabular}

\\ Vypočítať:
\begin{itemize}
\item Silu $\Vec{F_K}$ pôsobiacu na koleno (vzťah odvodiť z vety o zmene hybnosti)
\item Odvodiť vzťah závislosti priemeru paprsku na súradnici z. Predpokladá sa, že paprsok je celú dobu kompaktný a nerozkladá sa.
\item Silu pôsobiacu na dosku.
\end{itemize}
\subsubsection{BR 2 (výstup z kolena) - 3 (vrchol paprsku)}
$$\frac{p}{\rho} + \frac{{v_2}^2}{2} + gh_2 = \frac{p_3}{\rho} + \frac{{v_3}^2}{2} + gh_3$$
Tlak okolia je konštantný, takže mi vypadne z rovnice tlaková potencionálna energia na vrchole paprsku. Taktiež mi vypadne kinetická merná energia na vrchole paprsku, pretože tam je už všetka spotrebovaná.
\begin{equation*}
\frac{p}{\rho} + \frac{{v_2}^2}{2} + gh_2 = gh_3
\end{equation*}
\begin{equation*}
\frac{{v_2}^2}{2} = g (h_3 - h_2 ) - \frac{p}{\rho}
\end{equation*}
\begin{equation*}
v_2 = \sqrt{2 \cdot (g \cdot H - \frac{p}{\rho}) }
\end{equation*}


Do you know what's the problem ? thanks

• Unrelated to the issue itself, but you might want to take a look at the siunitx package in order to improve the typesetting of numbers and their units. Apr 17 at 7:38
• thank you so much, I am still learning LaTex. Good to know ! Apr 17 at 9:26

## 2 Answers

When things that are not plain text are present, the automatic calculations of the figure space is often wrong. You can do two things:

1. In this case, you have a lot of white space above. Try adding a \vspace*{-1.5cm} (or whatever) before the \includegraphics.

2. say explicitly to wrapfig how many lines you want to skip. You have to use the optional argument:

\begin{wrapfigure}[16]{r}


adjusting the 16 more or less by try and error (LaTeX is not really though for wrapfigures, I fear).

If you had posted a complete minimal working example (MWE), I could have tried it...

• Thank you, it worked. but now the rest of the page is like this. Like if there would be a figure there or something Apr 16 at 16:53
• oh I cant post an image to a commment. like the text is all just on the left side of the page Apr 16 at 16:53
• Yes, change the 16 until you got your result... it's difficult to tell if you don't prepare a MWE. Also, there is very interesting info here: tex.stackexchange.com/questions/238680/… Apr 16 at 16:57

Probably this alternative, that uses two minipages instead of wrapfig also suits your needs:

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{caption}
\usepackage[export]{adjustbox}
\begin{document}

\subsection{Príklad č.2}

\begin{minipage}[t]{0.55\linewidth}
\textbf{Zadanie:} Na obrázku \ref{koleno} je znázornené koleno.
\begin{aligned} D_1 &= \SI{20}{\mm} & p &= \SI{49 900}{\Pa} \\ D_2 &= \SI{10}{\mm} & V_k &= \SI{1.8e-5}{\cubic\m} \\ H &= \SI{0.1}{\m} & \rho &= \SI{998}{\kg\per\cubic\m} \\ h &= \SI{25}{\mm} & g &= \SI{9.81}{\m\per\s} \\ \end{aligned}
Vypočítať:
\begin{itemize}
\item Silu $\Vec{F_K}$ pôsobiacu na koleno (vzťah odvodiť z vety o zmene hybnosti)
\item Odvodiť vzťah závislosti priemeru paprsku na súradnici z. Predpokladá sa, že paprsok je celú dobu kompaktný a nerozkladá sa.
\item Silu pôsobiacu na dosku.
\end{itemize}
\end{minipage}\hfill
\begin{minipage}[t]{0.4\linewidth}
\includegraphics[width=\linewidth,valign=t]{example-image-10x16}
\captionof{figure}{Koleno (zdroj: Zadania bonusových príkladov )}
\label{koleno}
\end{minipage}

\subsubsection{BR 2 (výstup z kolena) - 3 (vrchol paprsku)}
$$\frac{p}{\rho} + \frac{{v_2}^2}{2} + gh_2 = \frac{p_3}{\rho} + \frac{{v_3}^2}{2} + gh_3$$
Tlak okolia je konštantný, takže mi vypadne z rovnice tlaková potencionálna energia na vrchole paprsku. Taktiež mi vypadne kinetická merná energia na vrchole paprsku, pretože tam je už všetka spotrebovaná.
\begin{align*}
\frac{p}{\rho} + \frac{{v_2}^2}{2} + gh_2 &= gh_3    \\
\frac{{v_2}^2}{2} &= g (h_3 - h_2 ) - \frac{p}{\rho} \\
v_2 &= \sqrt{2 \cdot (g \cdot H - \frac{p}{\rho}) }
\end{align*}
\end{document}