1

I have a list full of text but also need a graphic to be within it, on the right hand side, and have text wrap around it.

I have been looking around and found really nothing useful and when I do, it just plops it on the bottom.

Preamble:

\documentclass{article}

\usepackage[letterpaper, portrait, margin=2cm]{geometry}
\usepackage[english]{babel}
\usepackage[protrusion=true,expansion=true]{microtype}  
\usepackage{amsmath,amsfonts,amsthm,amssymb}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[svgnames,table,xcdraw,dvipsnames]{xcolor} 
\usepackage[version=3]{mhchem}
\usepackage{chemfig}
\usepackage{gensymb}
\usepackage[most]{tcolorbox}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{array}
\usepackage{xparse}
\usepackage{tikz}
\usepackage{makecell}
\usepackage{floatflt}
\usepackage{wrapfig}
\usetikzlibrary{calc,shadings,patterns}
\pagenumbering{roman}

Snipped...document

\section*{Procedure}

\noindent \textbf{Directions:}
    \begin{enumerate}
        \itemsep 0em
        \item Place the following into a 250 ml round-bottomed flask:
        \begin{enumerate}
            \item 27.0 g of sodium bromide
            \item 20.0 ml of \textit{n}-butyl alcohol
            \item 30 ml of water
        \end{enumerate}
        \item Place into an ice-water bath
        \item Cool briefly
        \item Slowly add 23 ml of concentrated sulphuric acid while stirring using the magnetic stirring apparatus
        \item Fit the flask with a water-cooled condenser 
        \begin{wrapfigure}{R}{0.3\textwidth}
        \centering
        \includegraphics[width=0.25\textwidth]{exp14_fig1.pdf}
        \caption{Condenser}
        \end{wrapfigure}
        \item Heat the flask using the magnetic stirrer until the reaction mixture is boiling and note the time
        \item Adjust the stirring hot plate to maintain a brisk, steady reflux with \textit{vigorous} stirring 
        \item Note the separation due to density differences
        \item Reflux for fifty minutes
        \item Cool to room temperature
        \item Set up a steam distillation apparatus using a 100 ml round bottom flask as a receiver

my version is here

eps file

1

The problem here is specific to wrapfig being in a list.

One way around this problem is to adjust the margins within the list manually, and placing the figure in the appropriate position. Below I've used the power of LaTeX3's xgalley to set some relative margins within the enumerate. The image is put flush right inside a zero-height tabular (using \hfill\smash{..}).

As a result of the construction, some fiddling is required to achieve a desirable result. For example, the figure counter is manually stepped in order to allow a typical \caption-like heading to be placed. Additionally a vertical strut is introduced to increase the gap between the image and the "caption".

Finally, the (relative) margin adjustment is placed inside a group to limit the scope of the change.

enter image description here

\documentclass{article}

\usepackage{graphicx}
% http://river-valley.zeeba.tv/media/conferences/tug-2015/0302-Joseph-Wright/
\usepackage{xgalley}

\ExplSyntaxOn
\cs_new_eq:NN \SetAbsMargins \galley_margins_set_absolute:nn % {<left margin>}{<right margin>}
\cs_new_eq:NN \SetRelMargins \galley_margins_set_relative:nn % {<left margin>}{<right margin>}
\ExplSyntaxOff

\begin{document}

\section*{Procedure}

\noindent
\textbf{Directions:}
\begin{enumerate}
  \itemsep 0em
  \item Place the following into a 250 ml round-bottomed flask:
  \begin{enumerate}
    \item 27.0 g of sodium bromide
    \item 20.0 ml of \textit{n}-butyl alcohol
    \item 30 ml of water
  \end{enumerate}
  \item Place into an ice-water bath
  \item Cool briefly
  \item Slowly add 23 ml of concentrated sulphuric acid while stirring using the magnetic stirring apparatus
  \item Fit the flask with a water-cooled condenser
  \hfill\smash{\begin{tabular}[t]{c@{}}
    \raisebox{\dimexpr-\height+\normalbaselineskip}{%
      \includegraphics[width=.25\textwidth]{example-image}} \\
    \refstepcounter{figure}%
    \rule{0pt}{\normalbaselineskip}% Vertical strut
    Figure~\thefigure:~Condenser
  \end{tabular}}

  \begingroup
  \SetRelMargins{0pt}{.3\textwidth}
  \item Heat the flask using the magnetic stirrer until the reaction mixture is boiling and note the time
  \item Adjust the stirring hot plate to maintain a brisk, steady reflux with \textit{vigorous} stirring 
  \item Note the separation due to density differences
  \item Reflux for fifty minutes
  \endgroup
  \item Cool to room temperature
  \item Set up a steam distillation apparatus using a 100 ml round bottom flask as a receiver
