將列表項目的所有行縮排到相同的程度

將列表項目的所有行縮排到相同的程度

我正在使用 enumitem 包,並且在設定水平間距參數(leftmarginitemindentlabelseplabelindentlabelwidth)以獲得以下效果時遇到問題:

LabelGoesHere     The quick brown fox jumped over the lazy dog. The
                  quick brown fox jumped over the lazy dog. The quick
                  brown fox jumped over the lazy dog. The quick brown
                  fox jumped over the lazy dog.

也就是說,第一行(不包括標籤)和其他行都從同一點開始。對於第一條線之外的其他線,此方法效果很好(用於在距離邊緣 2 公分處對齊):

\begin{description}[
  leftmargin=2cm,
  itemindent=0cm
]

但第一行給我帶來了麻煩。我應該以某種方式使用標籤的寬度嗎?我應該使用!還是*

PS - 如果您能幫助我使與對齊的行起點的距離成為適合列表中使用的所有項目標籤所需的最大距離,再加上一些固定的間隙量,那就加分了。

答案1

選擇足夠大的左邊距,或使用以下multiline 樣式:

\documentclass{article}
\usepackage{enumitem}
\begin{document}


%
\begin{description}[leftmargin=2.5cm, style=multiline]
  \item[Label Goes Here] The quick brown fox jumped over the lazy dog. The
        quick brown fox jumped over the lazy dog. The quick
        brown fox jumped over the lazy dog. The quick brown
        fox jumped over the lazy dog.
\end{description}}

\begin{description}[style=sameline, leftmargin=3.2cm]
  \item[Label Goes Here] The quick brown fox jumped over the lazy dog. The
        quick brown fox jumped over the lazy dog. The quick
        brown fox jumped over the lazy dog. The quick brown
        fox jumped over the lazy dog.
\end{description}
}
\end{document} 

在此輸入影像描述

答案2

這是我得到的最好的。這可行,但可能不是「正確的事」:

\begin{description}[
  leftmargin=2cm,
  itemindent=0cm,
  labelwidth=1.75cm,
  labelsep=0.25cm,
  labelindent=0cm
]

因此,這可確保標籤和項目文字之間至少有 0.25 公分的間隙,並且對齊距邊緣 2 公分。

相關內容