%%
% \iffalse meta-comment
% --------------------------------------------------------------
% Part of the TeXPower bundle
% Copyright (C) 2003-2005 Hans Fredrik Nordhaug
%
% This program is free software; you can redistribute it and/or
% modify it under the terms of the GNU General Public License
% as published by the Free Software Foundation; either version 2
% of the License, or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
% --------------------------------------------------------------
%
% tplists.dtx,v 1.6 2005/04/07 21:43:07 hansfn Exp
%
% \fi
%
% \iffalse
%
%<*driver>
\ProvidesFile{tplists.dtx}
%</driver>
%<tplists>\NeedsTeXFormat{LaTeX2e}
%<tplists>\ProvidesPackage{tplists}
%<*tplists>
  [2005/04/07 v0.2 Easy Dynamic Lists using TeXPower]
%</tplists>
%
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
  \DocInput{tplists.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{634}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
%
% \GetFileInfo{tplists.dtx}
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \title{The \textsf{tplists} package\thanks{This document
%   corresponds to \textsf{tplists}~\fileversion, dated \filedate.}}
% \author{ Hans Fredrik Nordhaug \\ \texttt{hans@nordhaug.priv.no}}
%
% \maketitle
%
% \tableofcontents
%
% \section{Introduction}
%
% The package provides easy dynamic lists. The following
% environments/lists are available
% \begin{enumerate}
% \item |stepenum|, |stepitem|, |stepdesc|, |stepeqlist|, |stepcompactenum|
%               |stepcompactitem| and |stepcompacteqlist|.
% \item |flipenum|, |flipitem|, |flipdesc|, |flipeqlist|, |flipcompactenum|,
%               |flipcompactitem|,  and |flipcompacteqlist|
% \item |dimenum|, |dimitem|, |dimdesc|, |dimeqlist|, |dimcompactenum|,
%               |dimcompactitem|,  and |dimcompacteqlist|
% \end{enumerate}
% where |step| is short for stepped, |flip| for flipped and |dim| for dimmed.
% The packages |paralist| and |eqlist| must be loaded before this package to
% use the *eqlist and *compact* lists. |enum|, |item| and |desc| is of course
% short for |enumerate|, |itemize| and |description| respectively.
%
% \section{User interface}
%
% The package is loaded in the normal fashion, eg: |\usepackage{tplists}|  The package
% works better (the lists look better) if TeXPower uses colors.
%
% All lists (except *eqlist) takes an optional parameter adding to the indent
% of the list. Note that dim* and flip* lists do not nest, and that step* lists
% inside dim*/flip* will behave as a dim*/flip* list respectively.
% (The normal |itemize|, |enumerate| and |description| lists are modified so they accept the
% optional parameter and work nested with the new lists.)
%
% Example:
%
% \begin{verbatim}
% \documentclass[a4paper]{article}
% \usepackage[darkbackground,display]{texpower}
% \usepackage{tplists}
% \begin{document}
% \begin{flipitem}[2cm]
%   \item Before
%     \begin{enumerate}[1cm]
%       \item An item
%       \item Another item
%      \end{enumerate}
%   \item After
% \end{flipitem}
% \end{document}
% \end{verbatim}
%
% \section{Description of package options}
%
% The  following options exist: 
% \begin{description}
% \item[|pausestep|] makes step* lists use |\pause|%
% \item[|noflipendstep|] avoids the extra step at the end of a flipped list.
% \end{description}
%
% All options can be set anywhere in the document using a setup command, for example
% |\tplsetup{pausestep,noflipendstep=false}|. If the keys in the setup command have no
% value true is assumed.
%
% \section{Issues}
%
% The step* lists use |\vstep| (as default) which give weird results with
% structured backgrounds. Using the pausestep option fixes this, but then you
% can't nest step* lists inside dim* or flip* lists.  There are also some
% unresolved problems when using french babel.
%
% \StopEventually{\PrintChanges\PrintIndex}
%
% \section{Implementation}
%
% \changes{v0.1}{2003/10/03}{First public release.}
%
% \changes{v0.1a}{2003/10/04}{Removed redefinition of eqlist (since it didn't work).}
%
% \changes{v0.1b}{2003/10/07}{Corrected some typos in this documentation.
% Added option pausestep and made dim* (and all variants of flip*) lists work without
% colors by using boldface for active items.}
%
% \changes{v0.2}{2005/04/07}{Added flipdesc, stepdesc, dimdesc environments for
% easy dynamic description lists. Improved behaviour when not in display mode.
% Fixed step lists behaviour when in display mode, but without colors. Added
% noflipendstep option and a setup command to enable setting of all options
% anywhere in the document }
%
% \subsection{Loading of packages}
%
%    \begin{macrocode}
\RequirePackage{texpower}
%    \end{macrocode}
% Compact enum/item.
%    \begin{macrocode}
\newboolean{tpl@paralist}
\@ifpackageloaded{paralist}{\setboolean{tpl@paralist}{true}}{}
%    \end{macrocode}
% Lists with equal indentation.
%    \begin{macrocode}
\newboolean{tpl@eqlist}
\@ifpackageloaded{eqlist}{\setboolean{tpl@eqlist}{true}}{}
%    \end{macrocode}
%
% \subsection{Defining options}
%
% Use |\pause| for steplists (too avoid problems with structured backgrounds).
%    \begin{macrocode}
\newboolean{tpl@pausestep}
\DeclareOption{pausestep}{\setboolean{tpl@pausestep}{true}}
%    \end{macrocode}
% Don't add an extra step at the end of a flipped list.
%    \begin{macrocode}
\newboolean{tpl@noflipendstep}
\DeclareOption{noflipendstep}{\setboolean{tpl@noflipendstep}{true}}

\ProcessOptions
%    \end{macrocode}
% Defining setup command to enable change of options anywhere in the document.
%    \begin{macrocode}
\define@key{tpl}{pausestep}[true]{%
  \setboolean{tpl@pausestep}{#1}
}
\define@key{tpl}{noflipendstep}[true]{%
  \setboolean{tpl@noflipendstep}{#1}
}
\newcommand*{\tplsetup}{\setkeys{tpl}}
%    \end{macrocode}
%
%  \subsection{Flipped/dimmed/stepped lists/environments}
%
% |\iftpl@instepenv| indicates if we are in some kind of stepped list
% environment. |\iftpl@indimenv| / |\tpl@inflipenv| indicates that we are
% using one of the stepwise environments from texpower (that doesn't
% nest). |\iftpl@inpausestepenv| indicates that we are in a stepped
% list that uses |\pause|.
%
% using |tpl@| as prefix for internals.
%    \begin{macrocode}
\newif\iftpl@instepenv \tpl@instepenvfalse
\newif\iftpl@inpausestepenv \tpl@inpausestepenvfalse
\newif\iftpl@indimenv  \tpl@indimenvfalse
\newif\iftpl@inflipenv \tpl@inflipenvfalse
\let\oldenumerate=\enumerate
\let\olditemize=\itemize
\let\olddescription=\description
\let\endoldenumerate=\endenumerate
\let\endolditemize=\enditemize
\let\endolddescription=\enddescription
\ifthenelse{\boolean{tpl@eqlist}}{%
\let\oldeqlist=\eqlist
\let\endoldeqlist=\endeqlist
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\let\oldcompactenum=\compactenum
\let\oldcompactitem=\compactitem
\let\endoldcompactenum=\endcompactenum
\let\endoldcompactitem=\endcompactitem
}{}
%    \end{macrocode}
%
% Defining |\tpl@collect@body| - command used to scan the list
% environments. Definition borrowed from 'amsmath.sty' - slightly
% modified to allow for 'long' arguments
%    \begin{macrocode}
\let\tpl@nx\noexpand
\let\tpl@xp\expandafter
\newtoks\tpl@emptytoks
\newtoks\tpl@envbody
\long\def\tpl@addto@envbody#1{\global\tpl@envbody\tpl@xp{\the\tpl@envbody#1}}
\def\tpl@collect@body#1{%
  \tpl@envbody{\tpl@xp#1\tpl@xp{\the\tpl@envbody}}%
  \edef\tpl@process@envbody{\the\tpl@envbody\tpl@nx\end{\@currenvir}}%
  \tpl@envbody\tpl@emptytoks \def\begin@stack{b}%
  \begingroup
  \tpl@xp\let\csname\@currenvir\endcsname\tpl@collect@@body
  \edef\tpl@process@envbody{\tpl@xp\tpl@nx\csname\@currenvir\endcsname}%
  \tpl@process@envbody
}
\long\def\tpl@push@begins#1\begin#2{%
  \ifx\end#2\else b\tpl@xp\tpl@push@begins\fi
}
\long\def\tpl@collect@@body#1\end#2{%
  \edef\begin@stack{\tpl@push@begins#1\begin\end \tpl@xp\@gobble\begin@stack}%
  \ifx\@empty\begin@stack
    \endgroup
    \@checkend{#2}%
    \tpl@addto@envbody{#1}%
  \else
    \tpl@addto@envbody{#1\end{#2}}%
  \fi
  \tpl@process@envbody
}
%    \end{macrocode}
%
% Defining command |\tpl@addmargin| used to add a length to
% the leftmargin of the current level in a list.
%    \begin{macrocode}
\def\tpl@addmargin#1{%
  \advance\@listdepth 1
  \addtolength{\csname leftmargin\romannumeral\@listdepth\endcsname}{#1}
  \advance\@listdepth -1
}

\ifthenelse{\boolean{display}}{%
%
% Defining a flipped step command if we are in display mode.
% Note that |\tpl@flipstep| takes no argument.
%    \begin{macrocode}
\ifthenelse{\boolean{TPcolor}}% Can we use colors?
{% Yes. In this case highlighting is implemented by switching color.
  \def\tpl@flipstep{%
    \step{\ifthenelse{\boolean{firstactivation}}%
      {\color{textcolor}}%
      {\color{inactivecolor}}%
    }%
  }%
}
{% No. In this case highlighting is implemented by putting the item in boldface.
  \def\tpl@flipstep{%
    \step{\ifthenelse{\boolean{firstactivation}}{\bfseries}{\mdseries}}
  }%
}
%    \end{macrocode}
%
% Defining a dimmed step command if we are in display mode.
% Note that |\tpl@dimstep| takes no argument.
%    \begin{macrocode}
\ifthenelse{\boolean{TPcolor}}% Can we use colors?
{% Yes. In this case highlighting is implemented by using \dstep
  \def\tpl@dimstep{\dstep}%
}
{% No. In this case highlighting is implemented by putting the item in boldface.
  \def\tpl@dimstep{%
    \step{\bfseries}%
    \ifthenelse{\boolean{active}}{}{\mdseries}%
  }%
}
%    \end{macrocode}
%
% Defining a (normal) step command if we are in display mode. 
% Note that |\tpl@step| takes no argument.
%    \begin{macrocode}
\ifthenelse{\boolean{TPcolor}}% Can we use colors?
{% Yes. In this case stepping is implemented by using \vstep
  \def\tpl@step{\vstep}%
}
{% No. In this case stepping is implemented using \pause
  \def\tpl@step{\pause}%
}
%    \end{macrocode}
% TeXPower not in display mode - no need for a dimmed/flipped/normal step command.
%    \begin{macrocode}
}{% \boolean{display} is false
\def\tpl@flipstep{\relax}%
\def\tpl@dimstep{\relax}%
\def\tpl@step{\relax}%
}
%    \end{macrocode}
%
% Defining flipped stepped - itemize / description / enumerate / eqlist
% compact itemize / compact enumerate / compact eqlist - environments.
%    \begin{macrocode}
\newenvironment{flipitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@flipitem}%
 {\global\@ignoretrue}
\newenvironment{flipdesc}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@flipdesc}%
 {\global\@ignoretrue}
\newenvironment{flipenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@flipenum}%
 {\global\@ignoretrue}
\ifthenelse{\boolean{tpl@eqlist}}{%
\newenvironment{flipeqlist}[1][0cm]{%
  \tpl@collect@body\@flipeqlist}%
 {\global\@ignoretrue}
\newenvironment{flipcompacteqlist}[1][0cm]{%
  \tpl@collect@body\@flipcompacteqlist}%
 {\global\@ignoretrue}
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\newenvironment{flipcompactitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@flipcompactitem}%
 {\global\@ignoretrue}
\newenvironment{flipcompactenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@flipcompactenum}%
 {\global\@ignoretrue}
}{}

\newcommand\@fliplist[2]{%
  \iftpl@indimenv
    \PackageError{tplists}{%
      dim* and flip* environments do NOT nest}{%
      Do not continue! Type 'q' to stop and fix the nested list.
    }
  \else\iftpl@instepenv
    \begin{#1}
    \let\hidestepcontents=\displaystepcontents
    \renewcommand{\item}{\tpl@flipstep\tpl@origitem}%
    #2
    \end{#1}%
  \else
    \iftpl@inpausestepenv\let\liststepwise=\stepwise\fi
    \liststepwise[\let\hidestepcontents=\displaystepcontents]{%
      \begin{#1}
      \iftpl@inpausestepenv\else
        \iftpl@instepenv\else\let\tpl@origitem=\item\fi
      \fi
      \tpl@instepenvtrue
      \tpl@inflipenvtrue
      \renewcommand{\item}{\tpl@flipstep\tpl@origitem}%
      #2
      \ifthenelse{\boolean{tpl@noflipendstep}}{}{\step{}}%
      \end{#1}}
  \fi\fi
}

\newcommand\@flipitem[1]{%
 \@fliplist{olditemize}{#1}}
\newcommand\@flipdesc[1]{%
 \@fliplist{olddescription}{#1}}
\newcommand\@flipenum[1]{%
 \@fliplist{oldenumerate}{#1}}
\ifthenelse{\boolean{tpl@eqlist}}{%
\newcommand\@flipeqlist[1]{%
 \@fliplist{oldeqlist}{#1}}
\newcommand\@flipcompacteqlist[1]{%
 \@fliplist{compacteqlist}{#1}}
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\newcommand\@flipcompactitem[1]{%
 \@fliplist{oldcompactitem}{#1}}
\newcommand\@flipcompactenum[1]{%
 \@fliplist{oldcompactenum}{#1}}
}{}
%    \end{macrocode}
%
% Defining dimmed stepped - itemize / description / enumerate / eqlist /
% compact itemize / compact enumerate / compact eqlist - environments.
%    \begin{macrocode}
\newenvironment{dimitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@dimitem}%
 {\global\@ignoretrue}
\newenvironment{dimdesc}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@dimdesc}%
 {\global\@ignoretrue}
\newenvironment{dimenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@dimenum}%
 {\global\@ignoretrue}
\ifthenelse{\boolean{tpl@eqlist}}{%
\newenvironment{dimeqlist}[1][0cm]{%
  \tpl@collect@body\@dimeqlist}%
 {\global\@ignoretrue}
\newenvironment{dimcompacteqlist}[1][0cm]{%
  \tpl@collect@body\@dimcompacteqlist}%
 {\global\@ignoretrue}
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\newenvironment{dimcompactitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@dimcompactitem}%
 {\global\@ignoretrue}
\newenvironment{dimcompactenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@dimcompactenum}%
 {\global\@ignoretrue}
}{}

\newcommand\@dimlist[2]{%
  \iftpl@inflipenv
    \PackageError{tplists}{%
      dim* and flip* environments do NOT nest}{%
      Do not continue! Type <q> to stop and fix the nested list.
    }
  \else\iftpl@instepenv
    \begin{#1}
    \renewcommand{\item}{\tpl@dimstep\tpl@origitem}%
    #2
    \end{#1}%
  \else
    \iftpl@inpausestepenv\let\liststepwise=\stepwise\fi
    \liststepwise{%
      \begin{#1}
      \iftpl@inpausestepenv\else
        \iftpl@instepenv\else\let\tpl@origitem=\item\fi
      \fi
      \tpl@instepenvtrue
      \tpl@indimenvtrue
      \renewcommand{\item}{\tpl@dimstep\tpl@origitem}%
      #2
      \end{#1}}
  \fi\fi
}

\newcommand\@dimitem[1]{%
 \@dimlist{olditemize}{#1}}
\newcommand\@dimdesc[1]{%
 \@dimlist{olddescription}{#1}}
\newcommand\@dimenum[1]{%
 \@dimlist{oldenumerate}{#1}}
\ifthenelse{\boolean{tpl@eqlist}}{%
\newcommand\@dimeqlist[1]{%
 \@dimlist{oldeqlist}{#1}}
\newcommand\@dimcompacteqlist[1]{%
 \@dimlist{compacteqlist}{#1}}
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\newcommand\@dimcompactitem[1]{%
 \@dimlist{oldcompactitem}{#1}}
\newcommand\@dimcompactenum[1]{%
 \@dimlist{oldcompactenum}{#1}}
}{}
%    \end{macrocode}
%
% Defining stepped - itemize / description / enumerate / eqlist /
% compact itemize / compact enumerate / compact eqlist - environments.
%    \begin{macrocode}
\newenvironment{stepitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@stepitem}%
 {\global\@ignoretrue}
\newenvironment{stepdesc}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@stepdesc}%
 {\global\@ignoretrue}
\newenvironment{stepenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@stepenum}%
 {\global\@ignoretrue}
\ifthenelse{\boolean{tpl@eqlist}}{%
\newenvironment{stepeqlist}[1][0cm]{%
  \tpl@collect@body\@stepeqlist}%
 {\global\@ignoretrue}
\newenvironment{stepcompacteqlist}[1][0cm]{%
  \tpl@collect@body\@stepcompacteqlist}%
 {\global\@ignoretrue}
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\newenvironment{stepcompactitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@stepcompactitem}%
 {\global\@ignoretrue}
\newenvironment{stepcompactenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \tpl@collect@body\@stepcompactenum}%
 {\global\@ignoretrue}
}{}
%    \end{macrocode}
% Using |\pause| for step* lists if |tpl@pausestep| is true
%    \begin{macrocode}
\newcommand\@steplist[2]{%
\ifthenelse{\boolean{tpl@pausestep}}{%
  \iftpl@inflipenv
    \PackageError{tplists}{%
      flip* followed by step* environment does NOT work \MessageBreak
      when the pausestep option is used}{%
      Do not continue! Type <q> to stop and fix the nested list.
    }
  \else\iftpl@indimenv
    \PackageError{tplists}{%
      dim* followed by step* environment does NOT work \MessageBreak
      when the pausestep option is used}{%
      Do not continue! Type <q> to stop and fix the nested list.
    }
  \else
    \begin{#1}
      \iftpl@inpausestepenv\else\let\tpl@origitem=\item\fi
      \tpl@inpausestepenvtrue
      \renewcommand{\item}{\pause\tpl@origitem}%
      #2
    \end{#1}
  \fi\fi
}{
%    \end{macrocode}
% Using |\liststepwise| for step* lists if |tpl@pausestep| is false
%    \begin{macrocode}
  \iftpl@inflipenv
    \begin{#1}
    \renewcommand{\item}{\tpl@flipstep\tpl@origitem}
    #2
    \end{#1}%
  \else\iftpl@indimenv
    \begin{#1}
    \renewcommand{\item}{\dstep\tpl@origitem}%
    #2
    \end{#1}%
  \else\iftpl@instepenv
    \begin{#1}
    \renewcommand{\item}{\tpl@step\tpl@origitem}%
    #2
    \end{#1}%
  \else
    \liststepwise{%
      \begin{#1}
      \iftpl@instepenv\else\let\tpl@origitem=\item\fi
      \tpl@instepenvtrue
      \renewcommand{\item}{\tpl@step\tpl@origitem}%
      #2
      \end{#1}}
  \fi\fi\fi
}
}

\newcommand\@stepitem[1]{%
 \@steplist{olditemize}{#1}}
\newcommand\@stepdesc[1]{%
 \@steplist{olddescription}{#1}}
\newcommand\@stepenum[1]{%
 \@steplist{oldenumerate}{#1}}
\ifthenelse{\boolean{tpl@eqlist}}{%
\newcommand\@stepeqlist[1]{%
 \@steplist{oldeqlist}{#1}}
\newcommand\@stepcompacteqlist[1]{%
 \@steplist{compacteqlist}{#1}}
}{}
\ifthenelse{\boolean{tpl@paralist}}{%
\newcommand\@stepcompactitem[1]{%
 \@steplist{oldcompactitem}{#1}}
\newcommand\@stepcompactenum[1]{%
 \@steplist{oldcompactenum}{#1}}
}{}
%    \end{macrocode}
%
% Defining compact eqlist
%    \begin{macrocode}
\newenvironment{compacteqlist}[1][0cm]{%
  % \tpl@addmargin{#1}
  \begin{eqlist}[\parsep0pt\itemsep0pt]}%
 {\end{eqlist}}
%    \end{macrocode}
%
% Redefining enumerate, itemize and description to handle changes made by
% introducing steps and leftmargini-option.
%    \begin{macrocode}
\renewenvironment{enumerate}[1][0cm]{%
  \tpl@addmargin{#1}
  \begin{oldenumerate}
    \iftpl@instepenv
      \renewcommand{\item}{\tpl@origitem}%
    \fi
 }%
 {\end{oldenumerate}}

\renewenvironment{itemize}[1][0cm]{%
  \tpl@addmargin{#1}
  \begin{olditemize}
    \iftpl@instepenv
      \renewcommand{\item}{\tpl@origitem}%
    \fi
 }%
 {\end{olditemize}}

\renewenvironment{description}[1][0cm]{%
  % \tpl@addmargin{#1} % Has no effect - FIXME
  \begin{olddescription}
    \iftpl@instepenv
      \renewcommand{\item}{\tpl@origitem}%
    \fi
 }%
 {\end{olddescription}}
%    \end{macrocode}
%
% Redefining compactenum and compactitem to handle changes made by
% introducing steps and leftmargini-option.
%    \begin{macrocode}
\ifthenelse{\boolean{tpl@paralist}}{%
\renewenvironment{compactenum}[1][0cm]{%
  \tpl@addmargin{#1}
  \begin{oldcompactenum}
    \iftpl@instepenv
      \renewcommand{\item}{\tpl@origitem}%
    \fi
 }%
 {\end{oldcompactenum}}

\renewenvironment{compactitem}[1][0cm]{%
  \tpl@addmargin{#1}
  \begin{oldcompactitem}
    \iftpl@instepenv
      \renewcommand{\item}{\tpl@origitem}%
    \fi
 }%
 {\end{oldcompactitem}}
}{}
%    \end{macrocode}

% \Finale
\endinput
