# Wrapfig environment is overlapping text

I am trying to write some text around an image, however the text gets drawn on top of the image rather than around it:

This is the relevant code section:

\section*{De Boor's algorithm}

\begin{wrapfigure}{R}{\linewidth}
\includegraphics[width=0.45\textwidth]{images/order2.png} \\
\includegraphics[width=0.45\textwidth]{images/order3.png} \\
\includegraphics[width=0.45\textwidth]{images/order4.png} \\
\end{wrapfigure}

\lipsum[1]


And these are the packages I am using (I suspect this could be a package conflict?)

\usepackage[margin=1cm,paperwidth=20cm,paperheight=575cm]{geometry}
\usepackage{amsmath}
\usepackage{standalone}
\usepackage{luamplib}
\mplibnumbersystem{double}
\usepackage{tikz,pgf}
\usepackage{mathtools}
\pagenumbering{gobble}
\usepackage{enumitem}  % http://www.ctan.org/pkg/enumitem
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{float}
\usepackage{pgfplots}
\usetikzlibrary{math}
\mplibtextextlabel{enable}
\setlength{\parindent}{0pt}
\usepackage{wrapfig}
\usepackage{lipsum}  % generates filler text

• Don't use lipsum for the filler text. It has a bug that conflicts with wrapfig. github.com/patta42/lipsum/issues/16 – Ulrike Fischer Dec 28 '19 at 22:47
• Well, that sucks : p – Makogan Dec 28 '19 at 22:52
• You can use \blindduck[1-] from duckuments. If you give a - in the optional argument it'll put a \par inside the group and everything will work out fine. – Skillmon likes topanswers.xyz Dec 29 '19 at 0:24
• Did you try \LipsumPar{1} instead of \lipsum[1]? \documentclass{article} \usepackage{wrapfig} \usepackage{graphicx} \usepackage{lipsum} \begin{document} \begin{wrapfigure}[11]{r}[10pt]{6cm} \includegraphics[width=6cm]{example-image-duck} \end{wrapfigure} \lipsum[1] \begin{wrapfigure}[11]{r}[10pt]{6cm} \includegraphics[width=6cm]{example-image-duck} \end{wrapfigure} \LipsumPar{1} \end{document} seems to work as intended. – Schrödinger's cat Dec 29 '19 at 1:26

@UlrikeFischer told you what is the reason and @Skillmon one way how one can evade the problem. Here is another way which uses lipsum: use \LipsumPar{1} instead of \lipsum[1].

\documentclass{article}
\usepackage{wrapfig}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\begin{wrapfigure}[11]{r}[10pt]{6.5cm}
\includegraphics[width=6cm]{example-image-duck}
\end{wrapfigure}
\lipsum[1]

\begin{wrapfigure}[11]{r}[10pt]{6.5cm}
\includegraphics[width=6cm]{example-image-duck}
\end{wrapfigure}
\LipsumPar{1}
\end{document}


As you can see, in the second paragraph, where \LispumPar is used, the issue does not arise.

Why \LispumPar? Let's look at the documentation.

It basically tells you that one should use \LipsumPar instead of \lipsum if one is to simulate just text, at least this is my reading of this.