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*)}
mylist
activated by\mylist
and 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)h
at 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: github.com/jbezos/enumitem/issues