# Custom enumitem list with a unique first line

I'm trying to create an "enumerated notes" list type, like so:

This is my current approach, which works but has some issues:

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{xparse}

\ExplSyntaxOn

\makeatletter
\NewDocumentCommand \labelstyle{m} {
\int_compare:nNnT {\c@notesi} < {2} {Note:~ }
(\emph{#1})
}
\makeatother

\ExplSyntaxOff

\newlist{notes}{enumerate}{2}
\setlist[notes]{
label = {\labelstyle{\alph*}},
leftmargin = *,
align = right
}

\begin{document}

\lipsum[1]

\begin{notes}[widest = c]
\item The product of two even permutations is even.
\item The product of two odd permutations is even.
\item The product of an odd and an even permutation is odd.
\end{notes}

\end{document}


The first line is longer than the others but contains the first enumerated label; the remaining lines contain just the enumerated labels.

Aside from the general question of whether there's a better way to approach this, I'm specifically trying to address two issues:

• In the labelstyle command, I tried using \value{notesi} but that failed with the error ! Missing = inserted for \ifnum.

• I've been unable to find the correct combo of leftmargin, labelwidth, etc. to avoid the use of the widest key. (I want the labels (a), (b), etc. to appear under each other, but want the "Note:" to be aligned with the surrounding text.)

• What do you mean by 'aligned with the surrounding text'? I also think you should use the enumitem ways of adding a labelling style. – user31729 Mar 13 '17 at 15:35

A slightly different version but similar to Ulrike's.

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{etoolbox}
\newlist{notes}{enumerate}{2}
\setlist[notes]{
leftmargin=*,
label=(\emph{\alph*}),
format=\Note,
align=left}
\begin{document}
\lipsum[1]
\begin{notes}
\item This is the first item.
\item This is the second item.
\item This is the third and longest item.
\end{notes}
\lipsum[1]
\end{document}


• Thanks for the suggestion to use \phantom. That worked perfectly for me. – Derek Mar 14 '17 at 1:02

Don't put formatting instructions in the label command. Use the format key instead.

\documentclass{article}
\usepackage{enumitem}
\usepackage{lipsum}
\usepackage{xparse}

\ExplSyntaxOn

\makeatletter

\NewDocumentCommand \labelstyle{m} {
\int_compare:nNnTF {\value{notesi}} < {2}
{\makebox[\labelwidth][l]{Note:\hfill (\emph{#1})}}
{(\emph{#1})}
}
\makeatother

\ExplSyntaxOff

\newlist{notes}{enumerate}{2}
\setlist[notes]{
label = {\alph*},
format= \labelstyle,
leftmargin = 2.5cm,
labelwidth=2cm,
labelsep=0.5cm,
align = right
}

\begin{document}

\lipsum[1]

\begin{notes}%[widest = c]
\item The product of two even permutations is even.
\item The product of two odd permutations is even.

\item The product of an odd and an even permutation is odd. \lipsum[1]
\end{notes}

\end{document}


A bit different approach. Put "Note: " in a box, \myPrelistBox, and write first the box and then a minipage of width \linewidth-\wd\myPrelistBox containing the list.

\documentclass{article}
\usepackage{lipsum}
\parskip=1em
\parindent=0pt
\usepackage{calc}
\usepackage{enumitem}
\newsavebox\myPrelistBox
\sbox\myPrelistBox{Note: }
\newenvironment{notes}{%
\usebox\myPrelistBox%
\begin{minipage}[t]{\linewidth-\wd\myPrelistBox}
\begin{enumerate}[label=(\emph{\alph*}),align=right]
}{%
\end{enumerate}
\end{minipage}%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\lipsum[1]
\begin{notes}
\item The product of two even permutations is even.
\item \lipsum[2]
\item The product of two odd permutations is even.
\item The product of an odd and an even permutation is odd.
\end{notes}

\lipsum[3]
\end{document}