1

I'm having difficulty with wrapfig; the word-spacing often changes and sometimes I am forced to have a new paragraph below when it is not wanted. This is my first post on tex.stackexchange, apologies if I haven't included enough code or background to my issue. I'm praying that this is a common issue with a simple fix but I couldn't find any other questions with a similar problem. (There are many many more packages but I created a new tex file and isolated the passage in which the error was found and it persisted without the other 20 pages of text and images and without many of the other packages).

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{wrapfig}
\usepackage{graphicx}
\setlength\intextsep{0pt}
\setlength{\parindent}{0cm}
\setlength{\parskip}{\baselineskip}
\usepackage[justification=centering]{caption}
\usepackage{ragged2e}
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=2cm]{geometry}
\begin{document}
Niels Henrik Abel (1802-1829) began working on the problem of quintic equations in 1820, at the age of 18 whilst still at school. In his short life, and even shorter working life of six or seven years, Abel ``left mathematicians enough to keep them busy for five hundred years'' \cite[p.~12]{ETBell}.
\begin{wrapfigure}[13]{l}{0.25\linewidth}
        \vspace*{-16pt}
        \setlength{\abovecaptionskip}{4pt plus 1pt minus 1pt}
        \includegraphics[width=\linewidth]{Abel.jpg}
        \caption{\textit{Painting of Abel in 1826, by Johan Gørbitz \cite{AbelPrize}}}
\end{wrapfigure}
    Abel had begun reading the work of Lagrange at a young age. Initially, as many others attempting to find a general solution to the quintic, Abel believed that he had succeeded.
    By 1824, however, he shifted to the venture of proving the impossibility of such general solutions and published a proof in a privately printed booklet \cite[pp.~28-33]{Abel1881}. Having read Cauchy's paper of 1815, Abel was most likely familiar with Ruffini's name but had no recollection of the details of his proof; Abel begins:
        \begin{quote}
        \vspace*{-8pt}
        \textit{Geometers are much concerned with the genereal solution of algebraic equations and several of them have sought to prove the impossibility of it; but if I am not mistaken no-one has succeeded up to the present. I therefore hope that the geometers will receive, with kindess, this [memoir] which aims to fill this gap in the theory of algebraic equations. \cite[p.~28]{Abel1881}}
    \end{quote}

\end{document}

Photo of issue

4

The wrapfig documentation mentions

It is convenient to begin the environment between paragraphs, but if you want placement in the middle of a paragraph, you must put the environment between two words where there is a natural line break.

So the only thing you can do is to be careful where you place the wrapfigure environment. But this also means if and when you add or remove words from that particular paragraph, the spacing will go wrong again. So it involves manual adjustment from you, rather than LaTeX doing the work for you.

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{wrapfig}
\usepackage{graphicx}
\setlength\intextsep{0pt}
\setlength{\parindent}{0cm}
\setlength{\parskip}{\baselineskip}
\usepackage[justification=centering]{caption}
\usepackage{ragged2e}
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=2cm]{geometry}
\begin{document}
Niels Henrik Abel (1802-1829) began working on the problem of quintic equations in 1820, at the age of 18 whilst still at school. In his short life, and even shorter working life of six or seven years, Abel ``left mathematicians enough to keep them busy for five hundred years'' \cite[p.~12]{ETBell}.
Abel had begun reading the work of Lagrange at a 
\begin{wrapfigure}[13]{l}{0.25\linewidth}
    %        \vspace*{-16pt} % <-------------
    \setlength{\abovecaptionskip}{4pt plus 1pt minus 1pt}
    \includegraphics[width=\linewidth]{example-image}
    \caption{\textit{Painting of Abel in 1826, by Johan Gørbitz \cite{AbelPrize}}}
\end{wrapfigure}%
young age. Initially, as many others attempting to find a general solution to the quintic, Abel believed that he had succeeded.
    By 1824, however, he shifted to the venture of proving the impossibility of such general solutions and published a proof in a privately printed booklet \cite[pp.~28-33]{Abel1881}. Having read Cauchy's paper of 1815, Abel was most likely familiar with Ruffini's name but had no recollection of the details of his proof; Abel begins:
        \begin{quote}
        \vspace*{-8pt}
        \textit{Geometers are much concerned with the genereal solution of algebraic equations and several of them have sought to prove the impossibility of it; but if I am not mistaken no-one has succeeded up to the present. I therefore hope that the geometers will receive, with kindess, this [memoir] which aims to fill this gap in the theory of algebraic equations. \cite[p.~28]{Abel1881}}
    \end{quote}

\end{document}

enter image description here


But my personal recommendation is to keep it simple: Place the wrapfigure before/after actual paragraphs, and don't be too concerned about placements of figures/tables etc. in your document.

  • I'd like the paragraph to just continue but I have seen a comment elsewhere that the wrapfigure environment may not allow this as it requires a linebreak? I'm not sure if this is correct though. – Geometry May 10 '18 at 13:20
  • @Geometry Yes, the wrapfigure documentation mentions "It is convenient to begin the environment between paragraphs, but if you want placement in the middle of a paragraph, you must put the environment between two words where there is a natural line break." – Troy May 10 '18 at 13:35
  • Wonderful, thank you for your help. Is it then suggested to include images upon completion of the text? (as otherwise, natural line breaks may move around?) – Geometry May 10 '18 at 13:40
  • 1
    Yes, before or after natural paragraphs would be the intended use. – Troy May 10 '18 at 13:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.