| 1 |
%% |
| 2 |
% \iffalse meta-comment |
| 3 |
% -------------------------------------------------------------- |
| 4 |
% Part of the TeXPower bundle |
| 5 |
% Copyright (C) 2003-2005 Hans Fredrik Nordhaug |
| 6 |
% |
| 7 |
% This program is free software; you can redistribute it and/or |
| 8 |
% modify it under the terms of the GNU General Public License |
| 9 |
% as published by the Free Software Foundation; either version 2 |
| 10 |
% of the License, or (at your option) any later version. |
| 11 |
% |
| 12 |
% This program is distributed in the hope that it will be useful, |
| 13 |
% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
% GNU General Public License for more details. |
| 16 |
% -------------------------------------------------------------- |
| 17 |
% |
| 18 |
% tplists.dtx,v 1.6 2005/04/07 21:43:07 hansfn Exp |
| 19 |
% |
| 20 |
% \fi |
| 21 |
% |
| 22 |
% \iffalse |
| 23 |
% |
| 24 |
%<*driver> |
| 25 |
\ProvidesFile{tplists.dtx} |
| 26 |
%</driver> |
| 27 |
%<tplists>\NeedsTeXFormat{LaTeX2e} |
| 28 |
%<tplists>\ProvidesPackage{tplists} |
| 29 |
%<*tplists> |
| 30 |
[2005/04/07 v0.2 Easy Dynamic Lists using TeXPower] |
| 31 |
%</tplists> |
| 32 |
% |
| 33 |
%<*driver> |
| 34 |
\documentclass{ltxdoc} |
| 35 |
\EnableCrossrefs |
| 36 |
\CodelineIndex |
| 37 |
\RecordChanges |
| 38 |
\begin{document} |
| 39 |
\DocInput{tplists.dtx} |
| 40 |
\end{document} |
| 41 |
%</driver> |
| 42 |
% |
| 43 |
% \fi |
| 44 |
% |
| 45 |
% \CheckSum{634} |
| 46 |
% |
| 47 |
% \CharacterTable |
| 48 |
% {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 |
| 49 |
% 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 |
| 50 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 51 |
% Exclamation \! Double quote \" Hash (number) \# |
| 52 |
% Dollar \$ Percent \% Ampersand \& |
| 53 |
% Acute accent \' Left paren \( Right paren \) |
| 54 |
% Asterisk \* Plus \+ Comma \, |
| 55 |
% Minus \- Point \. Solidus \/ |
| 56 |
% Colon \: Semicolon \; Less than \< |
| 57 |
% Equals \= Greater than \> Question mark \? |
| 58 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 59 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 60 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 61 |
% Right brace \} Tilde \~} |
| 62 |
% |
| 63 |
% |
| 64 |
% \GetFileInfo{tplists.dtx} |
| 65 |
% |
| 66 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 67 |
% |
| 68 |
% \title{The \textsf{tplists} package\thanks{This document |
| 69 |
% corresponds to \textsf{tplists}~\fileversion, dated \filedate.}} |
| 70 |
% \author{ Hans Fredrik Nordhaug \\ \texttt{[email protected]}} |
| 71 |
% |
| 72 |
% \maketitle |
| 73 |
% |
| 74 |
% \tableofcontents |
| 75 |
% |
| 76 |
% \section{Introduction} |
| 77 |
% |
| 78 |
% The package provides easy dynamic lists. The following |
| 79 |
% environments/lists are available |
| 80 |
% \begin{enumerate} |
| 81 |
% \item |stepenum|, |stepitem|, |stepdesc|, |stepeqlist|, |stepcompactenum| |
| 82 |
% |stepcompactitem| and |stepcompacteqlist|. |
| 83 |
% \item |flipenum|, |flipitem|, |flipdesc|, |flipeqlist|, |flipcompactenum|, |
| 84 |
% |flipcompactitem|, and |flipcompacteqlist| |
| 85 |
% \item |dimenum|, |dimitem|, |dimdesc|, |dimeqlist|, |dimcompactenum|, |
| 86 |
% |dimcompactitem|, and |dimcompacteqlist| |
| 87 |
% \end{enumerate} |
| 88 |
% where |step| is short for stepped, |flip| for flipped and |dim| for dimmed. |
| 89 |
% The packages |paralist| and |eqlist| must be loaded before this package to |
| 90 |
% use the *eqlist and *compact* lists. |enum|, |item| and |desc| is of course |
| 91 |
% short for |enumerate|, |itemize| and |description| respectively. |
| 92 |
% |
| 93 |
% \section{User interface} |
| 94 |
% |
| 95 |
% The package is loaded in the normal fashion, eg: |\usepackage{tplists}| The package |
| 96 |
% works better (the lists look better) if TeXPower uses colors. |
| 97 |
% |
| 98 |
% All lists (except *eqlist) takes an optional parameter adding to the indent |
| 99 |
% of the list. Note that dim* and flip* lists do not nest, and that step* lists |
| 100 |
% inside dim*/flip* will behave as a dim*/flip* list respectively. |
| 101 |
% (The normal |itemize|, |enumerate| and |description| lists are modified so they accept the |
| 102 |
% optional parameter and work nested with the new lists.) |
| 103 |
% |
| 104 |
% Example: |
| 105 |
% |
| 106 |
% \begin{verbatim} |
| 107 |
% \documentclass[a4paper]{article} |
| 108 |
% \usepackage[darkbackground,display]{texpower} |
| 109 |
% \usepackage{tplists} |
| 110 |
% \begin{document} |
| 111 |
% \begin{flipitem}[2cm] |
| 112 |
% \item Before |
| 113 |
% \begin{enumerate}[1cm] |
| 114 |
% \item An item |
| 115 |
% \item Another item |
| 116 |
% \end{enumerate} |
| 117 |
% \item After |
| 118 |
% \end{flipitem} |
| 119 |
% \end{document} |
| 120 |
% \end{verbatim} |
| 121 |
% |
| 122 |
% \section{Description of package options} |
| 123 |
% |
| 124 |
% The following options exist: |
| 125 |
% \begin{description} |
| 126 |
% \item[|pausestep|] makes step* lists use |\pause|% |
| 127 |
% \item[|noflipendstep|] avoids the extra step at the end of a flipped list. |
| 128 |
% \end{description} |
| 129 |
% |
| 130 |
% All options can be set anywhere in the document using a setup command, for example |
| 131 |
% |\tplsetup{pausestep,noflipendstep=false}|. If the keys in the setup command have no |
| 132 |
% value true is assumed. |
| 133 |
% |
| 134 |
% \section{Issues} |
| 135 |
% |
| 136 |
% The step* lists use |\vstep| (as default) which give weird results with |
| 137 |
% structured backgrounds. Using the pausestep option fixes this, but then you |
| 138 |
% can't nest step* lists inside dim* or flip* lists. There are also some |
| 139 |
% unresolved problems when using french babel. |
| 140 |
% |
| 141 |
% \StopEventually{\PrintChanges\PrintIndex} |
| 142 |
% |
| 143 |
% \section{Implementation} |
| 144 |
% |
| 145 |
% \changes{v0.1}{2003/10/03}{First public release.} |
| 146 |
% |
| 147 |
% \changes{v0.1a}{2003/10/04}{Removed redefinition of eqlist (since it didn't work).} |
| 148 |
% |
| 149 |
% \changes{v0.1b}{2003/10/07}{Corrected some typos in this documentation. |
| 150 |
% Added option pausestep and made dim* (and all variants of flip*) lists work without |
| 151 |
% colors by using boldface for active items.} |
| 152 |
% |
| 153 |
% \changes{v0.2}{2005/04/07}{Added flipdesc, stepdesc, dimdesc environments for |
| 154 |
% easy dynamic description lists. Improved behaviour when not in display mode. |
| 155 |
% Fixed step lists behaviour when in display mode, but without colors. Added |
| 156 |
% noflipendstep option and a setup command to enable setting of all options |
| 157 |
% anywhere in the document } |
| 158 |
% |
| 159 |
% \subsection{Loading of packages} |
| 160 |
% |
| 161 |
% \begin{macrocode} |
| 162 |
\RequirePackage{texpower} |
| 163 |
% \end{macrocode} |
| 164 |
% Compact enum/item. |
| 165 |
% \begin{macrocode} |
| 166 |
\newboolean{tpl@paralist} |
| 167 |
\@ifpackageloaded{paralist}{\setboolean{tpl@paralist}{true}}{} |
| 168 |
% \end{macrocode} |
| 169 |
% Lists with equal indentation. |
| 170 |
% \begin{macrocode} |
| 171 |
\newboolean{tpl@eqlist} |
| 172 |
\@ifpackageloaded{eqlist}{\setboolean{tpl@eqlist}{true}}{} |
| 173 |
% \end{macrocode} |
| 174 |
% |
| 175 |
% \subsection{Defining options} |
| 176 |
% |
| 177 |
% Use |\pause| for steplists (too avoid problems with structured backgrounds). |
| 178 |
% \begin{macrocode} |
| 179 |
\newboolean{tpl@pausestep} |
| 180 |
\DeclareOption{pausestep}{\setboolean{tpl@pausestep}{true}} |
| 181 |
% \end{macrocode} |
| 182 |
% Don't add an extra step at the end of a flipped list. |
| 183 |
% \begin{macrocode} |
| 184 |
\newboolean{tpl@noflipendstep} |
| 185 |
\DeclareOption{noflipendstep}{\setboolean{tpl@noflipendstep}{true}} |
| 186 |
|
| 187 |
\ProcessOptions |
| 188 |
% \end{macrocode} |
| 189 |
% Defining setup command to enable change of options anywhere in the document. |
| 190 |
% \begin{macrocode} |
| 191 |
\define@key{tpl}{pausestep}[true]{% |
| 192 |
\setboolean{tpl@pausestep}{#1} |
| 193 |
} |
| 194 |
\define@key{tpl}{noflipendstep}[true]{% |
| 195 |
\setboolean{tpl@noflipendstep}{#1} |
| 196 |
} |
| 197 |
\newcommand*{\tplsetup}{\setkeys{tpl}} |
| 198 |
% \end{macrocode} |
| 199 |
% |
| 200 |
% \subsection{Flipped/dimmed/stepped lists/environments} |
| 201 |
% |
| 202 |
% |\iftpl@instepenv| indicates if we are in some kind of stepped list |
| 203 |
% environment. |\iftpl@indimenv| / |\tpl@inflipenv| indicates that we are |
| 204 |
% using one of the stepwise environments from texpower (that doesn't |
| 205 |
% nest). |\iftpl@inpausestepenv| indicates that we are in a stepped |
| 206 |
% list that uses |\pause|. |
| 207 |
% |
| 208 |
% using |tpl@| as prefix for internals. |
| 209 |
% \begin{macrocode} |
| 210 |
\newif\iftpl@instepenv \tpl@instepenvfalse |
| 211 |
\newif\iftpl@inpausestepenv \tpl@inpausestepenvfalse |
| 212 |
\newif\iftpl@indimenv \tpl@indimenvfalse |
| 213 |
\newif\iftpl@inflipenv \tpl@inflipenvfalse |
| 214 |
\let\oldenumerate=\enumerate |
| 215 |
\let\olditemize=\itemize |
| 216 |
\let\olddescription=\description |
| 217 |
\let\endoldenumerate=\endenumerate |
| 218 |
\let\endolditemize=\enditemize |
| 219 |
\let\endolddescription=\enddescription |
| 220 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 221 |
\let\oldeqlist=\eqlist |
| 222 |
\let\endoldeqlist=\endeqlist |
| 223 |
}{} |
| 224 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 225 |
\let\oldcompactenum=\compactenum |
| 226 |
\let\oldcompactitem=\compactitem |
| 227 |
\let\endoldcompactenum=\endcompactenum |
| 228 |
\let\endoldcompactitem=\endcompactitem |
| 229 |
}{} |
| 230 |
% \end{macrocode} |
| 231 |
% |
| 232 |
% Defining |\tpl@collect@body| - command used to scan the list |
| 233 |
% environments. Definition borrowed from 'amsmath.sty' - slightly |
| 234 |
% modified to allow for 'long' arguments |
| 235 |
% \begin{macrocode} |
| 236 |
\let\tpl@nx\noexpand |
| 237 |
\let\tpl@xp\expandafter |
| 238 |
\newtoks\tpl@emptytoks |
| 239 |
\newtoks\tpl@envbody |
| 240 |
\long\def\tpl@addto@envbody#1{\global\tpl@envbody\tpl@xp{\the\tpl@envbody#1}} |
| 241 |
\def\tpl@collect@body#1{% |
| 242 |
\tpl@envbody{\tpl@xp#1\tpl@xp{\the\tpl@envbody}}% |
| 243 |
\edef\tpl@process@envbody{\the\tpl@envbody\tpl@nx\end{\@currenvir}}% |
| 244 |
\tpl@envbody\tpl@emptytoks \def\begin@stack{b}% |
| 245 |
\begingroup |
| 246 |
\tpl@xp\let\csname\@currenvir\endcsname\tpl@collect@@body |
| 247 |
\edef\tpl@process@envbody{\tpl@xp\tpl@nx\csname\@currenvir\endcsname}% |
| 248 |
\tpl@process@envbody |
| 249 |
} |
| 250 |
\long\def\tpl@push@begins#1\begin#2{% |
| 251 |
\ifx\end#2\else b\tpl@xp\tpl@push@begins\fi |
| 252 |
} |
| 253 |
\long\def\tpl@collect@@body#1\end#2{% |
| 254 |
\edef\begin@stack{\tpl@push@begins#1\begin\end \tpl@xp\@gobble\begin@stack}% |
| 255 |
\ifx\@empty\begin@stack |
| 256 |
\endgroup |
| 257 |
\@checkend{#2}% |
| 258 |
\tpl@addto@envbody{#1}% |
| 259 |
\else |
| 260 |
\tpl@addto@envbody{#1\end{#2}}% |
| 261 |
\fi |
| 262 |
\tpl@process@envbody |
| 263 |
} |
| 264 |
% \end{macrocode} |
| 265 |
% |
| 266 |
% Defining command |\tpl@addmargin| used to add a length to |
| 267 |
% the leftmargin of the current level in a list. |
| 268 |
% \begin{macrocode} |
| 269 |
\def\tpl@addmargin#1{% |
| 270 |
\advance\@listdepth 1 |
| 271 |
\addtolength{\csname leftmargin\romannumeral\@listdepth\endcsname}{#1} |
| 272 |
\advance\@listdepth -1 |
| 273 |
} |
| 274 |
|
| 275 |
\ifthenelse{\boolean{display}}{% |
| 276 |
% |
| 277 |
% Defining a flipped step command if we are in display mode. |
| 278 |
% Note that |\tpl@flipstep| takes no argument. |
| 279 |
% \begin{macrocode} |
| 280 |
\ifthenelse{\boolean{TPcolor}}% Can we use colors? |
| 281 |
{% Yes. In this case highlighting is implemented by switching color. |
| 282 |
\def\tpl@flipstep{% |
| 283 |
\step{\ifthenelse{\boolean{firstactivation}}% |
| 284 |
{\color{textcolor}}% |
| 285 |
{\color{inactivecolor}}% |
| 286 |
}% |
| 287 |
}% |
| 288 |
} |
| 289 |
{% No. In this case highlighting is implemented by putting the item in boldface. |
| 290 |
\def\tpl@flipstep{% |
| 291 |
\step{\ifthenelse{\boolean{firstactivation}}{\bfseries}{\mdseries}} |
| 292 |
}% |
| 293 |
} |
| 294 |
% \end{macrocode} |
| 295 |
% |
| 296 |
% Defining a dimmed step command if we are in display mode. |
| 297 |
% Note that |\tpl@dimstep| takes no argument. |
| 298 |
% \begin{macrocode} |
| 299 |
\ifthenelse{\boolean{TPcolor}}% Can we use colors? |
| 300 |
{% Yes. In this case highlighting is implemented by using \dstep |
| 301 |
\def\tpl@dimstep{\dstep}% |
| 302 |
} |
| 303 |
{% No. In this case highlighting is implemented by putting the item in boldface. |
| 304 |
\def\tpl@dimstep{% |
| 305 |
\step{\bfseries}% |
| 306 |
\ifthenelse{\boolean{active}}{}{\mdseries}% |
| 307 |
}% |
| 308 |
} |
| 309 |
% \end{macrocode} |
| 310 |
% |
| 311 |
% Defining a (normal) step command if we are in display mode. |
| 312 |
% Note that |\tpl@step| takes no argument. |
| 313 |
% \begin{macrocode} |
| 314 |
\ifthenelse{\boolean{TPcolor}}% Can we use colors? |
| 315 |
{% Yes. In this case stepping is implemented by using \vstep |
| 316 |
\def\tpl@step{\vstep}% |
| 317 |
} |
| 318 |
{% No. In this case stepping is implemented using \pause |
| 319 |
\def\tpl@step{\pause}% |
| 320 |
} |
| 321 |
% \end{macrocode} |
| 322 |
% TeXPower not in display mode - no need for a dimmed/flipped/normal step command. |
| 323 |
% \begin{macrocode} |
| 324 |
}{% \boolean{display} is false |
| 325 |
\def\tpl@flipstep{\relax}% |
| 326 |
\def\tpl@dimstep{\relax}% |
| 327 |
\def\tpl@step{\relax}% |
| 328 |
} |
| 329 |
% \end{macrocode} |
| 330 |
% |
| 331 |
% Defining flipped stepped - itemize / description / enumerate / eqlist |
| 332 |
% compact itemize / compact enumerate / compact eqlist - environments. |
| 333 |
% \begin{macrocode} |
| 334 |
\newenvironment{flipitem}[1][0cm]{% |
| 335 |
\tpl@addmargin{#1} |
| 336 |
\tpl@collect@body\@flipitem}% |
| 337 |
{\global\@ignoretrue} |
| 338 |
\newenvironment{flipdesc}[1][0cm]{% |
| 339 |
\tpl@addmargin{#1} |
| 340 |
\tpl@collect@body\@flipdesc}% |
| 341 |
{\global\@ignoretrue} |
| 342 |
\newenvironment{flipenum}[1][0cm]{% |
| 343 |
\tpl@addmargin{#1} |
| 344 |
\tpl@collect@body\@flipenum}% |
| 345 |
{\global\@ignoretrue} |
| 346 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 347 |
\newenvironment{flipeqlist}[1][0cm]{% |
| 348 |
\tpl@collect@body\@flipeqlist}% |
| 349 |
{\global\@ignoretrue} |
| 350 |
\newenvironment{flipcompacteqlist}[1][0cm]{% |
| 351 |
\tpl@collect@body\@flipcompacteqlist}% |
| 352 |
{\global\@ignoretrue} |
| 353 |
}{} |
| 354 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 355 |
\newenvironment{flipcompactitem}[1][0cm]{% |
| 356 |
\tpl@addmargin{#1} |
| 357 |
\tpl@collect@body\@flipcompactitem}% |
| 358 |
{\global\@ignoretrue} |
| 359 |
\newenvironment{flipcompactenum}[1][0cm]{% |
| 360 |
\tpl@addmargin{#1} |
| 361 |
\tpl@collect@body\@flipcompactenum}% |
| 362 |
{\global\@ignoretrue} |
| 363 |
}{} |
| 364 |
|
| 365 |
\newcommand\@fliplist[2]{% |
| 366 |
\iftpl@indimenv |
| 367 |
\PackageError{tplists}{% |
| 368 |
dim* and flip* environments do NOT nest}{% |
| 369 |
Do not continue! Type 'q' to stop and fix the nested list. |
| 370 |
} |
| 371 |
\else\iftpl@instepenv |
| 372 |
\begin{#1} |
| 373 |
\let\hidestepcontents=\displaystepcontents |
| 374 |
\renewcommand{\item}{\tpl@flipstep\tpl@origitem}% |
| 375 |
#2 |
| 376 |
\end{#1}% |
| 377 |
\else |
| 378 |
\iftpl@inpausestepenv\let\liststepwise=\stepwise\fi |
| 379 |
\liststepwise[\let\hidestepcontents=\displaystepcontents]{% |
| 380 |
\begin{#1} |
| 381 |
\iftpl@inpausestepenv\else |
| 382 |
\iftpl@instepenv\else\let\tpl@origitem=\item\fi |
| 383 |
\fi |
| 384 |
\tpl@instepenvtrue |
| 385 |
\tpl@inflipenvtrue |
| 386 |
\renewcommand{\item}{\tpl@flipstep\tpl@origitem}% |
| 387 |
#2 |
| 388 |
\ifthenelse{\boolean{tpl@noflipendstep}}{}{\step{}}% |
| 389 |
\end{#1}} |
| 390 |
\fi\fi |
| 391 |
} |
| 392 |
|
| 393 |
\newcommand\@flipitem[1]{% |
| 394 |
\@fliplist{olditemize}{#1}} |
| 395 |
\newcommand\@flipdesc[1]{% |
| 396 |
\@fliplist{olddescription}{#1}} |
| 397 |
\newcommand\@flipenum[1]{% |
| 398 |
\@fliplist{oldenumerate}{#1}} |
| 399 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 400 |
\newcommand\@flipeqlist[1]{% |
| 401 |
\@fliplist{oldeqlist}{#1}} |
| 402 |
\newcommand\@flipcompacteqlist[1]{% |
| 403 |
\@fliplist{compacteqlist}{#1}} |
| 404 |
}{} |
| 405 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 406 |
\newcommand\@flipcompactitem[1]{% |
| 407 |
\@fliplist{oldcompactitem}{#1}} |
| 408 |
\newcommand\@flipcompactenum[1]{% |
| 409 |
\@fliplist{oldcompactenum}{#1}} |
| 410 |
}{} |
| 411 |
% \end{macrocode} |
| 412 |
% |
| 413 |
% Defining dimmed stepped - itemize / description / enumerate / eqlist / |
| 414 |
% compact itemize / compact enumerate / compact eqlist - environments. |
| 415 |
% \begin{macrocode} |
| 416 |
\newenvironment{dimitem}[1][0cm]{% |
| 417 |
\tpl@addmargin{#1} |
| 418 |
\tpl@collect@body\@dimitem}% |
| 419 |
{\global\@ignoretrue} |
| 420 |
\newenvironment{dimdesc}[1][0cm]{% |
| 421 |
\tpl@addmargin{#1} |
| 422 |
\tpl@collect@body\@dimdesc}% |
| 423 |
{\global\@ignoretrue} |
| 424 |
\newenvironment{dimenum}[1][0cm]{% |
| 425 |
\tpl@addmargin{#1} |
| 426 |
\tpl@collect@body\@dimenum}% |
| 427 |
{\global\@ignoretrue} |
| 428 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 429 |
\newenvironment{dimeqlist}[1][0cm]{% |
| 430 |
\tpl@collect@body\@dimeqlist}% |
| 431 |
{\global\@ignoretrue} |
| 432 |
\newenvironment{dimcompacteqlist}[1][0cm]{% |
| 433 |
\tpl@collect@body\@dimcompacteqlist}% |
| 434 |
{\global\@ignoretrue} |
| 435 |
}{} |
| 436 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 437 |
\newenvironment{dimcompactitem}[1][0cm]{% |
| 438 |
\tpl@addmargin{#1} |
| 439 |
\tpl@collect@body\@dimcompactitem}% |
| 440 |
{\global\@ignoretrue} |
| 441 |
\newenvironment{dimcompactenum}[1][0cm]{% |
| 442 |
\tpl@addmargin{#1} |
| 443 |
\tpl@collect@body\@dimcompactenum}% |
| 444 |
{\global\@ignoretrue} |
| 445 |
}{} |
| 446 |
|
| 447 |
\newcommand\@dimlist[2]{% |
| 448 |
\iftpl@inflipenv |
| 449 |
\PackageError{tplists}{% |
| 450 |
dim* and flip* environments do NOT nest}{% |
| 451 |
Do not continue! Type <q> to stop and fix the nested list. |
| 452 |
} |
| 453 |
\else\iftpl@instepenv |
| 454 |
\begin{#1} |
| 455 |
\renewcommand{\item}{\tpl@dimstep\tpl@origitem}% |
| 456 |
#2 |
| 457 |
\end{#1}% |
| 458 |
\else |
| 459 |
\iftpl@inpausestepenv\let\liststepwise=\stepwise\fi |
| 460 |
\liststepwise{% |
| 461 |
\begin{#1} |
| 462 |
\iftpl@inpausestepenv\else |
| 463 |
\iftpl@instepenv\else\let\tpl@origitem=\item\fi |
| 464 |
\fi |
| 465 |
\tpl@instepenvtrue |
| 466 |
\tpl@indimenvtrue |
| 467 |
\renewcommand{\item}{\tpl@dimstep\tpl@origitem}% |
| 468 |
#2 |
| 469 |
\end{#1}} |
| 470 |
\fi\fi |
| 471 |
} |
| 472 |
|
| 473 |
\newcommand\@dimitem[1]{% |
| 474 |
\@dimlist{olditemize}{#1}} |
| 475 |
\newcommand\@dimdesc[1]{% |
| 476 |
\@dimlist{olddescription}{#1}} |
| 477 |
\newcommand\@dimenum[1]{% |
| 478 |
\@dimlist{oldenumerate}{#1}} |
| 479 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 480 |
\newcommand\@dimeqlist[1]{% |
| 481 |
\@dimlist{oldeqlist}{#1}} |
| 482 |
\newcommand\@dimcompacteqlist[1]{% |
| 483 |
\@dimlist{compacteqlist}{#1}} |
| 484 |
}{} |
| 485 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 486 |
\newcommand\@dimcompactitem[1]{% |
| 487 |
\@dimlist{oldcompactitem}{#1}} |
| 488 |
\newcommand\@dimcompactenum[1]{% |
| 489 |
\@dimlist{oldcompactenum}{#1}} |
| 490 |
}{} |
| 491 |
% \end{macrocode} |
| 492 |
% |
| 493 |
% Defining stepped - itemize / description / enumerate / eqlist / |
| 494 |
% compact itemize / compact enumerate / compact eqlist - environments. |
| 495 |
% \begin{macrocode} |
| 496 |
\newenvironment{stepitem}[1][0cm]{% |
| 497 |
\tpl@addmargin{#1} |
| 498 |
\tpl@collect@body\@stepitem}% |
| 499 |
{\global\@ignoretrue} |
| 500 |
\newenvironment{stepdesc}[1][0cm]{% |
| 501 |
\tpl@addmargin{#1} |
| 502 |
\tpl@collect@body\@stepdesc}% |
| 503 |
{\global\@ignoretrue} |
| 504 |
\newenvironment{stepenum}[1][0cm]{% |
| 505 |
\tpl@addmargin{#1} |
| 506 |
\tpl@collect@body\@stepenum}% |
| 507 |
{\global\@ignoretrue} |
| 508 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 509 |
\newenvironment{stepeqlist}[1][0cm]{% |
| 510 |
\tpl@collect@body\@stepeqlist}% |
| 511 |
{\global\@ignoretrue} |
| 512 |
\newenvironment{stepcompacteqlist}[1][0cm]{% |
| 513 |
\tpl@collect@body\@stepcompacteqlist}% |
| 514 |
{\global\@ignoretrue} |
| 515 |
}{} |
| 516 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 517 |
\newenvironment{stepcompactitem}[1][0cm]{% |
| 518 |
\tpl@addmargin{#1} |
| 519 |
\tpl@collect@body\@stepcompactitem}% |
| 520 |
{\global\@ignoretrue} |
| 521 |
\newenvironment{stepcompactenum}[1][0cm]{% |
| 522 |
\tpl@addmargin{#1} |
| 523 |
\tpl@collect@body\@stepcompactenum}% |
| 524 |
{\global\@ignoretrue} |
| 525 |
}{} |
| 526 |
% \end{macrocode} |
| 527 |
% Using |\pause| for step* lists if |tpl@pausestep| is true |
| 528 |
% \begin{macrocode} |
| 529 |
\newcommand\@steplist[2]{% |
| 530 |
\ifthenelse{\boolean{tpl@pausestep}}{% |
| 531 |
\iftpl@inflipenv |
| 532 |
\PackageError{tplists}{% |
| 533 |
flip* followed by step* environment does NOT work \MessageBreak |
| 534 |
when the pausestep option is used}{% |
| 535 |
Do not continue! Type <q> to stop and fix the nested list. |
| 536 |
} |
| 537 |
\else\iftpl@indimenv |
| 538 |
\PackageError{tplists}{% |
| 539 |
dim* followed by step* environment does NOT work \MessageBreak |
| 540 |
when the pausestep option is used}{% |
| 541 |
Do not continue! Type <q> to stop and fix the nested list. |
| 542 |
} |
| 543 |
\else |
| 544 |
\begin{#1} |
| 545 |
\iftpl@inpausestepenv\else\let\tpl@origitem=\item\fi |
| 546 |
\tpl@inpausestepenvtrue |
| 547 |
\renewcommand{\item}{\pause\tpl@origitem}% |
| 548 |
#2 |
| 549 |
\end{#1} |
| 550 |
\fi\fi |
| 551 |
}{ |
| 552 |
% \end{macrocode} |
| 553 |
% Using |\liststepwise| for step* lists if |tpl@pausestep| is false |
| 554 |
% \begin{macrocode} |
| 555 |
\iftpl@inflipenv |
| 556 |
\begin{#1} |
| 557 |
\renewcommand{\item}{\tpl@flipstep\tpl@origitem} |
| 558 |
#2 |
| 559 |
\end{#1}% |
| 560 |
\else\iftpl@indimenv |
| 561 |
\begin{#1} |
| 562 |
\renewcommand{\item}{\dstep\tpl@origitem}% |
| 563 |
#2 |
| 564 |
\end{#1}% |
| 565 |
\else\iftpl@instepenv |
| 566 |
\begin{#1} |
| 567 |
\renewcommand{\item}{\tpl@step\tpl@origitem}% |
| 568 |
#2 |
| 569 |
\end{#1}% |
| 570 |
\else |
| 571 |
\liststepwise{% |
| 572 |
\begin{#1} |
| 573 |
\iftpl@instepenv\else\let\tpl@origitem=\item\fi |
| 574 |
\tpl@instepenvtrue |
| 575 |
\renewcommand{\item}{\tpl@step\tpl@origitem}% |
| 576 |
#2 |
| 577 |
\end{#1}} |
| 578 |
\fi\fi\fi |
| 579 |
} |
| 580 |
} |
| 581 |
|
| 582 |
\newcommand\@stepitem[1]{% |
| 583 |
\@steplist{olditemize}{#1}} |
| 584 |
\newcommand\@stepdesc[1]{% |
| 585 |
\@steplist{olddescription}{#1}} |
| 586 |
\newcommand\@stepenum[1]{% |
| 587 |
\@steplist{oldenumerate}{#1}} |
| 588 |
\ifthenelse{\boolean{tpl@eqlist}}{% |
| 589 |
\newcommand\@stepeqlist[1]{% |
| 590 |
\@steplist{oldeqlist}{#1}} |
| 591 |
\newcommand\@stepcompacteqlist[1]{% |
| 592 |
\@steplist{compacteqlist}{#1}} |
| 593 |
}{} |
| 594 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 595 |
\newcommand\@stepcompactitem[1]{% |
| 596 |
\@steplist{oldcompactitem}{#1}} |
| 597 |
\newcommand\@stepcompactenum[1]{% |
| 598 |
\@steplist{oldcompactenum}{#1}} |
| 599 |
}{} |
| 600 |
% \end{macrocode} |
| 601 |
% |
| 602 |
% Defining compact eqlist |
| 603 |
% \begin{macrocode} |
| 604 |
\newenvironment{compacteqlist}[1][0cm]{% |
| 605 |
% \tpl@addmargin{#1} |
| 606 |
\begin{eqlist}[\parsep0pt\itemsep0pt]}% |
| 607 |
{\end{eqlist}} |
| 608 |
% \end{macrocode} |
| 609 |
% |
| 610 |
% Redefining enumerate, itemize and description to handle changes made by |
| 611 |
% introducing steps and leftmargini-option. |
| 612 |
% \begin{macrocode} |
| 613 |
\renewenvironment{enumerate}[1][0cm]{% |
| 614 |
\tpl@addmargin{#1} |
| 615 |
\begin{oldenumerate} |
| 616 |
\iftpl@instepenv |
| 617 |
\renewcommand{\item}{\tpl@origitem}% |
| 618 |
\fi |
| 619 |
}% |
| 620 |
{\end{oldenumerate}} |
| 621 |
|
| 622 |
\renewenvironment{itemize}[1][0cm]{% |
| 623 |
\tpl@addmargin{#1} |
| 624 |
\begin{olditemize} |
| 625 |
\iftpl@instepenv |
| 626 |
\renewcommand{\item}{\tpl@origitem}% |
| 627 |
\fi |
| 628 |
}% |
| 629 |
{\end{olditemize}} |
| 630 |
|
| 631 |
\renewenvironment{description}[1][0cm]{% |
| 632 |
% \tpl@addmargin{#1} % Has no effect - FIXME |
| 633 |
\begin{olddescription} |
| 634 |
\iftpl@instepenv |
| 635 |
\renewcommand{\item}{\tpl@origitem}% |
| 636 |
\fi |
| 637 |
}% |
| 638 |
{\end{olddescription}} |
| 639 |
% \end{macrocode} |
| 640 |
% |
| 641 |
% Redefining compactenum and compactitem to handle changes made by |
| 642 |
% introducing steps and leftmargini-option. |
| 643 |
% \begin{macrocode} |
| 644 |
\ifthenelse{\boolean{tpl@paralist}}{% |
| 645 |
\renewenvironment{compactenum}[1][0cm]{% |
| 646 |
\tpl@addmargin{#1} |
| 647 |
\begin{oldcompactenum} |
| 648 |
\iftpl@instepenv |
| 649 |
\renewcommand{\item}{\tpl@origitem}% |
| 650 |
\fi |
| 651 |
}% |
| 652 |
{\end{oldcompactenum}} |
| 653 |
|
| 654 |
\renewenvironment{compactitem}[1][0cm]{% |
| 655 |
\tpl@addmargin{#1} |
| 656 |
\begin{oldcompactitem} |
| 657 |
\iftpl@instepenv |
| 658 |
\renewcommand{\item}{\tpl@origitem}% |
| 659 |
\fi |
| 660 |
}% |
| 661 |
{\end{oldcompactitem}} |
| 662 |
}{} |
| 663 |
% \end{macrocode} |
| 664 |
|
| 665 |
% \Finale |
| 666 |
\endinput |