\end{enumerate}

\end{document}

The list items themselves are very short, and therefore brings into question the need for (relative) margin adjustments using something as powerful as xgalley. However, in a more general setting, the above would work as well.

That said, you could have achieved a similar result with some manual line-breaking and using \item[]s where there are no enumerations.

  • This one did the trick, I moved the endgroup further down since my actual image was much taller, but this made it work nice. Thank you. What made the text wrap better than the previously answered question above? – Jonathan Weinraub Nov 29 '15 at 23:58
  • @JonathanWeinraub: Of course, you have to adjust the \endgroup depending on your image height. There are also other tricks to pull, but it depends heavily on your document construction. An xgalley approach seemed feasible in this instance. I don't know how to answer your last question, since I don't understand your reference to "better". – Werner Nov 30 '15 at 0:02
1

Here is a solution, using the resume* feature of the enumitem package. It consists in closing the enumerate environment before the inclusion of the image, and create side to side two minipage environments, top-aligned. The left-hand side minipage contains the resumed enumerate, and the right-hand side the image and its caption. At the end of these environments, another resumed enumerate. \documentclass{article} \usepackage[showframe]{geometry} \usepackage{graphicx} \usepackage{array, tabularx, enumitem, caption}

\begin{document}

\section*{Procedure}
\noindent \textbf{Directions:}
\begin{enumerate}[nosep]
  \itemsep 0em
  \item Place the following into a 250 ml round-bottomed flask:
        \begin{enumerate}[noitemsep]
          \item 27.0 g of sodium bromide
          \item 20.0 ml of \textit{n}-butyl alcohol
          \item 30 ml of water
        \end{enumerate}
  \item Place into an ice-water bath
  \item Cool briefly
  \item Slowly add 23 ml of concentrated sulphuric acid while stirring using the magnetic stirring apparatus
\end{enumerate}
\noindent\begin{minipage}[t]{0.7\textwidth}
\begin{enumerate}[resume*]
  \item Fit the flask with a water-cooled condenser
  \item Heat the flask using the magnetic stirrer until the reaction mixture is boiling and note the time
  \item Adjust the stirring hot plate to maintain a brisk, steady reflux with \textit{vigorous} stirring
  \item Note the separation due to density differences
  \item Reflux for fifty minutes
  \item Cool to room temperature
  \item Set up a steam distillation apparatus using a 100 ml round bottom flask as a receiver
  \item Add 50 ml of water and and distil adding water as needed to keep volume constant until no more water-insoluble droplets come over (can be tested by collecting a few drops of distillate in a\emph{dry} test tube to see if any oily droplets are still present)
  \item Pour the distillate into a separatory funnel
\end{enumerate}
\end{minipage}
\hfill
\begin{minipage}[t]{0.3\textwidth}
  \centering\captionsetup{labelfont=sc}\renewcommand\figurename{Fig.}
  \raisebox{-0.95\height}{\includegraphics[width=0.75\textwidth]{exp14_fig1}}
  \captionof{figure}{Condenser}\label{cond}
\end{minipage} \vspace*{-3pt}
\begin{enumerate}[resume*]
  \item Add 20 ml of water, stopper, and shake (the butyl bromide now forms the \emph{lower} layer since water and $ n $-butyl bromide have densities of $1.0$ g/ml and $ 1.3 $ g/ml, respectively)
\end{enumerate}
\end{document} 

enter image description here

  • I added my version. I do not get the tightness around the figure you did. How can this be corrected, I updated my question to reflect what I did. – Jonathan Weinraub Nov 29 '15 at 22:19
  • Could you post the image? – Bernard Nov 29 '15 at 22:21
  • It's above in my original question... – Jonathan Weinraub Nov 29 '15 at 22:22
  • I mean the graphics file, so that I can test. – Bernard Nov 29 '15 at 22:23
  • oh... i added a link above, here it is as well: weinraub.net/images/exp14_fig1.eps – Jonathan Weinraub Nov 29 '15 at 22:26

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.