# Layout for a step-by-step picture guide

I'm using the memoir class and would like to achieve the design shown below. The basic idea is for one page to contain up to three pictures (3.8 x 2.85 in) with associated descriptions. Each picture should begin next to the step title (subsection), but a step may contain more that one picture. The next step must clear the previous picture and description, whichever one is longer, and a page break should be inserted if there isn't enough room left to show the picture for the next step.

I was previously designing this in LibreOffice and just used a two-column table. Text on the left, pictures on the right, new row for each step. Wanted to see if I could get a higher quality result with LaTeX, but so far, the best I could do was using wrapfig package, which doesn't seem to like wrapping sections and I can't figure out how to clear the picture and description before starting the next step. Any tips would be greatly appreciated.

Please note that because I do need to mix this two-column-like layout with regular text that spans the entire page width, I can't actually use two columns or a wide right margin with marginfigures. Are there any other options?

A. Section title

Zero or more paragraphs of introductory text spanning the
entire page...

A1. Step 1 (subsection)       +---------------------------+
|                           |
Description goes here.        |                           |
|                           |
|                           |
|                           |
|                           |
|                           |
|                           |
+---------------------------+

A2. Step 2. Long step title   +---------------------------+
wraps around.             |                           |
|                           |
Lorem ipsum dolor sit amet,   |                           |
sed do eiusmod tempor         |                           |
incididunt ut labore et       |                           |
dolore magna aliqua. Ut enim  |                           |
ad minim veniam, quis         |                           |
nostrud exercitation ullamco  +---------------------------+
laboris nisi ut aliquip ex
ea commodo consequat.

(Page break here if the next figure doesn't fit)

A3. Step 3                    +---------------------------+
|                           |
Lorem ipsum dolor sit amet,   |                           |
Proin eget gravida mi, quis   |                           |
dignissim dolor. Quisque      |                           |
consectetur fermentum         |                           |
tortor, at consequat leo      |                           |
condimentum eget. Praesent    |                           |
placerat convallis imperdiet. +---------------------------+
Sed lectus massa, rutrum
aliquet egestas sed,          +---------------------------+
hendrerit ac odio.            |                           |
Nullam finibus commodo     |                           |
eleifend. Praesent quis       |                           |
viverra quam, vel fringilla   |                           |
ante. Nullam at odio non      |                           |
urna mollis bibendum          |                           |
bibendum in ex. Vestibulum    |                           |
maximus massa at arcu         |                           |
pellentesque sapien dapibus.  +---------------------------+
Either wrap around the
figure or maintain the same column width throughout.

A4. ...


Here's a minimal example that can be compiled:

\documentclass[letterpaper,12pt,oneside,openany]{memoir}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{lipsum}

\newcommand{\img}[1]{\begin{wrapfigure}{r}{3.8in}
\includegraphics[width=3.8in,height=2.85in]{#1}
\end{wrapfigure}}

\settypeblocksize{9.0in}{7.5in}{*}
\setlrmargins{*}{*}{1}
\setulmargins{*}{*}{1}
\checkandfixthelayout

\begin{document}
\section{Steps}

\subsection{Step 1}
\img{example-image-a}
\lipsum[66]

\subsection{Step 2}
\img{example-image-a}
\lipsum[1]

\subsection{Step 3}
\img{example-image-a}
\lipsum[75]

\end{document}

• Do you need the left (text) column to ever be broken across the page within a \subsection? Your ASCII art shows it broken between, but not within.
– Werner
Jan 22, 2017 at 18:08
• Can you post the code you've got in the form of a minimal example we can compile? You can use e.g. example-image-a etc. for the images and kantlipsum or lipsum for the text.
– cfr
Jan 22, 2017 at 20:12
• Why can't you use a table in LaTeX if that's the layout you want?
– cfr
Jan 22, 2017 at 20:13
• @Werner In general, I'm trying to write this so that each step is confined to a single page to avoid flipping pages back and fourth when reading. It might be reasonable to split a really long step with multiple pictures across pages, such as Step 3 in my example, but that should be a rare occurrence and I'm happy to design around it if one implementation is easier than the other. Jan 22, 2017 at 20:32
• @cfr I've added an example. Using tables in LibreOffice was a hack to allow the next section to start below the preceding image. I was hoping that LaTeX would provide better control over such things. Jan 22, 2017 at 21:05

Here is a solution using paracol. Note that I redefined \beforesubsecskip to not use glue.

\documentclass[letterpaper,12pt,oneside,openany]{memoir}
\usepackage{graphicx}
\usepackage{paracol}
\usepackage{needspace}
\usepackage{lipsum}

\settypeblocksize{9.0in}{7.5in}{*}
\setlrmargins{*}{*}{1}
\setulmargins{*}{*}{1}
\checkandfixthelayout
\setbeforesubsecskip{-3.25ex}% no glue

% negative \beforesubsecskip used by \@startsection to indicate \noindent

\begin{document}
\section{Steps}
\setcolumnwidth{\dimexpr\textwidth-\columnsep-3.8in\relax, 3.8in}
\begin{paracol}{2}
\needspace{\dimexpr 2.85in}
\subsection{Step 1}
\lipsum[66]
\switchcolumn
\noindent
\includegraphics[width=3.8in,height=2.85in]{example-image-a}
\switchcolumn*
\needspace{\dimexpr 2.85in-\beforesubsecskip}%
\subsection{Step 2}
\lipsum[1]
\switchcolumn
\vskip-\beforesubsecskip\noindent
\includegraphics[width=3.8in,height=2.85in]{example-image-b}
\switchcolumn*
\needspace{\dimexpr 2.85in-\beforesubsecskip}%
\subsection{Step 3}
\lipsum[75]
\switchcolumn
\vskip-\beforesubsecskip\noindent
\includegraphics[width=3.8in,height=2.85in]{example-image-c}
\end{paracol}

\end{document}

• I had to use \Needspace (capitalized version) because the default implementation sometimes caused the text to jump to the next page even though the image was on the previous one. Will play around some more with vertical spaces, but I think this will do the job nicely. Thank you very much! Jan 23, 2017 at 21:51

You can just set the two columns as a tabular, which would almost necessarily force you to use \raggedbottom:

\documentclass{memoir}

\usepackage{graphicx,tabularx}
\usepackage{lipsum}

\settypeblocksize{9.0in}{7.5in}{*}
\setlrmargins{*}{*}{1}
\setulmargins{*}{*}{1}
\checkandfixthelayout

\newcommand{\insertimage}[1]{\raisebox{\dimexpr-\height-\normalbaselineskip}{\includegraphics[width=3.8in,height=2.85in]{#1}}}

\raggedbottom

\begin{document}

\section{Steps}

\noindent
\begin{tabularx}{\linewidth}{ @{} X l @{} }
\subsection{Step 1}
\lipsum[66] &
\insertimage{example-image-a}
\end{tabularx}

\noindent
\begin{tabularx}{\linewidth}{ @{} X l @{} }
\subsection{Step 2}
\lipsum[1] &
\insertimage{example-image-b}
\end{tabularx}

\noindent
\begin{tabularx}{\linewidth}{ @{} X l @{} }
\subsection{Step 1}
\lipsum[75] &
\insertimage{example-image-c}
\end{tabularx}

\end{document}

• The second paragraph in the first column isn't indented and I'm a bit worried about other subtle bugs that may be introduced by putting everything into a table. Jan 22, 2017 at 23:04