对齐项目和描述项目标签

对齐项目和描述项目标签

我希望我的 itemize 项目的“项目符号”与描述列表中的标签开头水平对齐。以下是 M(almost)WE:

\documentclass[10pt, varwidth, convert={size=640, density=600}, border=2]{standalone}
\usepackage{enumitem}
    \setlist[description]{nosep, topsep=0pt, labelindent=1em}
    \setlist[itemize]{nosep, topsep=0pt, labelindent*=1em, label={\textbf{--}}}

\begin{document}
\begin{itemize}
    \item First Item
    \item Second Item
    \item Third Item
\end{itemize}

\begin{description}
    \item[Label] First Item
    \item[Another Label] Second Item
    \item[Yet Another Label] Third Item
\end{description}
\end{document}

我的 MWE 输出

我尝试过labelindent(*)、、leftmargin等的多种排列组合itemindent,但似乎无法获得我想要的行为。有人能解释一下enumitem间距系统吗?

编辑:提出的解决方案wide 几乎作品:

\documentclass[10pt, varwidth, convert={size=640, density=600}, border=2]{standalone}
\usepackage{enumitem}
    \setlist[description]{nosep, labelindent=1em}
    \setlist[itemize]{nosep, wide=1em, label={\textbf{--}}}

\begin{document}
\begin{itemize}
    \item First Item
    \item Second Item with a really long amount of text that causes it to go onto a second line because I'm trying really hard to write a long sentence here.
    \item Third Item
\end{itemize}

\begin{description}
    \item[Label] First Item
    \item[Another Label] Second Item with a really long amount of text that causes it to go onto a second line because I'm trying really hard to write a long sentence here.
    \item[Yet Another Label] Third Item
\end{description}
\end{document}

修改后的 MWE 的输出

我希望两个列表中的“悬挂缩进”行为相同。具体来说,我希望连续行缩进,与此处的描述列表相匹配。

答案1

使用wide选项(不是widest)并玩leftmargin

\documentclass[10pt, border=4pt, varwidth]{standalone}
\usepackage{enumitem}
    \setlist[description]{nosep, topsep=0pt, labelindent=1em, leftmargin=\dimexpr\leftmargini-\fontdimen2\font\relax}%
    \setlist[itemize]{nosep, topsep=0pt, wide = 1em, label={\textbf{--}},leftmargin=*}

\begin{document}

\begin{itemize}
    \item First Item
    \item Second Item with a really long amount of text that causes it to go onto a second line because I'm trying really hard to write a long sentence here.
       \item Third Item
\end{itemize}

\begin{description}
    \item[Label] First Item.
    \item[Another Label] Second Item with a really long amount of text that causes it to go onto a second line because I'm trying really hard to write a long sentence here.
    \item[Yet Another Label] Third Item
\end{description}

\end{document} \setlist[description]{nosep, labelindent=1em}
\setlist[itemize]{nosep, wide=1em, label={\textbf{--}}}

在此处输入图片描述

相关内容