description列表不得不说的用法

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

LaTeX技巧303:description列表不得不说的用法
常见数学排版问题集下载
在我个人使用经验里,Description 用的不很多,作为LaTeX列表的一个典型。

我研读了一下,也发现如下几个问题,希望对您的使用有所帮助。

基本用法
首先看一个Description的示例。

\begin{description}
\item[First Item] This is a shorter item label, and some text that talks about it.
The text is wrapped into a paragraph, with successive lines indented.
This is another paragraph under the item.
\begin{description}
\item[Sub-Item] This is a description of an item which is within the
first item.
\item[Sub-Item] Another sub-item.
\end{description}
\item[Second Item] Another item that's not part of above item.
\end{description}
description顾名思义,对列表项的解释描述等,description项描述可以是多个段落,也可多个环境嵌套。

显示结果为:
有时,这样使用description觉得不是很符合我们的使用习惯。

第一,让label 项换行显示如何设置?
解决方法:\begin{description}
\item[{\parbox[t]{3cm}{first line\\second line}}] This is a shorter item label, and some text that talks about it.
The text is wrapped into a paragraph, with successive lines indented.
\end{description}
但是这会影响,后面文字的格式,目前我没找到更好的解决方案,欢迎您提供。

第二,如何让描述文字另起一行进行描述?
解决方案列举如下:
(1)采用横向填充。

\begin{description}
\item[Very long label] \hspace*{\fill} \\
Text...
\end{description}
\begin{description}
\item[First] \hfill \\
The first item
\item[Second] \hfill \\
The second item
\end{description}
(2)使用enumitem宏包,定义labelsep。

\usepackage{enumitem}
\setdescription{labelsep=\textwidth}
(2)这是下下之策,重新定义Description即可,推荐上述两个方法。

\let\origdescription\description
\renewenvironment{description}{
\setlength{\leftmargini}{0em}
\origdescription
\setlength{\itemindent}{0em}
\setlength{\labelsep}{\textwidth}
}
{\endlist}
第三个问题是要label项是同样宽度,不要总是或长或短。

解决方案:
(1)使用mdwlist宏包,较为简便
\usepackage{mdwlist}
\begin{basedescript}{\desclabelstyle{\pushlabel}\desclabelwidth{10em}}
\item[Short] This is a shorter item label, and some text that talks about it. The text is wrapped into a paragraph, with successive lines indented.
The another paragraph within one item.
\item[Rather longer label] This is a longer item label. As you can see, the
text is not started a specified distance in -- unlike with other lists -- but is spaced a fixed distance from the end of the label.
\end{basedescript}
结果图:
(2)利用list环境定义自己的描述环境如下:
\usepackage{calc}
\newenvironment{altDescription}[1]
{\begin{list}{}%
{\renewcommand\makelabel[1]{\textsf{##1:}\hfil}%
\settowidth\labelwidth{\makelabel{#1}}%
\setlength\leftmargin{\labelwidth+\labelsep}}}%
{\end{list}}
\begin{altDescription}{Return values}
\item[Description]
Returns from a function. If issued at top level,
the interpreter simply terminates, just as if end
of input had been reached.
\item[Errors]
None.
\item[Return values]
Any arguments in effect are passed back to the
caller.
\end{altDescription}
需要自己提供最宽单词的参数。

第四个问题:Description如何让描述部分缩进都相同呢?
参见:/forum.php?
mod=viewthread&tid=3689&page=1&extra=#pid9925
第五个问题:Description如何让label带有缩进呢?
使用eqlist 宏包
\usepackage{eqlist}
\begin{quote}
\begin{eqlist*}[\eqliststarinit\def\makelabel#1{#1}\labelsep1em]
\item[$D$] is the diffusion coefficient of solute molecules moving from the bulk liquid to the crystal surface,
\item[$t$] is time,
\item[$\lambda$] is a rate constant, that increases with increasing supersaturation.
\end{eqlist*}
\end{quote}。

相关文档
最新文档