为什么设置一级列表仍然影响内层列表?

为什么设置一级列表仍然影响内层列表?

在下面的代码中,我设置了 1 级描述列表

   \documentclass{article}
    \usepackage{enumitem}
    \begin{document}
        \setlist[description,1]{leftmargin=2.8cm,labelindent=-0.25cm,labelsep*=1cm,style=multiline}
        \begin{description}
            \item[tt] tttt \\
            \item[ttttt] 
            \begin{enumerate}
                \item this separation is too large
                \item this separation is too large
                \item this separation is too large
                \item this separation is too large
            \end{enumerate}  
        \end{description}
    \end{document}

它给

在此处输入图片描述

您可以看到,对于枚举列表而言,标签和项目之间的间隔太大。为什么?我只设置了 1 级描述列表。如何保护内部列表不受外部列表设置的影响?

答案1

为了防止嵌套列表重叠,嵌套列表的所有参数都必须相对于left margin上级列表的。您可以使用wideenummitem 选项并固定的值来避免这种情况labelsep

\documentclass{article}
\usepackage{enumitem}
\usepackage[showframe]{geometry}

\begin{document}

\setlist[description,1]{leftmargin=2.8cm,labelindent=-0.25cm,labelsep*=1cm,style=multiline}
\begin{description}
  \item[tt] tttt \\Blah blah blah
  \item[ttttt]
  \begin{enumerate}[wide=0pt, leftmargin=*, labelsep =0.5em] %
    \item this separation is too large. this separation is too large. this separation is too large. this separation is too large. this separation is too large. this separation is too large. this separation is too large. this separation is too large.
    \item this separation is too large
    \item this separation is too large
    \item this separation is too large
  \end{enumerate}
\end{description}

\end{document} [![enter image description here][1]][1]

相关内容