I use the enumitem
package to manipulate the appearance of my list. Because I want to keep the default enumerate
list, I defined a new list edulist
and configured it.
The list should be used in an environment edulistvar
, which gives the user the ability to change the itemsep
with an optional argument.
I want this list to resume until several points in my document are reached (see \exercise
in the example below). Resetting the counter of the list I want to do with \restartlist<list-name>}
which seems to exist exact for this reason:
enumitem documentation
Currently, with
\setlist[enumerate]{resume}
you can get a continuous numbering through a document.A new command
has been added for restarting the counter in the middle of the
document:\restartlist{<list-name>}
It is based solely in the list name, not the list type, which means
enumerate*
as defined with the package option inline is not the same
asenumerate
, because its name is different.
Unfortunately, I don't get it work in the following MWE.
Code
\documentclass{scrartcl}
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{enumitem}
\usepackage{xparse}
\DeclareDocumentEnvironment {edulistvar} { O{0pt} } {
\begin{edulist}[itemsep=#1]
}{
\end{edulist}
}
\DeclareDocumentCommand \exercise { } {%
\bigskip
\textsf{\bfseries\Large Exercise}
\medskip
\par
\restartlist{edulist}
}
\newlist{edulist}{enumerate}{1}
\setlist[edulist]{%
label=\alph*),
format=\sffamily,
resume=edulist,
partopsep=0ex,
topsep=0.5\baselineskip,
parsep=\parskip,
}
\begin{document}
\exercise
Bli Bla Blub
\begin{edulist}
\item One
\item Two
\item Three
\end{edulist}
Bli Bla Blub
\begin{edulist}
\item One
\item Two
\item Three
\end{edulist}
\exercise
Bli Bla Blub
\begin{edulistvar}[\baselineskip]
\item One
\item Two
\item Three
\end{edulistvar}
\end{document}
Document
Any idea how to reset the counter of the list? Manually resetting it (\setcounter{edulisti}{0}
) doesn't work, as well.
Best Answer
I'm not sure I understand your question, either, but it seems straightforward to modify the MWE to do what you appear to want, if I've understood correctly, without the need for intervention by the end user: