Closed schtandard closed 5 years ago
On the other hand, if we remove the level in the second \setlist
, the settings do not influence the first level of enumerate
at all:
\documentclass{article}
\usepackage{enumitem}
\setlist[enumerate,1]{label={\roman*)}, first={\item from first \texttt{\string\setlist}}}
\setlist[enumerate]{first*={\item from second \texttt{\string\setlist}}}
\begin{document}
\begin{enumerate}
\item foo
\begin{enumerate}
\item bar
\end{enumerate}
\end{enumerate}
\end{document}
I'd say you are assuming the order of declarations is relevant, but this is not the documented behavior and your examples works as expected. And a \setlist
for a certain type/level overrides the previous ones, too.
After another look into the documentation, I agree that the second example is expected behavior. However, the behavior of the first one is still not clear to me at all. I would have expected
\setlist[enumerate,1]{first*={\item from second \texttt{\string\setlist}}}
not to alter the list labels, no matter how they were declared and that
\setlist{label={\roman*)}}
\setlist{first={\item first}}
yields identical results to the opposite order
\setlist{first={\item first}}
\setlist{label={\roman*)}}
Does the current behavior not mean that I cannot use enumitem
in a document class, because any change the end user might make to the lists (like adding some first
code) would reset all the settings I made in the document class for the same scope (i.e. with the same optional argument to \setlist
)?
I think what you are looking for is \setlist*
.
It seems I am, you are right. Sorry for the confusion.
It may be useful to include a hint to \setlist*
in section 5 "Global settings" of the manual. Currently, it is only mentioned in section 7 "Cloning the basic lists", where people may not look for it.
In the following MWE, the first
\setlist
has no effect at all. The keys seem to be reset to their default before the ones in the second\setlist
are executed. (If the second\setlist
is removed, the first one behaves as expected.)