宽列表子列表的缩进

宽列表子列表的缩进

wide包的功能有效enumitem地使项目标签成为文本的一部分,而不是设置标签左侧以下文本的边距。我想使用该wide功能,但在列表项紧接着另一个列表的情况下,我不希望出现这种行为:

在此处输入图片描述

您知道我该如何调整列表的行为,以便子列表项能够正确显示吗?我查阅了手册并在网上搜索,但找不到任何我认为相关的信息。

以下是 MWE:

\documentclass[11pt, a4paper]{article}
\usepackage{enumitem}

\newlist{test}{enumerate}{2}
\setlist[test, 1]{label = (\alph*), wide = 0pt}
\setlist[test, 2]{label = \roman*.}

\begin{document}

\begin{test}
\item
\begin{test}
\item This item is OK.
\item This item should be indented.
\item This item should be indented as well.
\end{test}
\end{test}

\end{document}

感谢您的帮助!

答案1

如果我理解您的意思,解决方案是制作子列表wide,但使用左对齐。以下是两种方法,不同之处在于子列表的左边距:

\documentclass[11pt, a4paper]{article}
\usepackage{enumitem}

\newlist{test}{enumerate}{2}
\setlist[test, 1]{label = (\alph*), wide = 0pt}
\setlist[test, 2]{label = \roman*., wide = 3em, align = right}

\begin{document}

\begin{test}
\item \leavevmode\vspace*{-\dimexpr\baselineskip + \topsep \relax}
\begin{test}
\item This item is OK.
\item This item \emph{is} indented.
\item This item is indented as well. This item is indented as well. This item is indented as well. This item is indented as well.
\end{test}
\item \leavevmode\vspace*{-\dimexpr\baselineskip + \topsep \relax}
\begin{test}[ leftmargin = \dimexpr3em + \labelwidth + \labelsep\relax]
\item This item is OK.
\item This item \emph{is} indented.
\item This item is indented as well. This item is indented as well. This item is indented as well. This item is indented as well.
\end{test}
\end{test}

\end{document} 

在此处输入图片描述

相关内容