# FAQ overflow

#### QUESTION

I want to format a step-by-step tutorial in LaTeX in a way that each step shows one screenshot and a small piece of text for that step. I could think of a formatting where in each step the screenshot is positioned on the left and the text is on the right. However, if I use \includegraphics the image is dynamically positioned in the document.

How can I realize such formatting?

It's by no means necessary to place an \includegraphics command inside a figure environment.

If the text doesn't overflow much the figure's height, you can use a simple method:

\documentclass[a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\newenvironment{explanation}[2][]
{\begin{flushleft}
\begin{minipage}[t]{\dimexpr\textwidth-6cm\relax}}
{\end{minipage}\end{flushleft}}

\begin{document}
\lipsum[2]

\begin{explanation}{screenshot1}
This is the text that accompanies the first screen shot
and explains it.
\end{explanation}

\lipsum[2]
\end{document}



Note: the demo option for graphicx is just to allow avoiding having real figure files. Here I've provided 6cm space for the screen shot, which is typeset as 5cm wide, so to give it some room. Variations are possible, see the documentation of adjustbox.

In case a caption is needed, one can use the caption or captionof packages and use something like

\newenvironment{explanation}[2][]
{\noindent\begin{minipage}{\textwidth}\vspace{\topsep}
\begin{minipage}[t]{\dimexpr\textwidth-6cm\relax}}
{\end{minipage}
\par
\if\relax\detokenize\expandafter{\expcaptiontext}\relax\else
\captionof{figure}{\expcaptiontext}
\fi
\gdef\expcaptiontext{}%
\vspace{\topsep}
\end{minipage}}
\newcommand{\expcaption}[1]{\gdef\expcaptiontext{#1}}



with

\begin{explanation}{screenshot1}
This is the text that accompanies the first screen shot
and explains it.

\expcaption{This is the caption}
\end{explanation}



If the text overflows the screen shot by several lines, then the wrapfig package should be taken into consideration.