4

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}

enter image description here

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*)}

11
  • 2
    To me this looks more like a feature request to the package author than a question for this site.
    – user194703
    Nov 26, 2019 at 7:07
  • @Schrödinger'scat , you may be right. I wasn't sure if I was doing anything wrong. At the same time, I hoped that anyone here knew of a solution. I wanted to write to the author, but the "texnia.com/enumitem.html" page didn't seem active for a long time.
    – Zarko
    Nov 26, 2019 at 7:32
  • Are you perhaps looking for an always resumed list? If so, then perhaps Define a List that is Always Resumed is a duplicate of this. Nov 26, 2019 at 8:07
  • @PeterGrill, thank you very much for the link. I will test this solution ASAP in my target application: defining new environments containing 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)
    – Zarko
    Nov 26, 2019 at 10:30
  • 1
    If you type 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 Nov 26, 2019 at 11:39

1 Answer 1

3

Just adding \setlist[mylist]{resume} at the initial declaration works fine. Series is not necessary here.

Sample output

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\newlist{mylist}{enumerate}{2}
\setlist[mylist]{resume}% <=================
\setlist[mylist,1]{leftmargin=*,label=\arabic*.}
\setlist[mylist,2]{nosep, leftmargin=*, label=(\alph*)}
\begin{document}
\lipsum[1][1-3]
    \begin{mylist}
        \item    example A
        \begin{mylist}
            \item    sub example A1
            \item    sub example A2
        \end{mylist}
    \end{mylist}
\lipsum[1-2][1-3]
    \begin{mylist}
        \item    example B
            \begin{mylist}
                \item    sub example B1
                \item    sub example B2
            \end{mylist} 
        \lipsum[1][1-3]
        \begin{mylist}
            \item    sub example B1
            \item    sub example B2
        \end{mylist}
    \end{mylist} 
\end{document}
1
  • Thank you for your answer. As you can see in addendum to my question, I already discover this. Now I wonder, why I didn't close a question after this :-(, probably I decided then to wait if some new (better) solution will appear. Anyway, thank you very much again and +1 for the your answer!
    – Zarko
    May 10, 2020 at 8:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .