Graphics, Figures & TablesWrap Text in List

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
nashay
Posts: 8
Joined: Thu Jul 16, 2009 9:20 am

Wrap Text in List

Post by nashay »

Is there a way to wrap text around a figure when you are in a bulleted/enumerated list?

I tried to use the following code

Code: Select all

\begin{wrapfigure}{r}{75mm}
\vspace{-12mm}
\begin{center}
\includegraphics[width=70mm]{NoTouch}
\vspace{-5mm}
\caption{Do Not Touch if Hot}
\end{center}
\vspace{-8mm}
\end{wrapfigure}
but the figure seems to move either to the next section, or just disappear all together. I figure there must be a way to wrap the figure within the list and place it in the approximate position specified.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Wrap Text in List

Post by localghost »

Build a complete minimnal working example (MWE) that is reduced to the necessary packages and compilable for everone.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
nashay
Posts: 8
Joined: Thu Jul 16, 2009 9:20 am

Wrap Text in List

Post by nashay »

Code: Select all

\documentclass[11pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\begin{document}
\begin{itemize}
\item Item 1
\begin{wrapfigure}{r}{75mm}
\begin{center}
\includegraphics[width=70mm]{My Pic}
\vspace{-5mm}
\caption{Caption}
\end{center}
\vspace{-10mm}
\end{wrapfigure}
\item Item 2
\item Item 3
\end{itemize}
\end{document} 
In this case, the picture gets pushed to the end of the bullets
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Wrap Text in List

Post by gmedina »

Hi,

take into account the recommendation given in the documentation (containded in the wrapfig.sty file itself):
- You must not specify a wrapfigure in any type of list environment or
or immediately before or immediately after one. It is OK to follow
a list if there is a blank line ("\par") in between.
Perhaps you could use a tabular environment to simulate an itemize environment; something like the following:

Code: Select all

\documentclass[11pt]{article}
\usepackage[demo]{graphicx}% the demo option allows compilation without the 
                         % actual figure; suppress it in your actual code
\usepackage{wrapfig}
\usepackage{lipsum}% justo to automatically generate some text

\begin{document}

\begin{tabular}{cp{11cm}}
  $\bullet$ 
  & 
  \begin{wrapfigure}{r}{75mm}
    \centering
    \includegraphics[width=70mm]{My Pic}
    \caption{A test figure}
    \label{fig:test}
  \end{wrapfigure}
  \lipsum[1]\\
  $\bullet$ & Second item\\
  $\bullet$ & Third item\\
\end{tabular}

\end{document} 
1,1,2,3,5,8,13,21,34,55,89,144,233,...
Post Reply