5

as far as I know, there are two ways of defining an individual list style:

1) Use the enumitem package and the \newlist and \setlist commands

2) Define an individual environment like the following example:

\newenvironment{exampleEnumeration}
{\begin{enumerate}[leftmargin=*, itemsep=2pt, parsep=0pt]}
{\end{enumerate}} 

Now my question is: which way should I prefer? Is it only a difference in convenience or are there more imporant aspects I'm not aware of? Thank you!

strauberry
  • 3,255
  • 1
    With newlist you can easily add extra options on individual instances. – Andrew Swann Jun 27 '14 at 08:57
  • also with \newlist you can use \setlist[mylist]{...} to globally configure mylist. So \newlist is preferable. – daleif Jun 27 '14 at 09:13
  • It depends. If enumitem is incompatible with the class or packages you are using, that option is ruled out. This won't happen with \newenvironment because that's a standard LaTeX command. However, the way you've used \newenvironment depends on enumitem anyway so I cannot see any point in using it in that case. If you are loading enumitem anyhow, why not use its facilities in the form of \newlist etc.? – cfr Jun 27 '14 at 22:46

1 Answers1

4

\newlist is primarily for defining new sets of enumerated/itemized lists. For instance

\newlist{exampleEnumeration}
\setlist[exampleEnumeration]{leftmargin=*, itemsep=2pt, parsep=0pt}

would be illegal, because you must specify label (and optionally ref). If you don't specify the level, the same label will be used at all levels. So you should type, say,

\newlist{exampleEnumeration}
\setlist[exampleEnumeration,1]{leftmargin=*, itemsep=2pt, parsep=0pt, label=\arabic*.}
\setlist[exampleEnumeration,2]{leftmargin=*, itemsep=2pt, parsep=0pt, label=(\alph*)}

and so on.

With \newenvironment the label corresponding to the current nesting level will be used.

A better definition would be

\newenvironment{exampleEnumeration}[1][]
  {\enumerate[leftmargin=*, itemsep=2pt, parsep=0pt, #1]}
  {\endenumerate}

so that you can pass more options to exampleEnumeration; moreover, using \enumerate and \endenumerate you would get more meaningful error messages when the nesting is wrong.

egreg
  • 1,121,712