是否有一个包或某个东西可以让我创建一个list
(类似)看起来像词汇表列表的东西,其中描述缩进相同的长度?就像在包中使用样式description
一样。glossary-superragged
glossaries
我知道这可以通过创建一个两列表格来实现,但我认为这很麻烦。
此主题描述了如何制作description
带有或不带有项目符号的列表,但没有说明是否可以缩进正确的“列”...
答案1
该样式为描述文本glossary-superragged
保留。使用我们可以将标签宽度设置为并将描述缩进到这个程度,如下所示:0.6\hsize
enumitem
0.4\hsize
\documentclass{article}
\usepackage{enumitem}
\usepackage{etoolbox}
\let\bulletdescriptionlabel\descriptionlabel
\patchcmd\bulletdescriptionlabel
{#1}
{{\normalfont\textbullet\ }#1\hfil}
{}{}
\newlist{mydescription}{description}{1}
\setlist[mydescription]
{before=\let\makelabel\bulletdescriptionlabel,leftmargin=0.4\hsize,labelindent=0em,itemindent=!,labelwidth=!}
\begin{document}
\begin{mydescription}
\item[First heading] A description text that is long enough to
spread on to the next line, and saying absolutely nothing.
\item[Second heading] A description text that is long enough to
spread on to the next line, and saying absolutely nothing.
\item[Third rather longer heading] A description text that is long enough to
spread on to the next line, and saying absolutely nothing.
\end{mydescription}
\end{document}
这是基于您链接到的问题中@egreg的最后一个解决方案(https://tex.stackexchange.com/a/60282/15925)。已将 final\hfil
添加到标签以使其左对齐。通过将 设置leftmarigin
为0.4\hsize
和设置为零来实现主要缩进。其余参数通过选项labelindent
计算,因此等于我们的。enumitem
!
labelwidth+labelsep
leftmargin