Eumitem:新段落不縮排的縮排列表

Eumitem:新段落不縮排的縮排列表

我想創建一個縮進列表,其中列表中的新(非逐項列出)段落根本不縮進(也就是說,它們與正文的左邊距對齊。請參見下圖)。

我正在使用enumitem具有以下選項的套件:

labelsep=8pt,                           
labelindent=0.5\parindent,               
itemindent=0pt,
leftmargin=*,                         
listparindent=-\leftmargin

(* 應該用於計算\leftmargin其他參數的值和自動計算的標籤寬度)。然而,這並沒有達到預期的結果(請參閱下面的 MWE)。如果我設定相反

leftmargin=3cm                         
listparindent=-\leftmargin

它按預期工作(但我不想將左邊距設定為特定值,我想要的是固定\labelindent\labelsep)。插入

\noindent\hskip-\leftmargin

在有問題的段落開頭也可以,但確實不是很有系統。我應該如何設定enumerate選項來實現我想要的?

微量元素

\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate]{%
labelsep=8pt,%                           
labelindent=0.5\parindent,%               
itemindent=0pt,%
leftmargin=*,%                          
listparindent=-\leftmargin% 
}

\begin{document}
A normal paragraph of text just to show where 
the left margin lies, for comparison. New paragraphs 
inside enumerate should start at that left margin.

\begin{enumerate}[label=Case \arabic*:]
\item By setting the enumerate options in a 
(I think) sensible manner, I don't achieve what I want 

This paragraph shouldn't be indented at all!

\item I want to set the options so that new paragraphs 
behave like the following one

\noindent\hskip-\leftmargin 
This paragraph is indeed not indented at all!
\end{enumerate}

\begin{enumerate}[resume*,leftmargin=3cm,listparindent=-\leftmargin]
\item Setting a specific value for leftmargin also works\dots

But this is not what I want :-(
\end{enumerate}
\end{document}

在此輸入影像描述

我會避免在所有enumerate環境中這樣做;為此定義一個新列表。

答案1

我不確定你為什麼要這樣做。但是,方法如下:

\documentclass{article}
\usepackage{showframe}
\usepackage{enumitem}

\setlist[enumerate]{
  labelsep=8pt,
  labelindent=0.5\parindent,
  itemindent=0pt,
  leftmargin=*,
  before=\setlength{\listparindent}{-\leftmargin},
}

\begin{document}
A normal paragraph of text just to show where 
the left margin lies, for comparison. New paragraphs 
inside enumerate should start at that left margin.

\begin{enumerate}[label=Case \arabic*:]
\item By setting the enumerate options in a 
(I think) sensible manner, I don't achieve what I want

This paragraph shouldn't be indented at all!

\item I want to set the options so that new paragraphs 
behave like the following one

This paragraph is indeed not indented at all!
\end{enumerate}

\begin{enumerate}[resume*,leftmargin=3cm,listparindent=-\leftmargin]
\item Setting a specific value for leftmargin also works\dots

This is what I want.
\end{enumerate}
This is what I want. % just to show the left margin

\end{document}

\listparindent當 的值\leftmargin確定後,必須延遲設定。

在此輸入影像描述

答案2

或者不就是這樣嗎(我發現第一個段落的左邊距非零,而該項目中的後續段落的左邊距為零看起來不太好):

\documentclass{article}

\usepackage{enumitem}
\setlist[enumerate]{%
wide =0.5\parindent,
listparindent=0pt%
}%

\begin{document}
A normal paragraph of text just to show where the left margin lies, for comparison. New paragraphs
inside enumerate should start at that left margin.

\begin{enumerate}[label=Case \arabic*:]
\item By setting the enumerate options in a
(I think) sensible manner, I don't achieve what I want

This paragraph shouldn't be indented at all! This paragraph shouldn't be indented at all!

\item I want to set the options so that new paragraphs
behave like the following one.

This paragraph is indeed not indented at all!

\item Setting a specific value for leftmargin also works\dots

But is this what you want?
\end{enumerate}

\end{document} 

在此輸入影像描述

相關內容