summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/texpower/tplists.dtx
blob: 93a2273b75cae4a94e60c99f078425b0c5f14906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
%%
% \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