“enumitem” 包中的“\newlist” 存在问题

“enumitem” 包中的“\newlist” 存在问题

我不知道为什么这段代码会产生错误

!包 enumitem 错误:未定义标签。

\documentclass{article}
\usepackage{enumitem}
\newlist{mylist}{enumerate}{1}
\begin{document}
\begin{mylist}
\item a
\end{mylist}
\end{document}

我究竟做错了什么?

答案1

正如 Bernard 所说,如果列表是新列表,则至少需要设置标签,因为在这种情况下,您要从头开始创建新列表。例如,如果您只想更改默认列表的属性,则可以指定enumerate

\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{leftmargin=0pt}%  if you just want to change some aspect of the default enumerate environment
\newlist{mylist}{enumerate}{1}%         if you want to create a new list from scratch
\setlist[mylist,1]{label=\roman*)}%     in that case, at least label must be specified using \setlist
\begin{document}
  This is some text. This is some more text. This is yet further text. This is also text. So, it seems, is this. The text continues on.
  \begin{enumerate}
    \item first level has zero left margin
    \begin{enumerate}
      \item second level is untouched
    \end{enumerate}
  \end{enumerate}
  This is an interlude consisting of some more text.
  \begin{mylist}
    \item a
  \end{mylist}
\end{document}

枚举

相关内容