4

This is what my code looks like:

\documentclass[a4paper, titlepage, 10pt]{report}
\usepackage{graphicx,wrapfig,lipsum}

\begin{document}

\begin{wrapfigure}{r}{5.0cm}
\centering
\rule{5cm}{4cm}
\end{wrapfigure}

a) \lipsum[1] \\
b) \lipsum[2] \\
c) \lipsum[3]

\end{document}

which compiles to this:

                       enter image description here


I would like to replace my crude enumeration with 'enumerate' and 'item', while also retaining the flow of text around the image. From what I could gather, this was/is not supported so people have worked around it with varying degrees of success. Is there a package or command that can do it?


Edit: Among the things I have tried is to use a minipage but that still looks odd, and most importantly text doesn't flow around the image. Also, the bullet point is vertically centered which may become an issue for longer paragraphs. I am not fixated on using 'wrapfig' - it was just the first package that looked like it would play along with 'enumerate'.

\documentclass[a4paper, titlepage, 10pt]{report}
\usepackage{graphicx,wrapfig,lipsum}

\begin{document}

\begin{enumerate}    

\item[a)]
\begin{minipage}{.45\textwidth}
    \lipsum[1]
\end{minipage}
\begin{minipage}{.40\textwidth}
\rule{5cm}{4cm}
  %\includegraphics[scale=0.5]{image.jpg}
\end{minipage}

\item[b)] \lipsum[2]
    
\item[c)] \lipsum[3]

\end{enumerate}

\end{document} 

                       enter image description here

2
  • 1
    Welcome to TeX.SE!
    – Mensch
    Oct 25, 2021 at 22:39
  • 1
    Wrapfigure is based on \parshape and \everypar, which makes it somewhat fragile. As you pointed out, there are a number of alternatives, each with a different limitation. Which ones have you tried and why weren't they acceptable? Oct 26, 2021 at 1:21

1 Answer 1

3

enter image description here

A good workaround is to create a minipage for the enumeration text then place, wrapfigure inside it as follows

\begin{adjustbox}{minipage={\linewidth}, valign=t}
    
    \begin{wrapfigure}{t}{0.3\linewidth}
        
        \includegraphics[width=\linewidth]{example-image-a}
        
        \vspace{-2\baselineskip}
        
    \end{wrapfigure}
    
    \vspace*{0.15em}
    
    \blindtext
    
\end{adjustbox}

MWE

\documentclass[a4paper, titlepage, 10pt]{report}
\usepackage{graphicx}

\usepackage{adjustbox}

\usepackage{wrapfig}

\usepackage{blindtext}

\AfterEndEnvironment{wrapfigure}{\setlength{\intextsep}{0mm}}

\begin{document}
    
    \begin{enumerate}    
        
        \item 
            
            \begin{adjustbox}{minipage={\linewidth}, valign=t}
                
                \begin{wrapfigure}{t}{0.3\linewidth}
                    
                    \includegraphics[width=\linewidth]{example-image-a}
                    
                    \vspace{-2\baselineskip}
                    
                \end{wrapfigure}
                
                \vspace*{0.15em}
                
                \blindtext
                
            \end{adjustbox}

        
        \item \blindtext
        
        \item \blindtext
        
    \end{enumerate}
    
\end{document}
1
  • Is there a chance to bottom-align the picture wrt its paragraph? Oct 27, 2021 at 21:32

You must log in to answer this question.

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