I have encountered a strange behaviour of wrapfigure
, that I have isolated in the following example. I don't know if it's a bug or not.
I have this latex source:
\documentclass[a4paper]{article}
\usepackage[czech]{babel}
\usepackage{graphicx}
\usepackage{wrapfig}
\newenvironment{myenvironment}{}{}
\def\poisonousparagraph{
\begin{myenvironment}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam at rhoncus libero. Nunc auctor neque ut urna sodales vestibulum.
\end{myenvironment}
}
\begin{document}
\begin{wrapfigure}{r}{0.5\textwidth}
\begin{center}
\includegraphics[width=0.48\textwidth]{some_picture}
\end{center}
\caption{Lorem ipsum}
\end{wrapfigure}
\poisonousparagraph
\poisonousparagraph
\poisonousparagraph
\poisonousparagraph
\poisonousparagraph
\poisonousparagraph
\poisonousparagraph
\poisonousparagraph
\end{document}
Instead of the paragraphs with Lorem ipsum
s wrapping nicely, they are only a half-page wide in the entire document, exactly like this (link to my server with the PDF).
What, however, "fixes" the problem is making the text in poisonousparagraph
longer. Or, if I delete the myenvironment
altogether. However, in real example, I do need to use custom environments and I do need to use short text like this.
What is going on exactly?
edit: as I have tried, it has nothing to do with the picture itself, if I change it to a .png one, it still does the same thing. Also, it behaves the same when using both latex
and pdflatex
.