是否有一种巧妙的方法可以将环境中项目的第一行推description
到右侧,以便与项目的第二行齐平?
我正在尝试定义一个与我的引文一致的 LaTeX 列表环境。列表项将被命名,而不是编号,因此我一直在尝试使用环境description
来执行此操作。我想要得到的是:
Here is some regular text. Note the regular para-
graph indenting.
Here is some text inside a default quote envir-
onment.
Here is some regular text.
Apples: Here is the first item.
Oranges: Here is the second item. It wraps on-
to a second line, and is flush with the first
line about oranges.
Here is some more regular text.
我正在努力获得这个结果。我一直在尝试enumitem
,但没有成功(可能是我自己的错 - 我一直无法理解enumitem
间距命令)。如果真的需要,我可以使用quote
环境而不是任何类型的列表来获得结果,但这显然不是理想的。
非常感谢您的任何建议。
答案1
有个建议enumitem
。的缩进长度2\parindent
可能有点大,但当然可以改变。
\documentclass{article}
\usepackage[textwidth=20em,showframe]{geometry} % yes, I borrowed this from Qrrbrbirlbel
\usepackage{enumitem}
\newlist{Description}{description}{1}
\setlist[Description]{labelindent=2\parindent,leftmargin=2\parindent}
\begin{document}
Here is some regular text.
Note the regular paragraph indenting.
\begin{quote}
Here is some text inside a
default quote environment.
\end{quote}
Here is some regular text.
\begin{Description}
\item[Apples:] Here is the first item.
\item[Oranges:] Here is the second item.
It wraps onto a second line, and is
flush with the first
line about oranges.
More paragraphing.
\end{Description}
Here is some more regular text.
\end{document}
答案2
像这样吗?
代码
\documentclass{article}
\usepackage[textwidth=20em,showframe]{geometry}
\newenvironment{Description}{\list{}{%
\let\makelabel\descriptionlabel % this comes from the original description environment
\setlength{\rightmargin}{\leftmargin}% this comes from the original quote environment
\setlength{\labelwidth}{0pt}% this is new
}}{\endlist}
\begin{document}
Here is some regular text.
Note the regular paragraph indenting.
\begin{quote}
Here is some text inside a
default quote environment.
\end{quote}
Here is some regular text.
\begin{Description}
\item[Apples:] Here is the first item.
\item[Oranges:] Here is the second item.
It wraps onto a second line, and is
flush with the first
line about oranges.
More paragraphing.
\end{Description}
Here is some more regular text.
\end{document}