Keep item and includegraphics or figure on same page

I'm creating a software guide where I use enumerated list for the steps. Many of the steps have a screenshot I display under the item. I'd like to keep the item and the following figure or graphic together. I've tried Samepage, which does not work. I've also tried minipages, which works but complicates the enumerated list. I'd have thousands of minipages if I did use it. My solution thus far was to add manual pagebreaks or clearpage. I'd prefer code so I don't have to continually edit the manual breaks.

MWE

    \section{Section Name}
\begin{enumerate}
\item Directions go here
\FloatBarrier \begin{figure[!h]
\centering\includegraphics[scale=0.65]{ImageA.png}
\end{figure} \FloatBarrier
\item Next step in directions.
\FloatBarrier \begin{figure[!h]
\centering\includegraphics[scale=0.65]{ImageB.png}
\end{figure} \FloatBarrier
\item Step three.
\FloatBarrier \begin{figure[!h]
\centering\includegraphics[scale=0.65]{ImageC.png}
\end{figure} \FloatBarrier
\end{enumerate}

• How about not using floating figures at all? I.e. drop the 'dreadful' \begin{figure}...\end{figure}. At the moment, you're not even using \caption, there's no need to let them float around! – user31729 Feb 18 '16 at 22:35

You need not have \includegraphics within a figure environment. In particular, if you want to place images inline within the text, you might as well use the center environment:

\documentclass{article}

\usepackage{mwe}
\usepackage{graphicx}

\begin{document}
\section{Section Name}
\begin{enumerate}
\item Directions go here
\begin{center}
\includegraphics[height=4cm]{example-image-a}
\end{center}
\item Next step in directions.
\begin{center}
\includegraphics[height=4cm]{example-image-b}
\end{center}
\item Step three.
\begin{center}
\includegraphics[height=4cm]{example-image-c}
\end{center}
\end{enumerate}
\end{document}


Note that this, on its own, simply makes it easier to place the images but it does not prevent a page breaks between the text and the center environment. If you really want to force them being together, there are two options: either use the samepage environment, or define a new \par that prevents a page break (taken from this answer). Both are illustrated below:

\documentclass{article}

\usepackage{mwe}
\usepackage{graphicx}
\makeatletter
\makeatother

\begin{document}
\section{Section Name}
\begin{enumerate}
\item Directions go here   % This allows a page break
\begin{center}
\includegraphics[height=6cm]{example-image-a}
\end{center}
\item Next step in directions. \nobreakpar % No page break here
\begin{center}
\includegraphics[height=6cm]{example-image-b}
\end{center}
\item
\begin{samepage}  % No page break anywhere inside this environment
Step three.
\begin{center}
\includegraphics[height=6cm]{example-image-c}
\end{center}
\end{samepage}
\end{enumerate}
\end{document}

• The center environment might add too much vertical spacing, perhaps. \centering is possible too, in a group, of course, but this depends on the O.P.'s personal preferences, of course – user31729 Feb 18 '16 at 22:45
• Thanks Christian. So I trade floats for \begin{center} and \end{center}. I'll see if that adds too much vertical white space. I was able to control the vertical white space of the figures. While your suggestion helps clean up code, it does not solve my initial issue of separated images from the item. – PepPaddy Feb 18 '16 at 23:02
• @PepPaddy: Your comment is unclear and your code is by far complete. The solution by JP-Ellis should work, in my point of view – user31729 Feb 18 '16 at 23:04
• Thanks JP-Ellis. Using your example, I am still getting images pushed to the next page with the step instructions on the previous page. – PepPaddy Feb 18 '16 at 23:07
• This is not possible. Only the last images, if it is to large for the rest of page, is pushed to the next page. – Zarko Feb 18 '16 at 23:13