清单项目中的文字换行

清单项目中的文字换行

我在编写清单时遇到一些文本换行问题。以下图片说明了这一困难(参见倒数第二个清单项目):

清单1

您对如何解决这个问题有什么建议吗?首先要看的可能是新命令 checklistAStart 的创建。

示例代码如下:

\documentclass[american]{article}

% set page size and page margin
    \usepackage[a5paper, margin=1.5 mm]{geometry}
% tables
    % set table width
        \usepackage{tabularx}
    % tabularx alignment
        \newcolumntype{R}{>{\raggedleft\arraybackslash}X}
        \newcolumntype{C}{>{\centering\arraybackslash}X}
    % multi-spanned columns and rows in tables
        \usepackage{multirow}
% date
    \usepackage{babel}
    \usepackage[iso, inputamerican]{isodate}
% lists
    % description itemized list format
        \usepackage{enumitem}
% border around pages
    \usepackage{pgf}
    \usepackage{pgfpages}
    \pgfpagesdeclarelayout{boxed}{
         \edef\pgfpageoptionborder{0pt}
    }{
        \pgfpagesphysicalpageoptions{%
            logical pages=1,%
        }
        \pgfpageslogicalpageoptions{1}{
            border code=\pgfsetlinewidth{2pt}\pgfstroke,%
            border shrink=\pgfpageoptionborder,%
            resized width=.98\pgfphysicalwidth,%
            resized height=.98\pgfphysicalheight,%
            center=\pgfpoint{.5\pgfphysicalwidth}{.5\pgfphysicalheight}%
        }%
    }
    \pgfpagesuselayout{boxed}

\begin{document}

\isodate

% tab
    \newcommand{\tab}{\hspace*{2em}}

% commands for description itemised lists
    % commands for dimensions in description itemised lists
        % left position of item
            \newcommand{\leftMarginDistance}{8.5 cm}
        % #?
            \newcommand{\itemIndentDistance}{2 cm}
        % vertical separation
            \newcommand{\itemSeparationDistance}{-4 pt}
        % leftmost position of item denoter
            \newcommand{\labelIndentDistance}{0.2 cm}
    % commands for starting and ending description itemised lists
        \newcommand{
                \checklistAStart
            }
            {
                \begin{description}[
                    style=multiline,
                    itemsep=\itemSeparationDistance,
                    leftmargin=\leftMarginDistance,
                    itemindent=\itemIndentDistance,
                    labelindent=\labelIndentDistance,
                    font=\normalfont]
            }
        \newcommand{
                \checklistAEnd
            }
            {
                \end{description}
            }
    % commands for description itemised list items
        \newcommand{\checklistAitem}[2]{\item[#1 \dotfill]#2}
        \newcommand{\checklistAitemEmph}[2]{\item[\emph{#1}\dotfill]\emph{#2}}
        \newcommand{\checklistAtitle}[1]{\item[#1]}
        \newcommand{\checklistAsubitem}[2]{\item[\hspace{\labelIndentDistance}#1 \dotfill]#2}

% commands for titles
    % command for main titles
        \newcommand{\titleA}[1]{\noindent\large\textbf{#1}\normalsize\\}
    % command for subtitles
        \newcommand{\titleB}[1]{\noindent\textbf{#1}\normalsize}

% commands for headings
    % command for main headings
        \newcommand{\headingA}{
            \begin{center}
                \begin{tabularx}{145 mm}{|lR|}
                    \hline
                    &\\
                    NORMAL AND EMERGENCY PROCEDURES CHECKLIST & MODEL \today-1\\
                    FOR CESSNA 172S INCLUDING G1000 AVIONICS&\\
                    &\\
                    \hline
                \end{tabularx}
            \end{center}}

\headingA

% left position of item
    \renewcommand{\leftMarginDistance}{6.5 cm}

\titleA{PRE-FLIGHT INSPECTION: INTERNAL}

\titleB{COCKPIT}

\checklistAStart
    \checklistAitem{aircraft position}{check obstructions}
    \checklistAitem{parking break}{set}
    \checklistAitem{control wheel lock}{remove and stow}
    \checklistAitem{ignition switch}{off, key removed}
    \checklistAitem{avionics switch (BUS 1 and BUS 2)}{off}
    \checklistAitem{static pressure alternate source value}{off}
    \checklistAitem{fuel selector}{both}
    \checklistAitem{fuel shutoff valve}{on (push fully in)}
    \checklistAitem{elevator trim}{check, set neutral (check full movement up and down)}
    \checklistAitem{master switch}{on}
\checklistAEnd

\end{document}

答案1

一种方法是使用parbox作为文本右侧的内容:

\newcommand{\checklistAitem}[2]{\item[#1 \dotfill]\parbox[t]{5.50cm}{#2\unskip\strut}}

得出的结果是:

在此处输入图片描述

笔记:

  • 根据 Barbara Beeton 的建议,我\unskip\strut在 末尾添加了\parbox

相关内容