2

wrapfig does not wrap text. I have been looking for an answer for about 3h now, tried everything from changing amount of spaces, copy-pasting code that should be working, etc., but nothing is functioning. All I get is a figure somewhere in my text, sometimes not even in the order it should be appearing in.

Here's the important bits of code:

\documentclass[11pt,a4paper]{article}  
% all packages:
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\begin{document}

% bunch of stuf that works as it should

\newpage

\section*{Data Analysis}

\subsection*{Raw data}

\begin{wrapfigure}{l}{0.4\textwidth} % my original wrapfig (it's not where it should be, I put it here because I read that maybe \blindtext and \lipsum messed with wrapfg so I put it above some of my own text.)

    \center

    \includegraphics[width=0.4\textwidth]{1Ttr}

\end{wrapfigure}

\indent

Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\begin{wrapfigure}{r}{0.5\linewidth} %some random code I copied from a different thread
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{Dummy figure.}
\label{fig:myfig}
\end{wrapfigure}
\blindtext

\end{document}

And here's what I get: (The figures appear, but one not where it should, and both do not wrap text) The figures appear, but one not where it should, and both do not wrap text

Is there any way to get this working? Any help would be appreciated, I don't really want to be up until 2AM again tomorrow..

Edit: here's the document with text replaced with placeholders. @john-kormylo's solution works by itself, but not in the full document.

\documentclass[11pt,a4paper]{article}
\usepackage{gobble}
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\author{personal info}
\title{\Huge\textbf {Topic of research}}
\date{}           
    
\begin{document}  
    
\maketitle         
\newpage
                                     
    
\section*{Introduction}
    
\indent           
\blindtext
                  
\section*{Research Question}
                  
\center
                  
\large\textit{\textbf{Topic of research}}
                 
\justify
                                 
    
\section*{Experiment}                   

\subsection*{Variables}
                                                                                                                                                                                             
\begin{itemize}

    \item item

    \item item

    \item item

\end{itemize}
                                                                                                                                                                                             
\subsection*{Apparatus}

\textcolor{red}{PUT BLENDER RENDER HERE}% this works when I tried with a filler image

\newpage
    
\subsection*{Method}
    
\begin{enumerate}

    \item item

    \item item

    \item item

    \begin{itemize}
        \item \small{change procedure if...}
    \end{itemize}

    \item item

    \item item

    \item item

\end{enumerate}

\subsection*{Personal Protection}

\begin{itemize}

    \item item

    \item item

    \item item

    \item item
        
\end{itemize}

\subsection*{Data collection}

\indent % repeated to match original
How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used How to collect data, what was used 

\newpage

\section*{Data Analysis}

\subsection*{Raw data}\leavevmode\par% gobble \@afterheading

\indent
Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\begin{wrapfigure}[8]{l}{0.4\textwidth}
    
    \vspace{-30pt}

    \center

    \includegraphics[width=0.4\textwidth]{1Ttr}

\end{wrapfigure}

\blindtext

\end{document}

And the image of the last bit: Still no wrapfig

3

1 Answer 1

3

Assuming you don't want to overlap the two wrapfigures. Note that \subsection takes up more space than 1 line of text, so you need to specify the number of lines (optional argument) to wrap.

\documentclass[11pt,a4paper]{article}  
% all packages:
\usepackage{blindtext}
\usepackage{wrapfig}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\begin{document}

% bunch of stuf that works as it should

\newpage

\section*{Data Analysis}

\subsection*{Raw data}\leavevmode\par% gobble \@afterheading

\begin{wrapfigure}[11]{l}{0.4\textwidth} % my original wrapfig (it's not where it should be, I put it here because I read that maybe \blindtext and \lipsum messed with wrapfg so I put it above some of my own text.)
    \centering
    \includegraphics[width=0.4\textwidth]{example-image-a}
\end{wrapfigure}

\indent
Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\blindtext

\begin{wrapfigure}{r}{0.5\linewidth} %some random code I copied from a different thread
\centering
\rule{0.9\linewidth}{0.75\linewidth}
\caption{Dummy figure.}
\label{fig:myfig}
\end{wrapfigure}

\blindtext
\end{document}

full page


This version uses paracol. Note the use of \nopar to manually break the paragraph.

\documentclass[11pt,a4paper]{article}
\usepackage{gobble}
\usepackage{blindtext}
\usepackage{paracol}
\usepackage{graphicx}
\graphicspath{ {images} }
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage[utf8]{inputenc}
\usepackage[margin=2cm]{geometry}
\usepackage{ragged2e}
\usepackage[dvipsnames]{xcolor}

\newcommand{\nopar}{{\parfillskip=0pt\parskip=0pt\par}}% manual break

\author{personal info}
\title{\Huge\textbf {Topic of research}}
\date{}           
    
\begin{document}  

\section*{Data Analysis}

\subsection*{Raw data}

\indent
Due to the high amount of data collected, I will not be presenting each data point as a set of numbers, but only their graphs versus time. To see the .odt with all raw data, follow the link in the footnote.\footnote{[Insert link]}    

\subsubsection*{Run 1}

\setcolumnwidth{0.4\textwidth}
\footnotelayout{m}
\begin{paracol}{2}
\intextsep=0pt% spacing for wrapfigure and figure[h]
\begin{figure}[ht]
    \centering
    \includegraphics[width=\linewidth]{example-image}
\end{figure}
\switchcolumn
%\sloppy% SOP for narrow columns
%\vskip-4pt
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Etiam lobortis facilisis sem. Nullam nec mi et neque phare-
tra sollicitudin. Praesent imperdiet mi nec ante. Donec
ullamcorper, felis non sodales commodo, lectus velit ultri-
ces augue, a dignissim nibh lectus placerat pede. Vivamus
nunc nunc, molestie ut, ultricies vel, semper in, velit. Ut
porttitor. Praesent in sapien. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Duis fringilla tristique neque.
Sed interdum libero ut metus. Pellentesque placerat. Nam
rutrum augue a leo. Morbi sed elit sit amet ante lobor-
tis sollicitudin. Praesent blandit blandit mauris. Praesent\nopar
\end{paracol}
\noindent
lectus tellus, aliquet aliquam, luctus a, egestas a, turpis.
Mauris lacinia lorem sit amet ipsum. Nunc quis urna dictum turpis accumsan semper.

\end{document}
2
  • Thanks for this, but unfortunately this doesn't work in my document for some reason. I compiled it on its own, and with the rest of my document commented out, and it wrapped as intended. I'll edit the question so it has all the other stuff that "worked", but seems to be ruining the wrapfig. I tried adding the \leavevmode\par thing in more places, to no avail. Thank you for the help!
    – AtSch
    Jan 20, 2021 at 12:31
  • Thank you very much! The paracol solved it. (When I'm done with this I should probably learn what it does. [: ) I really appreciated the help!
    – AtSch
    Jan 20, 2021 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .