I define own list, for example mylist. For some reason I like to name it with series, for example as series=ML for resuming purposes: resume=ML. Adding this locally, for example as in the following MWE, this works as expected:
\documentclass{article}
\usepackage{enumitem}
\newlist{mylist}{enumerate}{2}
\setlist[mylist,1]{leftmargin=*,label=\arabic*.}
\setlist[mylist,2]{nosep, leftmargin=*, label=(\alph*)}
\begin{document}
\begin{minipage}{\linewidth} % simulate new environment
% where I like incorporate mylist with
% \mylist ... \endmylist
\begin{mylist}[series=ML, resume=ML]
\item example A
\begin{mylist}
\item sub example A1
\item sub example A2
\end{mylist}
\end{mylist}
\end{minipage}
\bigskip
\begin{minipage}{\linewidth}
\begin{mylist}[series=ML, resume=ML]
\item example B
\begin{mylist}
\item sub example B1
\item sub example B2
\end{mylist}
\end{mylist}
\end{minipage}
\end{document}
However, if I move series=ML, resume=ML from option of mylist to \setlist like:
\documentclass{article}
\usepackage{enumitem}
\newlist{mylist}{enumerate}{2}
\setlist[mylist,1]{leftmargin=*,label=\arabic*.,
series=ML, resume=ML % <---
}
\setlist[mylist,2]{nosep, leftmargin=*, label=(\alph*)}
\begin{document}
\begin{minipage}{\linewidth}
\begin{mylist}
\item example A
\begin{mylist}
\item sub example A1
\item sub example A2
\end{mylist}
\end{mylist}
\end{minipage}
\bigskip
\begin{minipage}{\linewidth}
\begin{mylist}
\item example B
\begin{mylist}
\item sub example B1
\item sub example B2
\end{mylist}
\end{mylist}
\end{minipage}
\end{document}
it trow the error:
! Package enumitem Error: Misplaced key 'series'.
Interestingly, if I after than forced compilation, I get desired result.
In enumitem documentation (I use version 3.9 from 2019/06/20) is nowhere described that series in \setlist is not allowed, but all examples of its use are as it is shown in the first MWE.
Do anyone know, how to convinced enumitem that will work in second MWE without error?
Edit:
After correcting errors in my MWE (added missed \begin{minipage} and \end{minipage) accidental I discover that removing series from list definition in the second example gives desired result:
\usepackage{enumitem}
\newlist{mylist}{enumerate}{2}
\setlist[mylist,1]{resume=ML % <---
leftmargin=*, label=\arabic*, after=\vspace*{-0.5\baselineskip}
}
\setlist[mylist,2]{nosep, leftmargin=*, label=(\alph*)}


mylistactivated by\mylistand terminated with\endmylist. On the first sight I don't see, that the question is duplicate, but I will see after my test. (hopefuly done today) – Zarko Nov 26 '19 at 10:30hat the error prompt, then it will tell you'series' and 'resume*' must be used in the optional argument of lists, and there is a specific macro to test this condition in the code, so it's definitely not supported, for some (probably good) reason. I couldn't find out what it is, though, sorry. Perhaps ask for the author's view on this: https://github.com/jbezos/enumitem/issues – Phelype Oleinik Nov 26 '19 at 11:39resumeis used in\setlist, see 8.2 Restarting enumerates, page 19 :\setlist[enumerate]{resume}. I report my wish to package author on http://www.texnia.com/contact.html. Now I will look on github. – Zarko Nov 26 '19 at 12:47resume, which (I think) is allowed, different fromresume*. And indeed, the documentation points you to texnia.com, so that's probably the right address. – Phelype Oleinik Nov 26 '19 at 12:53\mylist...\endmylistin definition of the new environment). – Zarko Nov 27 '19 at 18:30resumedwhen you use it. – Peter Grill Nov 27 '19 at 19:35