# What's the best way to include graphics in an enumerated list?

I'm currently putting together an installation document for some software at work, and I decided that now was as good a time as any to try to ditch the endless frustration that is Microsoft Word, and try and do it using TeX/XeLaTeX.

I'm trying to keep the same feel of previous documents that my team has produced for similar installations, and this means the document is going to be largely composed sections which are basic "1) Do this", "2) now do this" sections. Not terribly enthralling, but it's sort of the standard. The standard also calls for lots of frequent screen shots of the installer, which I've been trying to include directly into an enumerate list, which is how I approached the "1), 2)" format described above.

The problem with LaTeX's usual approach to including figures means that they can end up some way away from the text which is referencing them. This might be fine in an academic paper, but it might be a bridge too far for my colleagues - so I've been trying to include the graphics directly into the list. My results thus far are not perfect.

Here's a snippet of the XeLaTeX:

\begin{enumerate}
\item Navigate to d:\textbackslash boringwindowspath''
\item Run Setupee.exe
\begin{figure}[h]
\item
\caption*{Click Yes'' to install MS Visual C++ 2008 redistributables.}
\includegraphics{./Images/screenshot01.png}
}
\end{figure}
\end{enumerate}


This produces something like this :

As you can see, the 3rd item is shoved a ways out to the left, and I can't work out why. I've scaled the image itself so it doesn't take up the whole page width - so what's going on here?

Or is my whole approach wrong, and there's some dead easy way to do what I'm trying to achieve?

-
Remove the figure environment. You'll probably have to use \captionof from the caption package. –  qubyte Feb 29 '12 at 11:36
the "click ..." doesn't really seem like a caption to me, just item text. if you treat it that way, then also removing the figure environment should give you exactly what you want. –  barbara beeton Feb 29 '12 at 13:45

I'd use a minipage:

\documentclass{article}
\usepackage[demo]{graphicx}
\begin{document}
\begin{enumerate}
\item Navigate to \texttt{d:\textbackslash boringwindowspath}''
\item Run \texttt{Setupee.exe}
\item \begin{minipage}[t]{\linewidth}
\raggedright
\includegraphics[width=.8\linewidth]{./Images/screenshot01.png}%
}

\medskip
Click Yes'' to install MS Visual C++ 2008 redistributables.
\end{minipage}
\end{enumerate}
\end{document}


-
Brilliant - this does exactly what I need - thank you so much for such a speedy answer! –  GodEater Feb 29 '12 at 12:05
Would it still be possible to use a caption? The little text under the \medskip works as a caption if you use \centered. But if caption is used you get the good old "caption outside float" error. –  timss Sep 16 '13 at 20:29
@timss I don't think this kind of pictures needs a caption. If you really want it, use \begin{minipage}[t]{<dimen>}...\end{minipage} around the adjusted \includegraphics and add \captionof{figure}{...} (requires either the package caption or capt-of). –  egreg Sep 16 '13 at 20:32
@egreg I'm new to LaTeX and thought that maybe a \caption{} was preferred as it's usually the standard for adding a caption to a figure of a table. In my case I want my figure to be centered and it works just fine using your example, so in that case there's no need to use a caption? If so when should I use a caption? –  timss Sep 16 '13 at 22:42
@timss This is only my opinion: any picture that has to stay where we want it (as opposed to the figure environment that places it where it's typographically better) doesn't need a caption, because it's simply part of the text. –  egreg Sep 16 '13 at 22:43

Here is a minimal example to show one way to do this. Using the caption package allows you to attach captions to non-floating environments. You can also use the capt-of package for equivalent results.

\documentclass{article}
\usepackage{caption}
\usepackage[demo]{graphicx}

\begin{document}

\begin{itemize}
\item hello
\item \parbox{\linewidth}{\centering
\includegraphics[width=2in, height=1in]{}\\
\captionof{figure}{Some caption stuff.}
}
\item goodbye
\end{itemize}

\end{document}


However, from your image it seems that you're not interested in labelling your captions. If this is the case, then you must use the caption package rather than capt-of, as caption provides the \captionof* command, which removes the label.

-
I'll have a play with this approach as well - thanks for the quick answer! –  GodEater Feb 29 '12 at 12:06
No problem. I just noticed that I used itemize here instead of enumerate. It'll still work though. :) –  qubyte Feb 29 '12 at 12:10

Depending on how committed you are to the idea of an enumerated list, you might try some alternatives. Here's one using the tufte-handout class, which allows a lot of space for readers to write notes in the margins. The custom \screenshot command may help when you have lots of images you want to keep consistent:

\documentclass{tufte-handout}
\usepackage{graphicx}

...

\newcommand{\button}[1]{\emph{#1}}
\newcommand{\screenshot}[2]{
\begin{figure}
\includegraphics[scale=0.25]{#1}
\caption{#2 \label{fig:#1}}
\end{figure}
}

....

Click the Windows \button{Start} button in the bottom left corner of your screen, then