定义列表

定义列表

我有一个纯文本文档,我想将其转换为 LaTeX。该文档不是典型的文本文档,而是一个定义列表,包括一些简短的序言和可选的“后脸”

示例(纯文本):

===============================================================================
3.2.5                          SOME TITLE 1
===============================================================================

                            (Some sub title 1)

   This is an  introduction and a short  text describing the list that follows.
It has some words other words and more words that together is sentences. It has
some words other  words and more words  that together is sentences. It has some 
words other words and more words that together is sentences.  Finally it contin-
ues on and on for a bit. Then after a while it ends.

op3r   Indicates that the operand has three regular indicators defining the dest-
       ination for the long run in the alternate universe.

dym    Follows that the dinner was late.

flux, k3, k4, yz, az
       Property of the beholder is foreseen by the old definition referred by a
       longer run for the start point logged by the initiator.

   Some text after the list that few read but all should. It is the key to solve 
many a question related to the way of deciphering  the meaning of the quirks and
shortcomings.

===============================================================================
3.2.6                          SOME TITLE 2
===============================================================================

                            (Some sub title 2)

   Another introduction and list of definitions.

每个定义列表约占 1 - 4 页。

作为一种折衷,关键字不必与解释位于同一行(它们适合的位置),例如op3r在上面这个相当愚蠢的例子中。这是在纯文本文档中完成的,以使其更紧凑。

我的问题是,在 LaTeX 文档中组织这些内容的最佳方式是什么。是否有一些用于此类定义列表的软件包?我也很有可能将其扩展为包括一般文本未来的章节。

我尝试过使用表格,但不确定这是否是最好的方法。通常类似(为未来的读者编辑了更完整的示例。)

\documentclass[a4paper,10pt]{article}
\usepackage[english]{babel}
\usepackage{tabularx}
\usepackage{parskip}
\setlength{\parindent}{20pt}
\begin{document}

%==============================================================================
\section{SOME TITLE 1}
%==============================================================================

\begin{center}
\emph{(Some subtitle 1)}
\end{center}

This is an  introduction and a short  text describing the list that follows.
It has some words other words and more words that together is sentences. It has
some words other  words and more words  that together is sentences. It has some 
words other words and more words that together is sentences.  Finally it contin-
ues on and on for a bit. Then after a while it ends.

\begin{tabularx}{1\textwidth}{ l X }
    \multicolumn{2}{l}{op3r}  \\
    & Indicates that the operand has three regular indicators defining the
destination for the long run in the alternate universe. \\
    \multicolumn{2}{l}{dym}  \\
    & Follows that the dinner was late. \\
    \multicolumn{2}{l}{flux, k3, k4, yz, az} \\
    & Property of the beholder is foreseen by the old definition referred 
by a longer run for the start point logged by the initiator.
\end{tabularx}

Some text after the list that few read but all should. It is the key to solve 
many a question related to the way of deciphering  the meaning of the quirks and
shortcomings.

\end{document}

答案1

表格在这里不是最简单的方式,因为它们会很长。虽然有些表格允许跨页边界(例如longtable),使用列表可能更可行,因为断行可能发生在段落中间(不确定段落文本有多长)。

enumitem为其描述列表提供了一个style=nextline选项,对于过长的描述标签“插入换行符”:

在此处输入图片描述

\documentclass{article}
\usepackage{enumitem}% http://ctan.org/pkg/enumitem
\begin{document}

This is an  introduction and a short  text describing the list that follows.
It has some words other words and more words that together is sentences. It has
some words other  words and more words  that together is sentences. It has some 
words other words and more words that together is sentences.  Finally it contin-
ues on and on for a bit. Then after a while it ends.

\begin{description}[font=\sffamily\bfseries, leftmargin=1cm, style=nextline]
  \item[op3r]
    Indicates that the operand has three regular indicators defining the dest-
    ination for the long run in the alternate universe.
  \item[dym]
    Follows that the dinner was late.
  \item[flux, k3, k4, yz, az]
    Property of the beholder is foreseen by the old definition referred by a
    longer run for the start point logged by the initiator.
\end{description}

Some text after the list that few read but all should. It is the key to solve 
many a question related to the way of deciphering  the meaning of the quirks and
shortcomings.

\end{document}

leftmargin当然,要进行调整以适应。

相关内容