[Tex/LaTex] enumitem: levels with inline option

#enumerateenumiteminline()lists

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.

Best Answer

Rather than try to exchange code via comments, I thought I would just post what I have.

Here, I introduce the inumerate environment that is an inline enumerate* variety that modifies certain parameters of the enumeration that the OP seemed interested in.

\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}
\newenvironment{inumerate}{\begin{enumerate*}[before=\vspace{6pt}\newline,
  itemjoin=\hspace{50pt}]}{\end{enumerate*}}
\begin{document}

Here's a non-nested inline enumerate list:
\begin{inumerate}
  \item blah
  \item blah
  \item blah
\end{inumerate}

\begin{enumerate}
  \item blah
  \item Here's a nested inline list:
  \begin{inumerate}
    \item blah
    \item blah
    \item blah
  \end{inumerate}
  \item Next outer item
\end{enumerate}
\end{document}

enter image description here

The above does not support resume because inumerate, being an environment, is grouped, and the data necessary to resume are lost. Here I instead provide a pseudo-environment xnumerate that will support resume.

I also provide the original inumerate environment, modified to take additional optional arguments (except resume).

\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}
\newenvironment{inumerate}[1][]{\begin{enumerate*}[before=\vspace{6pt}\newline,
  itemjoin=\hspace{50pt},#1]}{\end{enumerate*}}
  \newcommand\xnumerate[1][]{\xnumerateaux{#1}}
\def\xnumerateaux#1#2\endxnumerate{\begin{enumerate*}[before=\vspace{6pt}\newline,
  itemjoin=\hspace{50pt},#1]#2\end{enumerate*}}
\begin{document}

Here's a non-nested inline enumerate list:
\begin{inumerate}
  \item blah
  \item blah
  \item blah
\end{inumerate}

\begin{enumerate}
  \item blah
  \item Here's a nested inline list:
  \xnumerate
    \item blah
    \item blah
    \item blah
  \endxnumerate
  \item Next outer item
  \xnumerate[resume]
    \item blah
    \item blah
    \item blah
  \endxnumerate
  \item Next outer item
\end{enumerate}
\end{document}

enter image description here

Related Question