如何删除枚举环境中项目之间的多余线条并防止文本对齐

如何删除枚举环境中项目之间的多余线条并防止文本对齐

目前的输出如下

\documentclass{article}

\usepackage{enumitem}%
\setlist[enumerate]{label={\upshape(\roman*)},leftmargin=0,  itemindent=*, labelwidth=1,  labelsep=0, align=left}
\begin{document}

  \begin{enumerate}
  \item one one one one one one one one one one one one one one one one one one one one one 
  \item two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two 
  \item three three three three three three three three three three three three three three three three three three three three three three three three
  \end{enumerate}

\end{document} 

如下

(i)   one one one one one one one one one one one one one one one one one
one one one one 

(ii)  two two two two two two two two two two two two two two two two two
two two two two two two two two two two two two two

(iii) three three three three three three three three three three three three three three three three three three three three three three three three

我希望文本不对齐,并且项目之间没有多余的分隔线,即,我希望文本显示如下:

(i) one one one one one one one one one one one one one one one one one
one one one one     
(ii) two two two two two two two two two two two two two two two two two
two two two two two two two two two two two two two    
(iii) three three three three three three three three three three three three three three three three three three three three three three three three

简而言之,我希望这些物品看起来像普通的线条。

答案1

如果您希望所有enumerate环境都像这样,您可以执行以下操作:

\documentclass{article}

\usepackage{enumitem}
\usepackage{lipsum} % for demo text only

\setlist[enumerate]{
  label={\upshape(\roman*)},
  leftmargin=0pt‌​,
  labelwidth=*,
  align=‌​left,
  nosep
}

\begin{document}

\lipsum[10]
\begin{enumerate}
  \item one one one one one one one one one one one one one one one one one one one one one 
  \item two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two 
  \item three three three three three three three three three three three three three three three three three three three three three three three three
\end{enumerate}
\lipsum[11]

\end{document}

输出

这种方式enumitem

  • leftmargin=0pt确保项目没有在行上缩进。
  • labelwidth=*表示将标签宽度设置为当前标签的宽度,即对于每个项目来说不一定都相同。
  • align=left使标签左对齐
  • nosep和用更少的按键书写是一样的partopsep=0pt, topsep=0pt, itemsep=0pt, parsep=0pt。内部nosep按键定义为

    \enitkv@key{enumitem}{nosep}[true]{%
      \partopsep=\z@skip
      \topsep=\z@skip
      \itemsep=\z@skip
      \parsep=\z@skip}
    

    或者,可以使用noitemsep,设置itemsep=0pt, parsep=0pt是否需要在列表本身之前留出更多空间。

答案2

据我所知,列表上方和下方的分隔由 决定topseppartopsep因此将它们都设置为 会0pt删除列表外的空间。项目之间的空间由 决定parsepitemsep因此它们也应该是0pt。如果您希望项目真正像普通行一样工作,我猜它们应该像段落一样缩进,您可以通过 来实现labelindent=\parindent。要删除水平对齐设置labelwidth=*,但您还需要在标签后留出一些额外的空间,labelsep=1em

\documentclass{article}
\usepackage{lipsum}
\usepackage{enumitem}%
\setlist[enumerate]{%
  label={\upshape(\roman*)},
  leftmargin=0pt,  
  itemindent=*, 
  labelwidth=*,  
  labelsep=1em, 
  align=left,
  topsep=0pt,
  partopsep=0pt,
  parsep=0pt,
  itemsep=0pt,
  % labelindent=\parindent,
}
\begin{document}
\lipsum[1]

\begin{enumerate}
\item one one one one one one one one one one one one one one one one one one one one one 
\item two two two two two two two two two two two two two two two two two two two two two two two two two two two two two two 
\item three three three three three three three three three three three three three three three three three three three three three three three three
\end{enumerate}

\lipsum[2]
\end{document} 

在此处输入图片描述

相关内容