% List environments
% Paul Taylor, 11 June 2003

% \newliststyle{name}{counter-style}{label-style}{prefix-style}
% defines new list environments \begin{name}...\end{name} and
% \begin{name}...\end{name} with the appropriate styles.
% The *-form continues the previous enumeration.

\makeatletter
\newcount\previous@enumeration

\def\newliststyle#1#2#3#4{%
  \@namedef{#1}%
  {\ifnum \@enumdepth >3 \@toodeep
   \else
      \advance\@enumdepth \@ne 
      \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \let\@outerlabel\@currentlabel
      \@namedef{the\@enumctr}{#2}
      \@namedef{label\@enumctr}{#3}
      \@namedef{p@\@enumctr}{#4}
      \list{\@nameuse{label\@enumctr}}%
        {\usecounter{\@enumctr}\def\makelabel####1{####1\hss}}%
   \fi
  }%
  \@namedef{#1*}{\@nameuse{#1}\setcounter\@enumctr\previous@enumeration}%
  \@namedef{end#1}{\global\previous@enumeration\@nameuse{c@\@enumctr}\endlist}%
 \@namedef{end#1*}{\global\previous@enumeration\@nameuse{c@\@enumctr}\endlist}%
}

% ``enumerate'' environment - based on default, but always uses numbers
% sets \@currentlabel to the number alone.
\newliststyle{enumerate}%
   {\arabic{\@enumctr}}{\@nameuse{the\@enumctr}.}{}

% ``numberlist'' environment - sets \@currentlabel to outerlabel.number
\newliststyle{numberlist}%
   {\arabic{\@enumctr}}{\@nameuse{the\@enumctr}.}{\@outerlabel.}

% ``letterlist'' environment - as numberlist, but uses letters
\newliststyle{letterlist}%
   {(\alph{\@enumctr})}{\@nameuse{the\@enumctr}}{\@outerlabel}

% ``greeklist'' environment - as numberlist, but uses greek letters
% sets \@currentlabel to the number
\newliststyle{greeklist}%
   {(\greek{\@enumctr})}{\@nameuse{the\@enumctr}}{\@outerlabel}

% ``romanlist'' environment - as numberlist, but uses roman numerals
% sets \@currentlabel to the number
\newliststyle{romanlist}%
   {(\roman{\@enumctr})}{\@nameuse{the\@enumctr}}{\@outerlabel}


% Indentation, etc for lists
\def\@listI{%
   \labelwidth=16pt
   \labelsep=2pt
   \leftmargin \labelwidth \advance\leftmargin\labelsep
   \partopsep=\parskip
   \topsep=\z@ %1pt plus 1pt minus0pt
   \parsep=1pt plus1pt minus0pt
   \itemsep=1pt plus1pt minus0pt
   % dont break pages before itemisation
   \@beginparpenalty=\predisplaypenalty
   \@endparpenalty=\postdisplaypenalty
   \@itempenalty=500\relax}
\let\@listi\@listI
\@listi 

\makeatother