“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}

列舉

相關內容