如何将字幕和文本分成两列

如何将字幕和文本分成两列

我正在编写技术人员用户手册,我需要知道如何构造如下图所示的文本:

在此处输入图片描述

感谢您的帮助。

答案1

有几种方法可以实现。一种方法是使用表格,如下tabularx

\documentclass{article}
\usepackage{tabularx}
\usepackage{lipsum}
\begin{document}
\lipsum[1]

\noindent%
\begin{tabularx}{\linewidth}{@{}lX@{}}
  \verb|latex| (or \verb|pdflatex|) \verb|myfile| & A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. \\
  \verb|makeindex myfile| & A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. \\
  \verb|latex| (or \verb|pdflatex|) \verb|myfile| & A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. \\
\end{tabularx}

\lipsum[2]
\end{document}

在此处输入图片描述

在这种情况下,由于标签很长,因此可以使用list和缩进描述。这里我使用了 7em 的缩进。

\lipsum[2]

\noindent
\begin{list}{}{%
    \labelsep=0em
    \labelwidth=7em
    \leftmargin=7em
    \parsep=0pt
    \itemsep=0.3em
    \topsep=0.3em
  }
\item[\texttt{latex} (or \texttt{pdflatex}) \texttt{myfile}: ] A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows.
\item[\texttt{makeindex myfile}: ] A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows.
\item[\texttt{latex} (or \texttt{pdflatex}) \texttt{myfile}: ] A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows. A lot of text that spans several rows.
\end{list}

\lipsum[3]

在此处输入图片描述

相关内容