分步图片指南的布局

分步图片指南的布局

我正在使用回忆录类,并希望实现如下所示的设计。基本思路是一页最多包含三张图片(3.8 x 2.85 英寸)及其相关说明。每张图片应从步骤标题(小节)旁边开始,但一个步骤可能包含多张图片。下一步必须清除上一张图片和说明(以较长者为准),如果没有足够的空间显示下一步的图片,则应插入分页符。

我之前在 LibreOffice 中设计这个,只使用了一个两列表格。左边是文本,右边是图片,每一步都有新行。想看看我能否使用 LaTeX 获得更高质量的结果,但到目前为止,我能做的最好的就是使用 wrapfig 包,它似乎不喜欢换行部分,我不知道如何在开始下一步之前清除图片和描述。任何提示都将不胜感激。

请注意,由于我确实需要将这种两列式布局与横跨整个页面宽度的常规文本混合使用,因此我实际上无法使用两列或带有边距图的宽右边距。还有其他选择吗?

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,   |                           |
consectetur adipiscing elit,  |                           |
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,   |                           |
consectetur adipiscing elit.  |                           |
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. ...

这是一个可以编译的最小示例:

\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}

答案1

这是使用 paracol 的解决方案。请注意,我重新定义\beforesubsecskip为不使用胶水。

\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}

答案2

您可以将两列设置为tabular,这几乎必然会迫使您使用\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}

相关内容