I have a class file in which I need to set up the enumerate
and the inline version enumerate*
(as provided by the enumitem
package with option inline
). As defined, the two environments share labels, settings, etc.
I want them to be able to share levels (i.e. an enumerate*
environment nested inside an enumerate
environment is recognised to be at level 2), but I need to be able to adjust the formatting on the enumerate*
environment (among other adjustments, I want this to start on a new line).
The problem is that I can't change enumerate*
(e.g. using \setlist
) without also changing enumerate
. I can get around that by using (e.g.) \renewlist{enumerate*}{enumerate*}{3}
, but then the nesting gets lost.
Here is a MWE:
\documentclass{article}
\usepackage[inline]{enumitem}
\setlist[enumerate]{align=left,leftmargin=8mm,labelsep*=0pt}
\setlist[enumerate,1]{label=(\alph*), ref=(\alph*)}
\setlist[enumerate,2]{label=(\roman*), ref=(\roman*),leftmargin=9mm}
\begin{document}
Here's a non-nested inline enumerate list:
\begin{enumerate*}
\item blah
\item blah
\item blah
\end{enumerate*}
\begin{enumerate}
\item blah
\item Here's a nested inline list:
\begin{enumerate*}
\item blah
\item blah
\item blah
\end{enumerate*}
\end{enumerate}
\end{document}
In this MWE, the challenge is to modify the preamble in order for both inline lists to start on a new line, but for the nested one to use \roman*
labelling, while the non-nested ones uses \alph*
.
Bonus points if you can do it entirely within enumitem
, as the users of the class file would like to have features such as [resume]
available.
\newenvironment{inumerate}{\par\begin{enumerate*}}{\end{enumerate*}}
with the usage\begin{enumerate} \item blah \item Here's a nested inline list: \begin{inumerate} \item blah \item blah \item blah \end{inumerate} \end{enumerate}
?enumerate*
environment. The following gives the formatting I want, but doesn't respect the levels:\renewlist{enumerate*}{enumerate*}{3}
followed by\setlist*[enumerate*]{before=\vspace{6pt}\newline,itemjoin=\hspace{50pt}}
LaTeX Error: There's no line here to end.
) But note that in my approach, you can , inside ofinumerate
, temporarily redefine theenumerate*
environment with the optional argument. That is,\newenvironment{inumerate}{\begin{enumerate*}[before=\vspace{6pt}\newline,itemjoin=\hspace{50pt}]}{\end{enumerate*}}