[Tex/LaTex] Why is text not wrapping around image

wrapfigure

How come \lipsum works but not actual text? I would like to be able to put my own text in.

This question came out of not getting this answer to work.

Thanks so much for any help.

\documentclass{article}
\usepackage{graphicx,lipsum,wrapfig}% http://ctan.org/pkg/{graphicx,lipsum,wrapfig}
\begin{document}

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
\lipsum[1]
\endgroup

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac urna at eros tristique imperdiet et ut mauris. Maecenas semper commodo purus id egestas. Praesent at nisi non magna molestie varius ac sed arcu. Proin aliquet dui eget sapien venenatis rutrum. In vel eleifend tortor, eu sodales nulla. Vivamus sit amet posuere sem. Aliquam scelerisque ac mauris eu feugiat. Donec faucibus est in justo ullamcorper tincidunt. In hac habitasse platea dictumst. Ut et odio a orci eleifend iaculis. Praesent rhoncus auctor arcu eget vulputate. Sed commodo mi id quam hendrerit porttitor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
\endgroup
\end{document}

enter image description here

Best Answer

\lipsum definition ends with a paragraph end, you need a blank line before the \endgroup as below, or safer if there is any possibility of the group ending before the text cutout is finished, do not put wrapfig in a group at all.

Note that changing \columnsep within the document will have odd effects if you have a two column document and a page break happens to fall within the scope of the change.

enter image description here

\documentclass{article}
\usepackage{graphicx,lipsum,wrapfig}% http://ctan.org/pkg/{graphicx,lipsum,wrapfig}
\begin{document}

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
\lipsum[1]
\endgroup

\begingroup
\setlength{\intextsep}{0pt}
\setlength{\columnsep}{15pt}
\begin{wrapfigure}{r}{0.45\textwidth}
\centering
  \includegraphics[width=\linewidth]{example-image-a}
  \caption{Caption}\label{versusMABs}
\end{wrapfigure}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ac urna at eros tristique imperdiet et ut mauris. Maecenas semper commodo purus id egestas. Praesent at nisi non magna molestie varius ac sed arcu. Proin aliquet dui eget sapien venenatis rutrum. In vel eleifend tortor, eu sodales nulla. Vivamus sit amet posuere sem. Aliquam scelerisque ac mauris eu feugiat. Donec faucibus est in justo ullamcorper tincidunt. In hac habitasse platea dictumst. Ut et odio a orci eleifend iaculis. Praesent rhoncus auctor arcu eget vulputate. Sed commodo mi id quam hendrerit porttitor. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.

\endgroup
\end{document}
Related Question