0

I compiled this answer and got a very different result, as shown below.

There's no compilation error, with both TeXstudio and TeXworks, just a bunch of warnings about fonts:

/usr/bin/pdflatex (file /usr/share/texlive/texmf-var/fonts/map/pdftex/updmap/pdftex.map): fontmap entry for `pagd8y' already exists, duplicates ignored

I'm on Fedora workstation and use the package manager dnf install texlive-* where * is the package name.

I do use wrapfig in other documents with tikzpicture and it works as expected.

Am I missing a package?

EDIT : On Overleaf, only the 2nd figure isn't wrapped around and the issue is solved by @DavidCarlisle answer.

EDIT 2 : the problem comes from lipsum package (version 2021-03-03 v2.3). Replacing lipsum paragraphs with text solves the issue. See the comment thread for details. Thanks to @DavidCarlisle.

pdfLaTeX output Overleaf output

macxpat
  • 119

1 Answers1

2

This is a change to the lipsum package, not adding so many \par add a blank line before the \endgroup after the second example, so wrapfig is seen before the paragraph ends.

enter image description here

\documentclass{article}
\usepackage{graphicx,lipsum,wrapfig}% http://ctan.org/pkg/{graphicx,lipsum,wrapfig}
\begin{document}
% Default settings
\begin{wrapfigure}{r}{0.5\textwidth}
  \centering\includegraphics[width=\linewidth]{example-image-a}
  \caption{Basic layout}
\end{wrapfigure}
\lipsum[1]

% Adjusted settings \begingroup \setlength{\intextsep}{0pt}% \setlength{\columnsep}{0pt}% \begin{wrapfigure}{r}{0.5\textwidth} \centering\includegraphics[width=\linewidth]{example-image-a} \caption{Basic layout} \end{wrapfigure} \lipsum[1]

\endgroup \end{document}

David Carlisle
  • 757,742
  • It ain't changing nothing! It did change on Overleaf, but not my machine :( – macxpat Mar 04 '22 at 10:30
  • then you have something else wrong what version of lipsum and wrapfig are reported in the log ? also what version of latex ? I used an up to date texlive 2022 with LaTeX2e <2021-11-15> patch level 1, Package: wrapfig 2003/01/31 v 3.6 and Package: lipsum 2021-09-20 v2.7 150 paragraphs of Lorem Ipsum dummy text @macxpat – David Carlisle Mar 04 '22 at 10:34
  • Package wrapfig : idem ; package lipsum v2.3 (2021-03-03) ; $latex --version returns pdfTeX 3.141592653-2.6-1.40.22 (TeX Live 2021) kpathsea version 6.3.3. – macxpat Mar 04 '22 at 11:00
  • @macxpat that's the pdftex binary version, more relevant is the latex2e version as shown in tke startup at the top of the log in the fom LaTeX2e <somedate> patch level perhaps – David Carlisle Mar 04 '22 at 11:22
  • Here's the full log: This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex 2022.1.23) LaTeX2e <2020-10-01> patch level 4 L3 programming layer <2021-05-07> – macxpat Mar 04 '22 at 11:29
  • 1
    what happens if you don't use lipsum and just write some literal txt there one two three repated a few times, with a blank line at the end? that wouldl cut out the lipsum update @macxpat – David Carlisle Mar 04 '22 at 11:43
  • @macxpat it's possible that wrapfig was broken by that latex release (there were some changes to paragraph handling) that got fixed, I can't easily check now, will look later – David Carlisle Mar 04 '22 at 11:53
  • Yes, indeed. Replacing lipsum paragraphs with some text solve the problem : text properly wraps around the figures. – macxpat Mar 04 '22 at 13:00
  • @macxpat OK let's call this done then, after being stable for years there were a few updates to lipsum around that time it's probably not worth worrying about or you could get the latest from ctan and use that rather than your linux texlive version – David Carlisle Mar 04 '22 at 14:20