summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/source/latex/texpower/Makefile59
-rw-r--r--Master/texmf-dist/source/latex/texpower/powersem.dtx411
-rw-r--r--Master/texmf-dist/source/latex/texpower/texpower-addons.dtx1821
-rw-r--r--Master/texmf-dist/source/latex/texpower/texpower-cfg.dtx422
-rw-r--r--Master/texmf-dist/source/latex/texpower/texpower-doc.dtx7653
-rw-r--r--Master/texmf-dist/source/latex/texpower/texpower.dtx5350
-rw-r--r--Master/texmf-dist/source/latex/texpower/tpbundle.ins127
7 files changed, 15843 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/texpower/Makefile b/Master/texmf-dist/source/latex/texpower/Makefile
new file mode 100644
index 00000000000..2090f272cac
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/Makefile
@@ -0,0 +1,59 @@
+RM=rm -f
+SHELL=sh
+VERSION=0.1b
+JUNKS=*.aux *.toc *.idx *.glo *.dvi *.log *.lof *.ist *.ilg *.ind *.gls *.out *.tmp *~
+
+help:
+ @echo '**********************************************'
+ @echo ' The following targets exist: '
+ @echo ' - all: All targets below '
+ @echo ' - unpack: Unpacks the bundle '
+ @echo ' - pack: Packs the bundle '
+ @echo ' - manual: Builds the user docs '
+ @echo ' - doc: Builds texpower package docs '
+ @echo ' - doc-powersem: Builds powersem class docs '
+ @echo ' - clean: Remove all generate/junk files '
+ @echo '**********************************************'
+
+unpack:
+ latex tpbundle.ins
+ @echo '**********************************************'
+ @echo ' To make texpower bundle user documentation, '
+ @echo ' % make manual '
+ @echo ' To make texpower package implementation docs '
+ @echo ' % make doc '
+ @echo ' To make powersem class implementation docs '
+ @echo ' % make doc-powersem '
+ @echo '**********************************************'
+
+all: unpack doc doc-powersem manual
+
+manual.tex: unpack
+
+doc: texpower.dtx
+ pdflatex texpower.dtx
+ pdflatex texpower.dtx
+ makeindex -s gglo.ist -o texpower.gls texpower.glo
+ makeindex -s gind.ist -o texpower.ind texpower.idx
+ pdflatex texpower.dtx
+
+doc-powersem:
+ pdflatex powersem.dtx
+ pdflatex powersem.dtx
+ makeindex -s gglo.ist -o powersem.gls powersem.glo
+ makeindex -s gind.ist -o powersem.ind powersem.idx
+ pdflatex powersem.dtx
+
+manual: manual.tex
+ pdflatex manual.tex
+ pdflatex manual.tex
+ makeindex -o manual.ind manual.idx
+ pdflatex manual.tex
+
+pack: clean
+ -(cd ..; cp -r dtx-real texpower-$(VERSION); \
+ tar cvfz texpower-$(VERSION).tgz texpower-$(VERSION))
+
+clean:
+ @$(RM) $(JUNKS) *.cls *.sty *.cfg *.tex *.mps
+ @echo The current directory has been cleaned up.
diff --git a/Master/texmf-dist/source/latex/texpower/powersem.dtx b/Master/texmf-dist/source/latex/texpower/powersem.dtx
new file mode 100644
index 00000000000..a1283eca455
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/powersem.dtx
@@ -0,0 +1,411 @@
+% \iffalse meta-comment
+% --------------------------------------------------------------
+% TeXPower bundle - dynamic online presentations with LaTeX
+% Copyright (C) 1999-2004 Stephan Lehmke
+%
+% 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.
+% --------------------------------------------------------------
+%
+% powersem.dtx,v 1.2 2004/07/27 12:09:32 hansfn Exp
+%
+% \fi
+%
+% \iffalse
+%<*driver>
+\ProvidesFile{powersem.dtx}
+%</driver>
+%<powersem>\NeedsTeXFormat{LaTeX2e}
+%<powersem>\ProvidesClass{powersem}
+%<*powersem>
+ [2004/07/27 v0.8a Create online Presentations with seminar.]
+%</powersem>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+ \DocInput{powersem.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \CheckSum{366}
+%
+% \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{powersem.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment}
+%
+% \title{The \textsf{powersem} class\thanks{This document
+% corresponds to \textsf{powersem}~\fileversion, dated \filedate.}}
+% \author{ Stephan Lehmke \\ \texttt{Stephan.Lehmke@cs.uni-dortmund.de}}
+%
+% \maketitle
+%
+% \tableofcontents
+%
+% \section{Introduction}
+%
+% The user documentation is found in \texttt{manual.tex} and the FAQ.
+% Only the implementation documentation is covered in this document.
+%
+% Make seminar ready for the Third Millennium ;-)
+% This class loads seminar and tries to fix some problems which occur when trying to create dynamic presentations with
+% the texpower package.
+%
+% Some new features helpful for dynamic presentations are also added.
+%
+% This class is part of the TeXPower bundle, to be found at\\ % |http://texpower.sourceforge.net/|
+%
+% The TeXPower bundle also contains a package \texttt{fixseminar.sty} which applies some more fixes, in particular for
+% hyperref. These can not be applied here because they have to be made after hyperref is loaded.
+%
+% \StopEventually{\PrintChanges\PrintIndex}
+%
+% \section{Implementation}
+%
+% \changes{v0.1}{1999/10/18}{First version. So far it doesn't do much more than load seminar.}
+%
+% \changes{v0.2}{2000/03/28}{Force seminar to treat \cs{paperwidth} and \cs{paperheight} in a
+% sensible manner.}
+%
+% \changes{v0.3}{2000/05/10}{Added option `calcdimensions'.}
+%
+% \changes{v0.4}{2000/06/16}{Now separates text from footnotes when option `display' is given.}
+%
+% \changes{v0.5}{2000/06/26}{\cs{@colht} is ignored by seminar, which is bad. Added a patch to
+% \cs{set@slidesize}. calcdimensions now handles slide frames.}
+%
+% \changes{v0.5a}{2000/07/03}{The footnote patch with option display effectively disabled setting
+% \cs{centerslidestrue}. Fixed.}
+%
+% \changes{v0.6}{2001/11/10}{seminar's \cs{output@slide} kernel copied (from seminar.bg2) and
+% modified for better color handling and to remove some overfull \cs{vbox} warnings. There was
+% another underfull vbox warning lurking in the footnote patch. Removed. New option truepagenumbers
+% for cooperation with texpower in case `fragmented' slide numbers (like 3.5.1) are used. Make
+% seminar's form of raggedright lines (controlled by \cs{raggedslides}) active in parboxes and
+% minipages (and p columns in tables or arrays).}
+%
+% \changes{v0.7}{2002/11/22}{Inserted \cs{nointerlineskip} in page building code to heal a slight
+% problem with vertical spacing. A small modification was neccessary wrt the KOMA option because
+% with fixseminar v0.0.4, pdflatex slides can now be rotated.}
+%
+% \changes{v0.8}{2003/05/06}{Some fixes provided by Pascal Kockaert to (hopefully) get better
+% behaviour with seminar's ``article'' option - many thanks!}
+%
+% \changes{v0.8a}{2004/07/27}{Moved to dtx format. No other code changes.}
+%
+% \begin{macrocode}
+\RequirePackage{ifthen}
+% \end{macrocode}
+%
+% The display option is understood by all relevant classes and packages from the TeXPower bundle. It means that
+% `dynamic' features are to be turned on.
+% There is a boolean register display (as defined in ifthen.sty) which is set by this option and can be used to
+% differentiate between slides for display and slides for printout.
+% Notes are disabled automatically.
+% \begin{macrocode}
+\newboolean{display}
+\DeclareOption{display}
+{\setboolean{display}{true}\PassOptionsToClass{slidesonly}{seminar}}
+% \end{macrocode}
+%
+% The truepagenumbers option makes powersem count pages with the counter page, independently of the counter slide. This
+% enables proper working of TeXPowers navigation buttons (some of which calculate relative page numbers) even when the
+% counter slide is reset frequently (for slide numberings of the type |<l>.<n>.<m>|).
+% \begin{macrocode}
+\newboolean{truepn@PS}
+\DeclareOption{truepagenumbers}{\setboolean{truepn@PS}{true}}
+% \end{macrocode}
+%
+% The KOMA option tells powersem to load scrartcl (from the KOMA suite of document classes) instead of article.
+% \begin{macrocode}
+\newboolean{BaseClass@PS}
+\DeclareOption{KOMA}
+{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{scrartcl}}
+% \end{macrocode}
+%
+% The UseBaseClass option is more neutral: It tells powersem to load the class |\baseclass| (initially article) instead of
+% article.
+% \begin{macrocode}
+\DeclareOption{UseBaseClass}
+{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{article}}
+% \end{macrocode}
+%
+% The reportclass option tells powersem to load the class |\baseclass| (initially report) instead of
+% article.
+% \begin{macrocode}
+\DeclareOption{reportclass}
+{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{report}}
+% \end{macrocode}
+%
+% The bookclass option tells powersem to load the class |\baseclass| (initially report) instead of
+% article.
+% \begin{macrocode}
+\DeclareOption{bookclass}
+{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{book}}
+% \end{macrocode}
+%
+% We need to redefine the a4paper option which is broken in seminar.cls
+% \begin{macrocode}
+\DeclareOption{a4paper}{\PassOptionsToClass{a4}{seminar}}
+% \end{macrocode}
+%
+% The calcdimensions option tells powersem to automatically calculate slidewidth and slideheight from paper dimensions
+% and margins.
+% \begin{macrocode}
+\newboolean{calcdim@PS}
+\DeclareOption{calcdimensions}{\setboolean{calcdim@PS}{true}}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}}
+
+\ProcessOptions
+% \end{macrocode}
+%
+% Now we need to hack a little to make seminar load |\baseclass| instead of article (if one of the respectice options was
+% given).
+% \begin{macrocode}
+\let\oldLC@PS=\LoadClass
+
+\ifthenelse{\boolean{BaseClass@PS}}
+{%
+ \def\article@PS{article}
+% \end{macrocode}
+% Make |\PassOptionsToClass| and |\LoadClass| use |\baseclass|...
+% \begin{macrocode}
+ \let\oldPOTC@PS=\PassOptionsToClass
+ \def\PassOptionsToClass#1#2%
+ {\edef\cls@PS{#2}%
+ \ifx\article@PS\cls@PS\oldPOTC@PS{#1}{\baseclass}%
+ \else\oldPOTC@PS{#1}{#2}%
+ \fi}
+% \end{macrocode}
+% Furthermore, seminar redefines |\paperheight| and |\paperwidth|, saving their value in |\sem@paperheight| and
+% |\sem@paperwidth|. We undo this so the paper dimension calculation of typearea can be used.
+% \begin{macrocode}
+ \renewcommand{\LoadClass}[2][]%
+ {%
+ \edef\cls@PS{#2}%
+ \ifx\article@PS\cls@PS
+ \let\paperheight\sem@paperheight\let\paperwidth\sem@paperwidth
+ \oldLC@PS[#1]{\baseclass}%
+ \ifarticle\else\portraittrue\fi
+ \else
+ \oldLC@PS[#1]{#2}%
+ \fi
+ }%
+}
+{}
+% \end{macrocode}
+%
+% Finally, the seminar class and some bug fixes are loaded.
+% \begin{macrocode}
+\oldLC@PS{seminar}
+
+\AtBeginDocument
+{%
+\input{seminar.bug}%
+\input{seminar.bg2}%
+}
+
+\expandafter\def\expandafter\set@slidesize\expandafter
+{\set@slidesize\@colht\vsize}
+
+\g@addto@macro\@arrayparboxrestore\slide@rightskip
+
+\ifthenelse{\boolean{truepn@PS}}{\truepagenumbers}{}
+
+\AtBeginDocument{%
+\ifthenelse{\boolean{BaseClass@PS}}{\sliderotation{none}}{}}
+% \end{macrocode}
+%
+% Make some changes in the seminar kernel to hopefully get better handling of text colors and avoid overfull box
+% warnings when |\slidetopmargin| and |\slidebottommargin| are set too small.
+% \begin{macrocode}
+\AtBeginDocument{%
+\ifarticle
+\else
+ \def\output@slide{%
+ \begingroup
+ \hoffset=-\inverseslidesmag in
+ \voffset=-\inverseslidesmag in
+ \setslidelength\@tempdima{%
+ \ifportrait\paperwidth\else\paperheight\fi}%
+ \setslidelength\@tempdimb{%
+ \ifportrait\paperheight\else\paperwidth\fi}%
+ \ifrotateheaders
+ \@ifrotateslide{%
+ \dimen@=\@tempdima
+ \@tempdima=\@tempdimb
+ \@tempdimb=\dimen@}%
+ \fi
+ % \oddsidemargin, \evensidemargin, \headheight, \footheight
+ % used for scratch:
+ \setslidelength\headheight\slidetopmargin
+ \setslidelength\footheight\slidebottommargin
+ \ifautoslidemargins
+ \textwidth=\wd\@slidebox
+ \oddsidemargin=\@tempdima
+ \advance\oddsidemargin-\textwidth
+ \divide\oddsidemargin 2
+ \else
+ \setslidelength\oddsidemargin\slideleftmargin
+ \setslidelength\evensidemargin\sliderightmargin
+ \textwidth=\@tempdima
+ \advance\textwidth-\oddsidemargin
+ \advance\textwidth-\evensidemargin
+ \fi
+ \setbox\@slidebox=\hbox to \@tempdima{{%
+% \end{macrocode}
+% All double \{\{ around box contents added for better color handling (STL).
+% \begin{macrocode}
+ %
+ \kern\oddsidemargin
+ \vbox to\@tempdimb{{%
+ \ifnum\fancyput@flag>-1
+ \hbox{\kern-\oddsidemargin\do@fancyput}%
+ \fi
+ \let\label\@gobble
+ \let\index\@gobble
+ \let\glossary\@gobble
+ \vbox to\headheight{{%
+ \vfill
+ \color@hbox
+ \normalcolor
+ \slideheadfont\relax%\strut Removed (STL)
+ \hb@xt@\textwidth{\@oddhead}%
+ \color@endbox
+ \kern\z@}}%
+ \nointerlineskip
+ \vss
+ \hbox to\textwidth{{\hss\box\@slidebox\hss}}%
+ \vss
+ \nointerlineskip
+ \vbox to\footheight{{%
+ \vfill
+ \color@hbox
+ \normalcolor
+ \slidefootfont\relax%\strut Removed (STL)
+ \hb@xt@\textwidth{\@oddfoot}%
+ \color@endbox
+ \vfill}}%
+ }}\hss}}%
+ \ifrotateheaders\@ifrotateslide\rotate@slide\fi
+ \insert@specials
+ \shipout\box\@slidebox
+ \endgroup
+ \let\firstmark\botmark
+ \ifthenelse{\boolean{truepn@PS}}{\stepcounter{page}}{}%
+% \end{macrocode}
+% The above will seriously upset notes! (STL)
+% \begin{macrocode}
+ }%
+ \@ifundefined{fancyput@flag}{\def\fancyput@flag{-1}}{}%
+\fi
+}
+% \end{macrocode}
+%
+% When producing slides to be displayed interactively, we must make absolutely sure that interactive building of slides
+% doesn't move text which has already been set. So slides are not to be centered.
+% \begin{macrocode}
+\ifthenelse{\boolean{display}}
+{%
+ \centerslidesfalse
+ \extraslideheight{0pt}%
+ \renewcommand{\slideshrink}{0}%
+ \def\@makeslide{%
+ \ifcenterslides
+ \setbox\@slidebox\vbox{{%
+ \@begindvi % added 1997/04/15 SPQR
+ \unvbox\@cclv
+ \ifvoid\slide@footins\else
+ \vskip\skip\slide@footins
+ \footnoterule
+ \unvbox\slide@footins
+ \fi
+ \vskip\z@}}
+ \else
+ \setbox\@slidebox\vbox to \slide@vsize{{%
+ \@begindvi % added 1997/04/15 SPQR
+ \unvbox\@cclv
+ \ifvoid\slide@footins\vfil\else
+ \vfil\vskip\skip\slide@footins
+ \footnoterule
+ \unvbox\slide@footins
+ \fi
+ \vskip\z@}}%
+ \fi
+ }%
+ }
+{}
+% \end{macrocode}
+%
+% If powersem is asked to calculate the slide dimensions...
+% \begin{macrocode}
+\def\relax@PS{\relax}
+
+\ifthenelse{\boolean{calcdim@PS}}
+{%
+ \AtBeginDocument
+ {%
+ \setlength{\slidewidth}{\paperwidth}%
+ \advance\slidewidth by -\slideleftmargin\relax
+ \advance\slidewidth by -\sliderightmargin\relax
+ \ifx\theslideframe\relax@PS
+ \else
+ \advance\slidewidth by -2\slideframewidth\relax
+ \advance\slidewidth by -2\slideframesep\relax
+ \fi
+ \setlength{\slideheight}{\paperheight}%
+ \advance\slideheight by -\slidetopmargin\relax
+ \advance\slideheight by -\slidebottommargin\relax
+ \ifx\theslideframe\relax@PS
+ \else
+ \advance\slideheight by -2\slideframewidth\relax
+ \advance\slideheight by -2\slideframesep\relax
+ \fi
+ }%
+ }
+{}
+
+\AtBeginDocument
+{%
+ \@ifundefined{headwidth}{}
+ {%
+ \setslidelength{\headwidth}{\paperwidth}%
+ \addtoslidelength{\headwidth}{-\slideleftmargin}%
+ \addtoslidelength{\headwidth}{-\sliderightmargin}%
+ }%
+}
+% \end{macrocode}
+% \Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/texpower/texpower-addons.dtx b/Master/texmf-dist/source/latex/texpower/texpower-addons.dtx
new file mode 100644
index 00000000000..56f04d69829
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/texpower-addons.dtx
@@ -0,0 +1,1821 @@
+% \iffalse meta-comment
+% --------------------------------------------------------------
+% TeXPower bundle - dynamic online presentations with LaTeX
+% Copyright (C) 1999-2004 Stephan Lehmke
+%
+% 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.
+% --------------------------------------------------------------
+%
+% texpower-addons.dtx,v 1.2 2004/07/27 11:39:45 hansfn Exp
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\documentclass{article}
+\begin{document}
+\typeout{***********************************************************}
+\typeout{*}
+\typeout{*\space\space\space\space\space\space\space Do NOT compile this dtx file!}
+\typeout{*}
+\typeout{***********************************************************}
+\end{document}
+%</driver>
+%
+% \fi
+%
+%<*automata>
+%<<KEEPCOMMENTS
+%=======================================================================================================================
+% File: automata.sty
+%
+% Draw and animate `automata' as used in theoretical computer science, using PSTricks and TeXPower.
+%
+% This package is an addition to the TeXPower bundle, to be found at
+%
+% http://texpower.sourceforge.net/
+%
+%=======================================================================================================================
+% Author: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.2 Oct 05, 2001 First version for the pre-alpha release of texpower.
+% Only deterministic FA and Mealy Automata yet.
+%
+
+\NeedsTeXFormat{LaTeX2e}
+
+\ProvidesPackage%
+{automata}%
+[2001/10/05 v0.2 Draw and animate automata.]
+
+
+%=======================================================================================================================
+
+\RequirePackage{ifthen}
+
+\RequirePackage{relsize}
+
+\RequirePackage{texpower}
+
+\ifthenelse{\boolean{psspecialsallowed}}{\RequirePackage{tppstcol}}{}
+
+
+%=======================================================================================================================
+% Implementation of the functionality.
+
+%-----------------------------------------------------------------------------------------------------------------------
+% Some definitions of general interest.
+
+\defineTPcolor{automatoncolor}{gray}{0.8}
+\defineTPcolor{autoplatecolor}{gray}{0.95}
+\defineTPcolor{currstatecolor}{rgb}{0.8,1,0.8}
+\colorbetween{markstatecolor@TPATM}{pagecolor}{currstatecolor}
+\replacecolor{cellcolor}{white}
+
+
+
+\newlength{\tapepos@TPATM}
+
+\newcounter{tapecells@TPATM}
+\newcounter{inputlength@TPATM}
+\newcounter{states@TPATM}
+\newcounter{currstate@TPATM}
+\newcounter{nextstate@TPATM}
+\newcounter{currinputsymbol@TPATM}
+\newcounter{currtapepos@TPATM}
+
+\newtoks\tabrows@TPATM
+\newtoks\tabdecl@TPATM
+
+\newsavebox{\tabbox@TPATM}
+
+\newboolean{stategraph@TPATM}
+
+\newif\iffliplabel@TPATM
+
+\newcommand{\formatsymbol}[1]{\texttt{#1}}
+
+
+%-----------------------------------------------------------------------------------------------------------------------
+% Helper macros.
+
+% Make a fixed point number have exactly five decimal places, either by truncating or by filling up with trailing
+% zeroes.
+\newcommand{\filltofive@TPATM}[1]{\expandafter\@filltofive@TPATM#1000000\@nil#1}
+
+\def\@filltofive@TPATM#1.#2#3#4#5#6#7\@nil#8{\def#8{#1.#2#3#4#5#6}}
+
+
+% Count the number of items in a comma-separated list.
+\newcommand{\countsymbols@TPATM}[2]{\setcounter{#2}{1}\@countsymbols@TPATM#1,\@nil{#2}}
+
+\def\@countsymbols@TPATM#1,#2\@nil#3{\ifthenelse{\equal{#2}{}}{}{\stepcounter{#3}\@countsymbols@TPATM#2\@nil{#3}}}
+
+
+
+% Get a symbol from a (macro containing a) comma-separated list.
+\newcommand{\getsymbol@TPATM}[2]
+{%
+ \expandafter\@getsymbol@TPATM#1\@nil{#1}{#2}%
+}
+
+\def\@getsymbol@TPATM#1,#2\@nil#3#4{\gdef#3{#2}\@@getsymbol@TPATM#1\@nil{#4}}
+
+\def\@@getsymbol@TPATM{\@ifnextchar({\@@@getsymbol@TPATM}{\@@@getsymbol@TPATM()}}
+
+\def\@@@getsymbol@TPATM(#1)#2\@nil#3{\def\statepos@TPATM{#1}\def#3{#2}}
+
+
+% Get a state from a (macro containing a) comma-separated list of states and check whether it's accepting.
+
+\newif\ifacceptingstate@TPATM
+
+\newcommand{\getstate@TPATM}[4]{\expandafter\@getstate@TPATM#1\@nil{#1}{#2}{#3}{#4}}
+
+\def\@getstate@TPATM#1,#2\@nil#3#4#5#6{\gdef#3{#2}\@@getstate@TPATM#1\@nil{#4}{#5}{#6}}
+
+\def\@@getstate@TPATM{\@ifnextchar({\@@@getstate@TPATM}{\@@@getstate@TPATM()}}
+
+\def\@@@getstate@TPATM(#1)#2#3\@nil#4#5#6%
+{%
+ \def\statepos@TPATM{#1}%
+ \def#6{#2#3}%
+ \ifx\accept#2%
+ \acceptingstate@TPATMtrue%
+ \def#5{#4}%
+ \else
+ \acceptingstate@TPATMfalse%
+ \let#5\empty
+ \fi
+ }
+
+% Get a state transition from a (macro containing a) comma-separated list of states.
+\newcommand{\getdeltapair@TPATM}[3]
+{%
+ \expandafter\@getdeltapair@TPATM#1\@nil{#1}{#2}{#3}%
+}
+
+\def\@getdeltapair@TPATM{\@ifnextchar[{\@@getdeltapair@TPATM}{\@@getdeltapair@TPATM[\@nil]}}
+
+\def\@@getdeltapair@TPATM[#1]%
+{%
+ \def\optarg@TPATM{#1}%
+ \@ifstar{\let\fliplabel@TPATM=\fliplabel@TPATMtrue\@@@getdeltapair@TPATM}
+ {\let\fliplabel@TPATM=\fliplabel@TPATMfalse\@@@getdeltapair@TPATM}%
+ }
+
+\def\@@@getdeltapair@TPATM{\@ifnextchar({\@@@@getdeltapair@TPATM}{\@@@@getdeltapair@TPATM(.5)}}
+
+\def\@@@@getdeltapair@TPATM(#1)%
+{%
+ \def\labelpos@TPATM{#1}%
+ \@ifnextchar[{\@@@@@getdeltapair@TPATM}{\@@@@@getdeltapair@TPATM[\@nil]}%
+ }
+
+\def\@@@@@getdeltapair@TPATM[#1]#2->#3,#4\@nil#5#6#7{\def\labelopt@TPATM{#1}\protected@edef#6{#2}\protected@edef#7{#3}\gdef#5{#4}}
+
+% Decompose a comma-separated pair (without parentheses) into its components.
+\def\decomposestpos@TPATM#1,#2\@nil#3#4{\def#3{#1}\def#4{#2}}
+
+% Remove trailing comma from a comma-separated list.
+\def\gobblelastcomma@TPATM#1,\@nil#2{\gdef#2{#1}}
+
+% A first step towards internationalization - german only at the moment.
+\newcommand{\automatonname}{Automatenmodell}
+\newcommand{\inputname}{Eingabe}
+\newcommand{\inputtapename}{Eingabeband}
+\newcommand{\outputname}{Ausgabe}
+\newcommand{\outputtapename}{Ausgabeband}
+\newcommand{\acceptname}{Akzeptieren}
+\newcommand{\statename}{Zustand}
+\newcommand{\statesname}{Zust"ande}
+\newcommand{\statetransname}{Zustands"uberg"ange}
+\newcommand{\nextstatename}{Folgezust.}
+
+\newcommand{\statetransitiontablepreamble}{}
+
+\newcommand{\transitionarrayparameters}
+{%
+ \renewcommand{\arraystretch}{.3}%
+ \setlength{\extrarowheight}{16pt}%
+ \setlength{\tabcolsep}{.5pt}%
+}
+
+\let\accept\empty
+\let\comma\empty
+
+
+%-----------------------------------------------------------------------------------------------------------------------
+% Finite Automata.
+
+% Generic macros for drawing deterministic finite automata. The difference between simple dfa and mealy automata is made
+% by setting parameters.
+
+\def\finalisetabrows@TPATM#1\\\@nil#2{#2={#1\end{tabular}}}%
+
+\newcommand{\draw@outputtape@TPATM}[1]{}%
+\newcommand{\getoutput@TPATM}[2]{}
+\newcommand{\inittabrows@TPATM}[1]{}
+\newcommand{\addtabrow@TPATM}[2]{}
+\newcommand{\label@output@TPATM}{}%
+\newcommand{\fix@nextstate@TPATM}{}
+\newcommand{\mk@new@outputtape@TPATM}[1]{}%
+
+
+
+\newcommand{\genericdfa@TPATM}[8]
+{%
+ \begin{pspicture}(1,1)
+ % Draw automaton body.
+ \psframe[fillstyle=solid,fillcolor=automatoncolor](0.05,0)(0.95,1)
+ \rput[b]{90}(0.05,0.5){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\automatonname}}%
+ % Draw input tape.
+ \rput[l](0.07,0.93){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\inputtapename}}%
+ \setlength{\tapepos@TPATM}{0.55pt-0.1pt*\real{#6}}%
+ \setcounter{currinputsymbol@TPATM}{1*\real{#6}}%
+ \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM}{1pt}}%
+ \setcounter{tapecells@TPATM}{6+\value{currinputsymbol@TPATM}}%
+ \countsymbols@TPATM{#5}{inputlength@TPATM}%
+ \ifthenelse{\value{tapecells@TPATM}>\value{inputlength@TPATM}}
+ {\setcounter{tapecells@TPATM}{\value{inputlength@TPATM}}}
+ {}%
+ \multips(\startx@TPATM,0.88)(0.1,0){\value{tapecells@TPATM}}{\psframe[fillstyle=solid,fillcolor=cellcolor](0.1,0.1)}%
+ \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM+0.05pt}{1pt}}%
+ \filltofive@TPATM{\startx@TPATM}%
+ \protected@edef\tapecontents@TPATM{#5,}%
+ \setcounter{currtapepos@TPATM}{0}%
+ \let\inputtapesymbol@TPATM\relax
+ \let\nextinputtapesymbol@TPATM\relax
+ \multido{\n=\startx@TPATM+0.10000}{\value{tapecells@TPATM}}
+ {%
+ \getsymbol@TPATM\tapecontents@TPATM\inputtapesymbol@TPATM
+ \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}\relax
+ \global\let\nextinputtapesymbol@TPATM\inputtapesymbol@TPATM
+ \fi
+ \stepcounter{currtapepos@TPATM}%
+ \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}\relax
+ \global\let\inputtapesymbol@TPATM\inputtapesymbol@TPATM
+ \fi
+ \rput(\n,0.93){\formatsymbol\inputtapesymbol@TPATM}%
+ }%
+ \psframe[linewidth=2pt,linecolor=conceptcolor](0.45,0.88)(0.55,0.98)
+ % Draw state transitions
+ \countsymbols@TPATM{#1}{states@TPATM}%
+ \mkfactor{\tapeadvancement@TPATM}{\real{#6}-\value{currinputsymbol@TPATM}pt}%
+ \def\defdelta@TPATM{#3,}%
+ \whiledo{\not\equal{\defdelta@TPATM}{}}
+ {%
+ \getdeltapair@TPATM\defdelta@TPATM\domainvalue@TPATM\rangevalue@TPATM
+ \expandafter\def\csname delta(\domainvalue@TPATM)@TPATM\expandafter\endcsname\expandafter{\rangevalue@TPATM}%
+ \expandafter\let\csname deltaopt(\domainvalue@TPATM)@TPATM\endcsname=\optarg@TPATM
+ \expandafter\let\csname deltalabelpos(\domainvalue@TPATM)@TPATM\endcsname=\labelpos@TPATM
+ \expandafter\let\csname deltalabelopt(\domainvalue@TPATM)@TPATM\endcsname=\labelopt@TPATM
+ \expandafter\let\csname deltaflag(\domainvalue@TPATM)@TPATM\endcsname=\empty
+ \expandafter\let\csname deltafliplabel(\domainvalue@TPATM)@TPATM\endcsname=\fliplabel@TPATM
+ }%
+ \ifthenelse{\boolean{stategraph@TPATM}}% Draw state transition diagram?
+ {% Yes.
+ \ifthenelse{\lengthtest{\tapeadvancement@TPATM pt=0pt}}
+ {%
+ \let\nextinputtapesymbol@TPATM\inputtapesymbol@TPATM
+ \ifthenelse{\value{nextstate@TPATM}>-1}{\def\tapeadvancement@TPATM{1}}{}%
+ }{}%
+ \colorbetween[\tapeadvancement@TPATM]{activetranscolor@TPATM}{currstatecolor}{pagecolor}%
+ \rput(0.5,0.5)
+ {%
+ \begingroup
+ % Make `subpicture' containing the state transition diagram.
+ \psset{xunit=.43\psxunit,yunit=.36\psyunit,labelsep=1pt}%
+ \begin{pspicture}(0,0)
+ \psframe[fillstyle=solid,fillcolor=cellcolor,dimen=inner](-1,-1)(1,1)
+ \rput[lt](-1,1){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\statetransname}}%
+ % First, the nodes representing states.
+ \mkfactor{\statedistance@TPATM}{2/\value{states@TPATM}}%
+ \mkfactor\startx@TPATM{-1+\statedistance@TPATM pt/2}%
+ \def\states@TPATM{#1,}%
+ \setcounter{currstate@TPATM}{0}%
+ \multido{\n=\startx@TPATM+\statedistance@TPATM}{\value{states@TPATM}}
+ {%
+ \stepcounter{currstate@TPATM}%
+ \getstate@TPATM{\states@TPATM}{,linewidth=2pt,linecolor=red}{\statetype@TPATM}{\state@TPATM}%
+ \ifnum\value{currstate@TPATM}=#7\relax
+ \ifacceptingstate@TPATM\global\acceptingstate@TPATMtrue\else\global\acceptingstate@TPATMfalse\fi
+ \fi
+ \edef\next
+ {%
+ \noexpand
+ \cnode
+ [%
+ fillstyle=solid,%
+ fillcolor=\ifnum\value{currstate@TPATM}=#7currstatecolor\else cellcolor\fi\statetype@TPATM
+ ]%
+ (\ifx\statepos@TPATM\empty\n,0\else\statepos@TPATM\fi)%
+ }%
+ \next{.4}{{state\state@TPATM}}%
+ \rput(\ifx\statepos@TPATM\empty\n,0\else\statepos@TPATM\fi){\let\comma,\state@TPATM}%
+ \ifthenelse{\value{currstate@TPATM}=#4}
+ {%
+ \ifx\statepos@TPATM\empty
+ \mkfactor{\stxpos@TPATM}{\real{\n}-.2pt}%
+ \def\stypos@TPATM{0}%
+ \else
+ \expandafter\decomposestpos@TPATM\statepos@TPATM\@nil{\stxpos@TPATM}{\stypos@TPATM}%
+ \mkfactor{\stxpos@TPATM}{\real{\stxpos@TPATM}-.2pt}%
+ \fi
+ \pnode(\stxpos@TPATM,\stypos@TPATM){start}%
+ \ncline{->}{start}{state\state@TPATM}%
+ }{}%
+ }%
+ % Next, the node connections.
+ \setcounter{currstate@TPATM}{0}%
+ \def\states@TPATM{#1,}%
+ \whiledo{\not\equal{\states@TPATM}{}}
+ {%
+ \stepcounter{currstate@TPATM}%
+ \getsymbol@TPATM\states@TPATM\state@TPATM
+ \protected@edef\state@TPATM{\state@TPATM}%
+ \def\inputalphabet@TPATM{#2,}%
+ \whiledo{\not\equal{\inputalphabet@TPATM}{}}
+ {%
+ \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM
+ \getoutput@TPATM\state@TPATM\inputsymbol@TPATM
+ \ifthenelse{\equal{\csname deltaflag(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname}{}}
+ {%
+ \let\currentnstate@TPATM=\nstate@TPATM
+ \let\currentia@TPATM=\inputalphabet@TPATM
+ \inittabrows@TPATM\tabrows@TPATM
+ \def\arrowparams@TPATM{border=1pt}%
+ \begingroup
+ \def\inputalphabet@TPATM{#2,}%
+ \whiledo{\not\equal{\inputalphabet@TPATM}{}}
+ {%
+ \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM
+ \getoutput@TPATM\state@TPATM\inputsymbol@TPATM
+ \ifx\currentnstate@TPATM\nstate@TPATM
+ \expandafter\global\expandafter\let
+ \csname deltaflag(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname=\relax
+ \ifthenelse
+ {%
+ \value{currstate@TPATM}=#7%
+ \and\equal\inputsymbol@TPATM\nextinputtapesymbol@TPATM
+ \and\lengthtest{\tapeadvancement@TPATM pt>0pt}%
+ }
+ {%
+ \xdef\arrowparams@TPATM
+ {%
+ doubleline=true,doublecolor=activetranscolor@TPATM,doublesep=\tapeadvancement@TPATM pt,%
+ arrowsize=1pt 1.5,border=1pt%
+ }%
+ \def\@hlinput@TPATM{\noexpand\rowcolor{activetranscolor@TPATM}}%
+ }
+ {\let\@hlinput@TPATM=\empty}%
+ \addtabrow@TPATM\tabrows@TPATM{\inputsymbol@TPATM}%
+ \ifnum\value{currstate@TPATM}=#7\relax
+ \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM
+ \fix@nextstate@TPATM%
+ \fi
+ \fi
+ \fi
+ }%
+ \expandafter\finalisetabrows@TPATM\the\tabrows@TPATM\@nil\tabrows@TPATM
+ \global\tabrows@TPATM=\tabrows@TPATM
+ \endgroup
+ \expandafter\gdef\expandafter\fullarrowparams@TPATM\expandafter{\expandafter[\arrowparams@TPATM]}%
+ \expandafter\gdef\expandafter\addarrowparams@TPATM\expandafter{\expandafter,\arrowparams@TPATM}%
+ \global\let\inputalphabet@TPATM=\currentia@TPATM
+ \transitionarrayparameters
+ \csname deltafliplabel(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname
+ \edef\mkcirclabel@TPATM
+ {%
+ \iffliplabel@TPATM\noexpand\aput\else\noexpand\bput\fi
+ \expandafter\ifx\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\@nnil
+ \else
+ [\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname]%
+ \fi
+ (\csname deltalabelpos(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname)%
+ }%
+ \edef\mklinelabel@TPATM
+ {%
+ \iffliplabel@TPATM\noexpand\bput\else\noexpand\aput\fi
+ \expandafter\ifx\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\@nnil
+ \else
+ [\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname]%
+ \fi
+ (\csname deltalabelpos(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname)%
+ }%
+ \expandafter
+ \ifx\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\@nnil
+ \ifx\state@TPATM\nstate@TPATM
+ \expandafter\nccircle\fullarrowparams@TPATM{->}{state\state@TPATM}{.35}%
+ \mkcirclabel@TPATM{\the\tabrows@TPATM}%
+ \else
+ \expandafter\ncline\fullarrowparams@TPATM{->}{state\state@TPATM}{state\nstate@TPATM}%
+ \mklinelabel@TPATM{\the\tabrows@TPATM}%
+ \fi
+ \else
+ \ifx\state@TPATM\nstate@TPATM
+ \edef\next
+ {%
+ \noexpand\nccircle
+ \expandafter
+ \ifx\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\empty
+ \fullarrowparams@TPATM
+ \else
+ [\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\addarrowparams@TPATM]%
+ \fi
+ }%
+ \next{->}{state\state@TPATM}{.35}%
+ \mkcirclabel@TPATM{\the\tabrows@TPATM}%
+ \else
+ \edef\next
+ {%
+ \noexpand\ncarc
+ \expandafter
+ \ifx\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\empty
+ \fullarrowparams@TPATM
+ \else
+ [\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\addarrowparams@TPATM]%
+ \fi
+ }%
+ \next{->}{state\state@TPATM}{state\nstate@TPATM}%
+ \mklinelabel@TPATM{\the\tabrows@TPATM}%
+ \fi
+ \fi
+ }%
+ {}%
+ }%
+ }%
+ \end{pspicture}%
+ \endgroup
+ }%
+ }
+ {% No; draw state transition table.
+ % First, the list of states.
+ \rput[l](0.07,0.81){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\statesname}}%
+ \mkfactor\startx@TPATM
+ {\ratio{\widthof{\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\statesname}}}{\psyunit}}%
+ \mkfactor{\statewidth@TPATM}{0+(0.88pt-\startx@TPATM pt)/\value{states@TPATM}}%
+ \ifthenelse{\lengthtest{\statewidth@TPATM pt>.1pt}}{\def\statewidth@TPATM{.1}}{}%
+ \filltofive@TPATM{\startx@TPATM}%
+ \filltofive@TPATM{\statewidth@TPATM}%
+ \def\states@TPATM{#1,}%
+ \setcounter{currstate@TPATM}{0}%
+ \multido{\n=\startx@TPATM+\statewidth@TPATM}{\value{states@TPATM}}
+ {%
+ \stepcounter{currstate@TPATM}%
+ \mkfactor{\endx@TPATM}{\real{\n}+\statewidth@TPATM pt}%
+ \getstate@TPATM{\states@TPATM}{,linewidth=2pt,linecolor=red}{\statetype@TPATM}{\state@TPATM}%
+ \ifnum\value{currstate@TPATM}=#7
+ \ifacceptingstate@TPATM\global\acceptingstate@TPATMtrue\else\global\acceptingstate@TPATMfalse\fi
+ \fi
+ \edef\next
+ {%
+ \noexpand
+ \psframe
+ [%
+ fillstyle=solid,%
+ fillcolor=\ifnum\value{currstate@TPATM}=#7currstatecolor\else cellcolor\fi\statetype@TPATM
+ ]%
+ }%
+ \next(\n,0.76)(\endx@TPATM,0.86)%
+ \mkfactor{\charpos@TPATM}{\real{\n}+\statewidth@TPATM pt/2}%
+ \rput(\charpos@TPATM,0.81){\state@TPATM}%
+ \ifthenelse{\value{currstate@TPATM}=#4}{\psline{->}(\charpos@TPATM,0.74)(\charpos@TPATM,0.76)}{}%
+ }%
+ % Next, the state transition table itself.
+ \psframe[fillstyle=solid,fillcolor=cellcolor,dimen=inner](0.07,0.14)(0.93,0.74)
+ \rput[lt](0.07,0.74){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller\statetransname}}%
+ % Construct tabular declaration and first row.
+ \def\inputalphabet@TPATM{#2,}%
+ \tabrows@TPATM={}%
+ \tabdecl@TPATM={}%
+ \ifthenelse{\equal{\inputtapesymbol@TPATM}{\nextinputtapesymbol@TPATM}}
+ {%
+ \replacecolor{oldinputcolor@TPATM}{markstatecolor@TPATM}%
+ \replacecolor{newinputcolor@TPATM}{markstatecolor@TPATM}%
+ \replacecolor{oldoutputcolor@TPATM}{currstatecolor}%
+ \replacecolor{newoutputcolor@TPATM}{currstatecolor}%
+ }
+ {%
+ \colorbetween[\tapeadvancement@TPATM]{oldinputcolor@TPATM}{pagecolor}{markstatecolor@TPATM}%
+ \colorbetween[\tapeadvancement@TPATM]{newinputcolor@TPATM}{markstatecolor@TPATM}{pagecolor}%
+ \ifthenelse{\lengthtest{\tapeadvancement@TPATM pt>0.5pt}}
+ {%
+ \colorbetween[\tapeadvancement@TPATM]{newoutputcolor@TPATM}{currstatecolor}{pagecolor}%
+ \replacecolor{oldoutputcolor@TPATM}{markstatecolor@TPATM}%
+ }
+ {%
+ \colorbetween[\tapeadvancement@TPATM]{oldoutputcolor@TPATM}{pagecolor}{currstatecolor}%
+ \replacecolor{newoutputcolor@TPATM}{markstatecolor@TPATM}%
+ }%
+ }%
+ \whiledo{\not\equal{\inputalphabet@TPATM}{}}
+ {%
+ \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM
+ \protected@edef\newtabrows@TPATM{\the\tabrows@TPATM&\noexpand\formatsymbol{\inputsymbol@TPATM}}%
+ \expandafter\tabrows@TPATM\expandafter{\newtabrows@TPATM}%
+ \edef\newtabdecl@TPATM
+ {%
+ \the\tabdecl@TPATM
+ \ifx\inputsymbol@TPATM\nextinputtapesymbol@TPATM>{\noexpand\columncolor{newinputcolor@TPATM}}\fi
+ \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM>{\noexpand\columncolor{oldinputcolor@TPATM}}\fi
+ c%
+ }%
+ \expandafter\tabdecl@TPATM\expandafter{\newtabdecl@TPATM}%
+ }%
+ % Construct remaining rows.
+ \setcounter{currstate@TPATM}{0}%
+ \def\states@TPATM{#1,}%
+ \whiledo{\not\equal{\states@TPATM}{}}
+ {%
+ \stepcounter{currstate@TPATM}%
+ \getsymbol@TPATM\states@TPATM\state@TPATM
+ \protected@edef\newtabrows@TPATM
+ {%
+ \the\tabrows@TPATM\noexpand\\%
+ \ifnum\value{currstate@TPATM}=#7 \noexpand\rowcolor{markstatecolor@TPATM}\fi\state@TPATM
+ }%
+ \expandafter\tabrows@TPATM\expandafter{\newtabrows@TPATM}%
+ \def\inputalphabet@TPATM{#2,}%
+ \whiledo{\not\equal{\inputalphabet@TPATM}{}}
+ {%
+ \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM
+ \protected@edef\newtabrows@TPATM
+ {%
+ \the\tabrows@TPATM&%
+ \ifnum\value{currstate@TPATM}=#7
+ \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM
+ \noexpand
+ \multicolumn{1}{>{\noexpand\columncolor{oldoutputcolor@TPATM}}c}
+ {\formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM}%
+ \else
+ \ifx\inputsymbol@TPATM\nextinputtapesymbol@TPATM
+ \noexpand
+ \multicolumn{1}{>{\noexpand\columncolor{newoutputcolor@TPATM}}c}
+ {\formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM}%
+ \else
+ \formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM
+ \fi
+ \fi
+ \else
+ \formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM
+ \fi
+ }%
+ \expandafter\tabrows@TPATM\expandafter{\newtabrows@TPATM}%
+ % Set succeeding state (and output symbol).
+ \ifnum\value{currstate@TPATM}=#7\relax
+ \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM
+ \getoutput@TPATM{\state@TPATM}{\inputsymbol@TPATM}%
+ \fix@nextstate@TPATM
+ \fi
+ \fi
+ }%
+ }%
+ % Save tabular into a box.
+ \savebox{\tabbox@TPATM}
+ {%
+ \raisebox{\depth}
+ {%
+ \setlength{\fboxsep}{0.4pt}%
+ \fbox
+ {%
+ \clipbox
+ {%
+ \edef\next{\noexpand\begin{tabular}[b]{c\the\tabdecl@TPATM}}%
+ \statetransitiontablepreamble
+ \next
+ \the\tabrows@TPATM
+ \end{tabular}%
+ }%
+ }%
+ }%
+ }%
+ % Print state transition table, with some decoration.
+ \rput(0.5,0.44)
+ {%
+ \raisebox{.5\tabcolsep}
+ {\rotatebox{90}{\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller \statename}}}%
+ \parbox[b]{\wd\tabbox@TPATM}
+ {%
+ \offinterlineskip\raggedleft
+ \psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller \inputname}\kern\tabcolsep\\%
+ \usebox{\tabbox@TPATM}%
+ }%
+ \raisebox{.5\tabcolsep}
+ {%
+ \rotatebox{90}
+ {\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller[2]\nextstatename}}%
+ }%
+ \label@output@TPATM
+ }%
+ }%
+ % Draw output tape, if mealy automaton.
+ \draw@outputtape@TPATM{#8}%
+ % Calculate number of succeeding state.
+ \setcounter{currstate@TPATM}{0}%
+ \def\states@TPATM{#1,}%
+ \whiledo{\not\equal{\states@TPATM}{}}
+ {%
+ \stepcounter{currstate@TPATM}%
+ \getsymbol@TPATM\states@TPATM\state@TPATM
+ \edef\state@TPATM{\state@TPATM}%
+ \ifx\state@TPATM\nextstate@TPATM
+ \setcounter{nextstate@TPATM}{\value{currstate@TPATM}}%
+ \fi
+ }%
+ % Calculate new output tape.
+ \mk@new@outputtape@TPATM{#8}%
+ \end{pspicture}%
+ \endgroup
+ }
+
+
+% \dfa{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>}
+% {<initial state>}{<input tape>}{<tape position>}{<current state>}
+% draws a deterministic finite automaton.
+%
+% The parameters have the following meanings:
+% <width> Width of the automaton to be drawn.
+% <height> Height of the automaton to be drawn.
+% <states> Comma-separated list (symbolically) specifying the set of states.
+% <inputalphabet> Comma-separated list (symbolically) specifying the set of input symbols.
+% <statetransitions> Comma-separated list (symbolically) specifying the state transition function (also giving the
+% output symbols associated with state transitions).
+% <initial state> Number of the initial state.
+% <input tape> Comma-separated list (symbolically) specifying the contents of the input tape.
+% <tape position> Fixed-point number (greater or equal 1) specifying the current position of the head reading input
+% and output tape. The symbol currently read corresponds to the integer part of <tape position>.
+% <current state> Number of the current state.
+%
+% The standard version of \dfa displays a state transition table, i.e. for every combination of state and
+% input symbol, the successor state is displayed in a tabular. The current state, current input
+% symbol and next input symbol (if <tape position> is not integer) are indicated by colored bars.
+%
+% There is a starred version \mealyautomaton* which displays a state transition graph where states are displayed as
+% circles and state transitions as arrows between circles. The `active' transition (leading from the current to the next
+% state) is highlighted.
+%
+% The <states> parameter looks like <state1>,<state2>,...,<staten>, where every single <state> has the following form:
+% {(<x>,<y>)\accept <symbol>}
+% where (<x>,<y>) and the special keyword \accept are optional and <symbol> is the symbolic name of the state.
+% The optional parameter (<x>,<y>) is used only in the starred version \mealyautomaton*. If given, it specifies the
+% position of the circle representing the state in the state transition graph, in PSTricks notation. The origin of the
+% state transition graph is in the middle of the area reserved for it, stretching one unit in all directions, so that
+% the corners of the area are at coordinates (-1,1), (1,1), (1,-1), (-1,-1). If not given in the starred version
+% \mealyautomaton*, the position is calculated automatically in a `bead' style.
+% The special keyword \accept flags this state as an accepting one.
+% If the optional coordinates argument is not given, the outer curly braces may be left out, but otherwise leaving the
+% curly braces out would disturb the parsing of the comma-separated list because of the comma between <x> and <y>.
+%
+% The <statetransitions> parameter looks like <trans1>,<trans2>,...,<transm>, where every single <trans> has the
+% following form:
+% [<opt>]<state>;<input>-><state'>
+% where [<opt>] is optional. <state> and <input> are the arguments of the state transition function, and <state'> is the
+% successor state.
+% The optional parameter [<opt>] is used only in the starred version \mealyautomaton*. If given, it specifies additional
+% optional parameters for the node connection command (\nccircle or \ncarc) drawing the arrow for this
+% transition. \ncline is used for transitions from a state to itself. For transitions between states, \ncarc is used
+% whenever the optional argument is given, otherwise \ncline is used. This is a seldom instance where giving an empty
+% optional argument is different from giving no optional argument at all: Giving the optional argument [] switches
+% between \ncline and \ncarc (useful if two transitions go `back and forth' between two states).
+%
+
+\newcommand{\initializedfa@TPATM}
+{%
+ \renewcommand{\draw@outputtape@TPATM}[1]
+ {%
+ \colorbetween{outercirclecolor@TPATM}{black}{automatoncolor}%
+ \pscircle[fillstyle=solid,fillcolor=outercirclecolor@TPATM,linewidth=.5\pslinewidth](0.5,0.07){0.25}%
+ \ifacceptingstate@TPATM
+ \replacecolor{acceptlampcolor@TPATM}{red}%
+ \else
+ \colorbetween[.1]{acceptlampcolor@TPATM}{red}{automatoncolor}%
+ \fi
+ \pscircle[fillstyle=solid,fillcolor=acceptlampcolor@TPATM,linewidth=.5\pslinewidth](0.5,0.07){0.15}%
+ \rput[l](0.53,0.07){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\acceptname}}%
+ }%
+ \renewcommand{\getoutput@TPATM}[2]
+ {%
+ \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\nstate@TPATM
+ \expandafter\expandafter\expandafter{\csname delta(##1;##2)@TPATM\endcsname}%
+ }%
+ \renewcommand{\inittabrows@TPATM}[1]{##1={\smaller\begin{tabular}{@{}r@{}}}}%
+ \renewcommand{\addtabrow@TPATM}[2]
+ {%
+ \protected@edef\newtabrows@TPATM{\the##1\@hlinput@TPATM\formatsymbol{##2}\noexpand\\}%
+ \expandafter##1\expandafter{\newtabrows@TPATM}%
+ }%
+ \def\formatdfaoutput@TPATM##1##2{\csname delta(##1;##2)@TPATM\endcsname}%
+ \renewcommand{\label@output@TPATM}{}%
+ \renewcommand{\fix@nextstate@TPATM}
+ {%
+ \global\let\nextstate@TPATM=\nstate@TPATM
+ }%
+ \renewcommand{\mk@new@outputtape@TPATM}[1]{}%
+ }%
+
+\newcommand{\dfa}
+{%
+ \initializedfa@TPATM
+ \dfa@TPATM
+ }
+
+\newcommand{\dfa@TPATM}
+{%
+ \@ifstar
+ {\setboolean{stategraph@TPATM}{true}\@dfa@TPATM}
+ {\setboolean{stategraph@TPATM}{false}\@dfa@TPATM}%
+ }
+
+\newcommand{\@dfa@TPATM}[2]
+{%
+ \ifthenelse{\boolean{psspecialsallowed}}
+ {%
+ \begingroup
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#2}%
+ \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}%
+ \let\next=\@@dfa@TPATM
+ }
+ {%
+ \rule{#1}{#2}%
+ \let\next=\@@nodfa@TPATM
+ }%
+ \next
+}
+
+\newcommand{\@@nodfa@TPATM}[7]{}
+
+\newcommand{\@@dfa@TPATM}[7]{\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{#6}{#7}{}}
+
+
+% \simulatedfa{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>}
+% {<initial state>}{<input tape>}{<number of steps>}{<tape move resolution>}
+% simulates a deterministic finite automaton.
+%
+% The parameters <width>, <height>, <states>, <inputalphabet>, <statetransitions>, <initial state>, and <input tape>
+% have the same meaning as for \dfa.
+% <number of steps> gives the number of state transitions to perform (in fact, the first state transition occurs after
+% the first step, so <number of steps>=1 means no state transition.
+% The simulation starts with both tapes at the beginning, in the initial state. After this, the simulation proceeds in
+% the following steps:
+% 1) Change state.
+% 2) Advance input tape and reiterate.
+% The steps are realised with TeXPower's \step mechanism. This means the whole simulation will lead to the corresponding
+% number of `subpages' each displaying the automaton in changing states.
+% If <tape move resolution>=1, then step number 3 will just switch over the tape position. Otherwise, advancing the tape
+% will take <tape move resolution> intermediate steps, which are automatically animated using hyperref's pdfpageduration
+% mechanism, i.e. when displayed in acroread's full screen mode (with automatic advancing activated), a `smooth' tape
+% movement will be seen.
+% \simulatedfa comes in normal and starred versions, with the same semantics as for \dfa, i.e. the normal version
+% displays a state transition table, the starred version displays a state transition graph.
+
+\newcommand{\simulatedfa}
+{%
+ \initializedfa@TPATM
+ \@ifstar
+ {\setboolean{stategraph@TPATM}{true}\@simulatedfa@TPATM}
+ {\setboolean{stategraph@TPATM}{false}\@simulatedfa@TPATM}%
+ }
+
+\newcommand{\@simulatedfa@TPATM}[2]
+{%
+ \ifthenelse{\boolean{psspecialsallowed}}
+ {%
+ \begingroup
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#2}%
+ \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}%
+ \let\next=\@@simulatedfa@TPATM
+ }
+ {%
+ \rule{#1}{#2}%
+ \let\next=\@@nosimulatedfa@TPATM
+ }%
+ \next
+}
+
+\newcommand{\@@nosimulatedfa@TPATM}[7]{}
+
+\newcounter{currentdfastate@TPATM}
+\newcounter{currentsupstep@TPATM}
+\newcounter{currentsubstep@TPATM}
+\newboolean{beginautosim@TPATM}
+\newcommand{\autosimduration}{0.04}
+\releasecounter{currentdfastate@TPATM}\releasecounter{nextstate@TPATM}
+
+\newcommand{\@@simulatedfa@TPATM}[7]
+{%
+ % Setup initial state.
+ \setcounter{currentsupstep@TPATM}{0}%
+ \setcounter{currentdfastate@TPATM}{#4}%
+ \setcounter{nextstate@TPATM}{0}%
+ \stepwise[\setcounter{currentdfastate@TPATM}{#4}\setcounter{nextstate@TPATM}{0}]
+ {%
+ \setboolean{beginautosim@TPATM}{true}%
+ % Main loop for state transitions.
+ \whiledo{\value{currentsupstep@TPATM}<#6}
+ {%
+ % At the beginning, the situation right before the state transition is displayed. This is effected by only
+ % displaying the last step of the tape movement.
+ \ifthenelse{\boolean{beginautosim@TPATM}}
+ {\setboolean{beginautosim@TPATM}{false}\setcounter{currentsubstep@TPATM}{#7-1}}
+ {\setcounter{currentsubstep@TPATM}{0}}%
+ % Inner loop for tape movement.
+ \whiledo{\value{currentsubstep@TPATM}<#7}
+ {%
+ \stepcounter{currentsubstep@TPATM}%
+ % Display sequence of steps while the tape gradually moves.
+ \mkfactor{\tapeposition@TPATM}{\value{currentsupstep@TPATM}+\arabic{currentsubstep@TPATM}pt/#7}%
+ \ifthenelse{\value{currentsubstep@TPATM}=#7}
+ {%
+ \setcounter{tmpcnta@TP}{\value{currentsupstep@TPATM}+1}%
+ \ifthenelse{\value{tmpcnta@TP}=#6}{\switch}{\switch[][\boolean{firstactivation}]}{}
+ {%
+ \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{}%
+ \afterstep{\stopAdvancing}%
+ \setcounter{currentdfastate@TPATM}{\value{nextstate@TPATM}}\setcounter{nextstate@TPATM}{-1}%
+ }%
+ }
+ {%
+ \switch[][\boolean{firstactivation}]{}
+ {%
+ \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{}%
+ \afterstep{\pageDuration{\autosimduration}}%
+ }%
+ }%
+ }%
+ \stepcounter{currentsupstep@TPATM}%
+ % After the tape is in the next (or initial) position, switch state and reiterate.
+ \ifthenelse{\value{currentsupstep@TPATM}=#6}{}
+ {%
+ \switch[][\boolean{firstactivation}]{}%
+ {%
+ \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{}%
+ }%
+ }%
+ }%
+ }%
+\endgroup
+}
+
+
+%-----------------------------------------------------------------------------------------------------------------------
+% Finite Automata with output.
+
+% \mealyautomaton{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>}
+% {<initial state>}{<input tape>}{<tape position>}{<current state>}{<output tape>}
+% draws a mealy automaton (deterministic finite automaton with output tape, output is triggered by state transitions).
+%
+% The parameters have the same meanings as for \dfa, with one addition:
+% <output tape> Comma-separated list (symbolically) specifying the contents of the output tape.
+%
+% The standard version of \mealyautomaton displays a state transition table, i.e. for every combination of state and
+% input symbol, the successor state and output symbol are displayed in a tabular. The current state, current input
+% symbol and next input symbol (if <tape position> is not integer) are indicated by colored bars.
+%
+% There is a starred version \mealyautomaton* which displays a state transition graph where states are displayed as
+% circles and state transitions as arrows between circles. The `active' transition (leading from the current to the next
+% state) is highlighted.
+%
+% The <states> parameter has the same structure as for \dfa.
+%
+% The <statetransitions> parameter looks like <trans1>,<trans2>,...,<transm>, where every single <trans> has the
+% following form:
+% [<opt>]<state>;<input>-><state'>;<output>
+% where [<opt>] is optional. <state> and <input> are the arguments of the state transition function, and <state'> and
+% <output> are the successor state and output symbol, respectively.
+% The optional parameter [<opt>] is used only in the starred version \mealyautomaton*. If given, it specifies additional
+% optional parameters for the node connection command (\nccircle or \ncarc) drawing the arrow for this
+% transition. \ncline is used for transitions from a state to itself. For transitions between states, \ncarc is used
+% whenever the optional argument is given, otherwise \ncline is used. This is a seldom instance where giving an empty
+% optional argument is different from giving no optional argument at all: Giving the optional argument [] switches
+% between \ncline and \ncarc (useful if two transitions go `back and forth' between two states).
+%
+
+\newcommand{\initializema@TPATM}
+{%
+ \renewcommand{\draw@outputtape@TPATM}[1]
+ {%
+ \rput[l](0.07,0.07){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\outputtapename}}%
+ \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM}{1pt}}%
+ \setcounter{tapecells@TPATM}{6+\value{currinputsymbol@TPATM}}%
+ \multips(\startx@TPATM,0.02)(0.1,0){\value{tapecells@TPATM}}{\psframe[fillstyle=solid,fillcolor=cellcolor](0.1,0.1)}%
+ \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM+0.05pt}{1pt}}%
+ \filltofive@TPATM{\startx@TPATM}%
+ \protected@edef\tapecontents@TPATM{##1,}%
+ \setcounter{currtapepos@TPATM}{0}%
+ \multido{\n=\startx@TPATM+0.10000}{\value{tapecells@TPATM}}
+ {%
+ \ifx\tapecontents@TPATM\empty
+ \else
+ \stepcounter{currtapepos@TPATM}%
+ \getsymbol@TPATM\tapecontents@TPATM\outputtapesymbol@TPATM
+ \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}\relax
+ \global\let\outputtapesymbol@TPATM\outputtapesymbol@TPATM
+ \fi
+ \rput(\n,0.07){\formatsymbol\outputtapesymbol@TPATM}%
+ \fi
+ }%
+ \psframe[linewidth=2pt,linecolor=mathcolor](0.45,0.02)(0.55,0.12)
+ }%
+ \renewcommand{\getoutput@TPATM}[2]
+ {\expandafter\expandafter\expandafter\@getoutput@TPATM\csname delta(##1;##2)@TPATM\endcsname\@nil}%
+ \def\@getoutput@TPATM##1;##2\@nil{\def\nstate@TPATM{##1}\def\output@TPATM{##2}}%
+ \renewcommand{\inittabrows@TPATM}[1]{##1={\smaller\begin{tabular}{rcl}}}%
+ \renewcommand{\addtabrow@TPATM}[2]
+ {%
+ \protected@edef\newtabrows@TPATM
+ {%
+ \the##1%
+ \@hlinput@TPATM\formatsymbol{##2}&\origmath{\vartriangleright}&\noexpand\formatsymbol{\output@TPATM}\noexpand\\%
+ }%
+ \expandafter##1\expandafter{\newtabrows@TPATM}%
+ }%
+ \def\formatdfaoutput@TPATM##1##2%
+ {\expandafter\expandafter\expandafter\@formatdfaoutput@TPATM\csname delta(##1;##2)@TPATM\endcsname\@nil}%
+ \def\@formatdfaoutput@TPATM##1;##2\@nil{##1;\formatsymbol{##2}}%
+ \renewcommand{\label@output@TPATM}
+ {%
+ \raisebox{.5\tabcolsep}
+ {\rotatebox{90}{\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller \outputname}}}%
+ }%
+ \renewcommand{\fix@nextstate@TPATM}
+ {%
+ \global\let\newoutputsymbol@TPATM=\output@TPATM
+ \global\let\nextstate@TPATM=\nstate@TPATM
+ }%
+ \renewcommand{\mk@new@outputtape@TPATM}[1]%
+ {%
+ \setcounter{currtapepos@TPATM}{0}%
+ \protected@edef\tapecontents@TPATM{##1,}%
+ \let\newoutputtape@TPATM=\empty
+ \whiledo{\not\equal{\tapecontents@TPATM}{}}
+ {%
+ \stepcounter{currtapepos@TPATM}%
+ \getsymbol@TPATM\tapecontents@TPATM\outputsymbol@TPATM
+ \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}%
+ \let\outputsymbol@TPATM=\newoutputsymbol@TPATM%
+ \fi
+ \protected@edef\newoutputtape@TPATM{\newoutputtape@TPATM\outputsymbol@TPATM,}%
+ }%
+ \expandafter\gobblelastcomma@TPATM\newoutputtape@TPATM\@nil\newoutputtape@TPATM
+ }%
+ }
+
+\newcommand{\mealyautomaton}
+{%
+ \initializema@TPATM
+ \mealyautomaton@TPATM
+ }
+
+\newcommand{\mealyautomaton@TPATM}
+{%
+ \@ifstar
+ {\setboolean{stategraph@TPATM}{true}\@mealyautomaton@TPATM}
+ {\setboolean{stategraph@TPATM}{false}\@mealyautomaton@TPATM}%
+ }
+
+\newcommand{\@mealyautomaton@TPATM}[2]
+{%
+ \ifthenelse{\boolean{psspecialsallowed}}
+ {%
+ \begingroup
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#2}%
+ \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}%
+ \let\next=\@@genericdfa@TPATM
+ }
+ {%
+ \rule{#1}{#2}%
+ \let\next=\@@nomealyautomaton@TPATM
+ }%
+ \next
+}
+
+\newcommand{\@@nomealyautomaton@TPATM}[8]{}
+
+
+% \simulatema{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>}
+% {<initial state>}{<input tape>}{<number of steps>}{<tape move resolution>}{<output tape>}
+% simulates a mealy automaton (deterministic finite automaton with output tape, output is triggered by state
+% transitions).
+%
+% The parameters <width>, <height>, <states>, <inputalphabet>, <statetransitions>, <initial state>, <input tape>,
+% <output tape> have the same meaning as for \mealyautomaton.
+% The parameters <number of steps> and <tape move resolution> have the same meaning as for \simulatedfa.
+% The simulation starts with both tapes at the beginning, in the initial state and with the output tape in the state
+% given by <output tape>. After this, the simulation proceeds in the following steps:
+% 1) Write output symbol of the `active' transition to the output tape.
+% 2) Change state.
+% 3) Advance both tapes and reiterate.
+% \simulatema comes in normal and starred versions, with the same semantics as for \mealyautomaton, i.e. the normal
+% version displays a state transition table, the starred version displays a state transition graph.
+
+\newcommand{\simulatema}
+{%
+ \initializema@TPATM
+ \@ifstar
+ {\setboolean{stategraph@TPATM}{true}\@simulatema@TPATM}
+ {\setboolean{stategraph@TPATM}{false}\@simulatema@TPATM}%
+ }
+
+\newcommand{\@simulatema@TPATM}[2]
+{%
+ \ifthenelse{\boolean{psspecialsallowed}}
+ {%
+ \begingroup
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#2}%
+ \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}%
+ \let\next=\@@simulatema@TPATM
+ }
+ {%
+ \rule{#1}{#2}%
+ \let\next=\@@nosimulatema@TPATM
+ }%
+ \next
+}
+
+\newcommand{\@@nosimulatema@TPATM}[8]{}
+
+\newcommand{\@@simulatema@TPATM}[8]
+{%
+ % Setup initial state.
+ \setcounter{currentsupstep@TPATM}{0}%
+ \setcounter{currentdfastate@TPATM}{#4}\gdef\currentoutputtape@TPATM{#8}%
+ \stepwise[\setcounter{currentdfastate@TPATM}{#4}\gdef\currentoutputtape@TPATM{#8}]
+ {%
+ \setboolean{beginautosim@TPATM}{true}%
+ % Main loop for state transitions.
+ \whiledo{\value{currentsupstep@TPATM}<#6}
+ {%
+ % At the beginning, the situation right before the state transition is displayed. This is effected by only
+ % displaying the last step of the tape movement.
+ \ifthenelse{\boolean{beginautosim@TPATM}}
+ {\setboolean{beginautosim@TPATM}{false}\setcounter{currentsubstep@TPATM}{#7-1}}
+ {\setcounter{currentsubstep@TPATM}{0}}%
+ % Inner loop for tape movement.
+ \whiledo{\value{currentsubstep@TPATM}<#7}
+ {%
+ \stepcounter{currentsubstep@TPATM}%
+ % Display sequence of steps while the tape gradually moves.
+ \mkfactor{\tapeposition@TPATM}{\value{currentsupstep@TPATM}+\arabic{currentsubstep@TPATM}pt/#7}%
+ \switch[][\boolean{firstactivation}]{}
+ {%
+ \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{\currentoutputtape@TPATM}%
+ \ifthenelse{\value{currentsubstep@TPATM}=#7}
+ {\afterstep{\stopAdvancing}\global\let\currentoutputtape@TPATM\newoutputtape@TPATM}%
+ {\afterstep{\pageDuration{\autosimduration}}}%
+ }%
+ }%
+ \stepcounter{currentsupstep@TPATM}%
+ % After the tape is in the next (or initial) position, display new output symbol.
+ \switch[][\boolean{firstactivation}]{}
+ {%
+ \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{\currentoutputtape@TPATM}%
+ \setcounter{currentdfastate@TPATM}{\value{nextstate@TPATM}}\setcounter{nextstate@TPATM}{-1}%
+ }%
+ % Next, switch state and reiterate.
+ \ifthenelse{\value{currentsupstep@TPATM}=#6}{\switch}{\switch[][\boolean{firstactivation}]}{}%
+ {%
+ \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{\currentoutputtape@TPATM}%
+ }%
+ }%
+ }%
+\endgroup
+}
+
+%KEEPCOMMENTS
+%</automata>
+%=======================================================================================================================
+%<*fixseminar>
+%<<KEEPCOMMENTS
+%=======================================================================================================================
+% File: fixseminar.sty
+%
+% Fix some problems in conjunction with seminar.
+%
+% This package is part of the TeXPower bundle, to be found at
+%
+% http://texpower.sourceforge.net/
+%
+% If using hyperref, load this package _after_ hyperref.
+%
+%=======================================================================================================================
+% Author: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 28, 2000 First version for the pre-alpha release of texpower and hyperref v6.70a.
+%
+% v0.0.1a May 18, 2000 Added a \vss to a \vbox to get rid of an `overfull vbox' message.
+%
+% v0.0.2 Jun 02, 2000 Now handle seminar as well as powersem.
+%
+% v0.0.3 Sep 07, 2000 hyperref v6.70u and later don't have the \@hyperfixhead bug any more.
+%
+% v0.0.4 Nov 22, 2002 Now using ifpdf package if available.
+% As hyperref v6.70u exists for some time now, the \@hyperfixhead hack is removed.
+% Fixed a problem with \twoup (bug found and fix proposed by Laurent Mugnier).
+% Added a preliminary fix for rotating slides with pdftex.
+%
+% v0.0.5 May 26, 2003 A small change to make fixseminar work better when hyperref is not loaded.
+
+
+\NeedsTeXFormat{LaTeX2e}
+
+\ProvidesPackage%
+{fixseminar}%
+[2003/05/26 v0.0.5 Fix some problems of seminar.]
+
+
+%=======================================================================================================================
+
+\RequirePackage{ifthen}
+
+
+%=======================================================================================================================
+% Options and general setup.
+
+\ProcessOptions
+
+
+% The switch \ifpdf is to determine whether pdfLaTeX is being run and outputting pdf, using Heiko Oberdiek's faultproof
+% pdf detector:
+
+\IfFileExists{ifpdf.sty}
+{%
+ \RequirePackage{ifpdf}%
+ }
+{%
+ \@ifundefined{pdftrue}
+ {%
+ \expandafter\newif\csname ifpdf\endcsname
+ \ifx\pdfoutput\undefined
+ \else
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+ \fi
+ }{}%
+ }
+
+
+%=======================================================================================================================
+% Here come the fixes.
+
+% We need to make sure that magnification, as used by seminar, is respected when setting \pdfpageheight and
+% \pdfpagewidth. We strip the pt and add truept which respects magnification.
+
+
+\ifthenelse{\boolean{pdf}}% Are we outputting PDF?
+{% Yes.
+ \@ifclassloaded{seminar}% seminar document class?
+ {%
+ \RequirePackage{graphics}%
+ \def\leftsliderotation#1{\rotatebox{90}{#1}}%
+ \def\rightsliderotation#1{\rotatebox{270}{#1}}%
+ \sliderotation{left}%
+ }{}%
+ \AtBeginDocument% Then we need to set \pdfpagewidth and \pdfpageheight in a _true_ unit to make sure
+ {% the pdf page has the right dimensions even when magnifying (as seminar does).
+ \setlength{\pdfhorigin}{1truein}% \pdfhorigin and \pdfvorigin also need to be set to true dimensions.
+ \setlength{\pdfvorigin}{1truein}%
+ \@ifclassloaded{seminar}% seminar document class?
+ {%
+ \ifportrait% Portrait slides?
+ \setlength{\pdfpageheight}{\strip@pt\paperheight truept}%
+ \setlength{\pdfpagewidth}{\strip@pt\paperwidth truept}%
+ \else% Landscape. Need to exchange height and width.
+ \renewcommand{\printlandscape}
+ {%
+ \setlength{\pdfpagewidth}{\strip@pt\paperheight truept}%
+ \setlength{\pdfpageheight}{\strip@pt\paperwidth truept}%
+ }%
+ \fi
+ }%
+ {%
+ \setlength{\pdfpageheight}{\strip@pt\paperheight truept}%
+ \setlength{\pdfpagewidth}{\strip@pt\paperwidth truept}%
+ }%
+ }%
+}
+{% No. In this case we define \special@paper which will put an appropriate \special into the dvi file.
+ \@ifclassloaded{seminar}
+ {%
+ \ifportrait
+ \edef\special@paper{\the\paperwidth,\the\paperheight}%
+ \else% Need to exchange height and width.
+ \renewcommand{\printlandscape}{\edef\special@paper{\the\paperheight,\the\paperwidth}}
+ \fi
+ \AtBeginDocument{\special{papersize=\special@paper}}%
+ }%
+ {%
+ }%
+ }%
+
+
+% There is a bug in old hyperref versions to the effect that apparently, when using seminar there is a glitch in
+% vertical spacing. Issue a warning if hyperref is too old.
+
+\@ifpackageloaded{hyperref}% Looking for \@hyperfixhead bug.
+{%
+ \@ifpackagelater{hyperref}{2000/09/07}% Is the \@hyperfixhead bug present in hyperref?
+ {}% No.
+ {% Yes. Issue a warning.
+ \PackageWarning{fixseminar}
+ {Package hyperref too old (older than 6.70u).\MessageBreak Expect problems with seminar}%
+ }%
+ }{}
+%KEEPCOMMENTS
+%</fixseminar>
+% ===============================================================================
+%<*tplists>
+%<<KEEPCOMMENTS
+% ===============================================================================
+% File: tplists.sty
+%
+% Function: The package provides dynamic lists. The following
+% environments/lists are available
+% 1) 'stepenum', 'stepitem', 'stepeqlist', 'stepcompactenum'
+% 'stepcompactitem' and 'stepcompacteqlist'.
+% 2) 'flipenum', 'flipitem', 'flipeqlist', 'flipcompactenum',
+% 'flipcompactitem', and 'flipcompacteqlist'
+% 3) 'dimenum', 'dimitem', 'dimeqlist', 'dimcompactenum',
+% 'dimcompactitem', and 'dimcompacteqlist'
+% 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.
+%
+% Usage: The package is loaded in the normal fashion, eg:
+% \usepackage{tplists}
+% The following options exist:
+% pausestep - makes step* lists use \pause
+% 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.
+%
+% Example:
+%
+% \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}
+%
+% (The normal 'itemize' and 'enumerate' lists are modified
+% so they accept the optional parameter and work nested
+% with the new lists.)
+%
+% 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.
+%
+% History: 2003/10/03 v0.1:
+% * first public release
+% 2003/10/04 v0.1a:
+% * removed redefinition of eqlist (since it doesn't work)
+% 2003/10/07 v0.1b:
+% * corrected some typos in this documentation
+% * added option pausestep
+% * made dim* (and all variants of flip*) lists work without
+% colors by using boldface for active items.
+%
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tplists}%
+ [2003/10/07 v0.1b Dynamic Lists using TeXPower]
+
+%% Packages
+\RequirePackage{texpower}
+% Compact enum/item.
+\newboolean{tpl@paralist}
+\@ifpackageloaded{paralist}{\setboolean{tpl@paralist}{true}}{}
+% Lists with equal indentation.
+\newboolean{tpl@eqlist}
+\@ifpackageloaded{eqlist}{\setboolean{tpl@eqlist}{true}}{}
+
+%% Options
+% Use \pause for steplists (too avoid problems with structured backgrounds).
+\newboolean{tpl@pausestep}
+\DeclareOption{pausestep}{\setboolean{tpl@pausestep}{true}}
+
+\ProcessOptions
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% Flipped/dimmed/stepped itemize/enumerate/eqlist environment. %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% '\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.
+\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\endoldenumerate=\endenumerate
+\let\endolditemize=\enditemize
+\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
+}{}
+
+%%% Defining \tpl@collect@body - command used to scan the list
+%%% environments. Definition borrowed from 'amsmath.sty' - slightly
+%%% modified to allow for 'long' arguments
+\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
+}
+
+%%% Defining command '\tpl@addmargin' used to add a length to
+%%% the leftmargin of the current level in a list.
+\def\tpl@addmargin#1{%
+ \advance\@listdepth 1
+ \addtolength{\csname leftmargin\romannumeral\@listdepth\endcsname}{#1}
+ \advance\@listdepth -1
+}
+
+%%% Defining a flipped step command.
+\ifthenelse{\boolean{TPcolor}}% Can we use colors?
+{% Yes. In this case highlighting is implemented by switching color.
+ \def\tpl@flipstep% Note that \tpl@flipstep takes no argument.
+ {%
+ \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}}
+ }%
+ }
+
+%%% Defining a dimmed step command.
+\ifthenelse{\boolean{TPcolor}}% Can we use colors?
+{% Yes. In this case highlighting is implemented by using \dstep
+ \def\tpl@dimstep% Note that \tpl@flipstep takes no argument.
+ {%
+ \dstep
+ }%
+}
+{% No. In this case highlighting is implemented by putting the item in boldface.
+ \def\tpl@dimstep
+ {%
+ \step{\bfseries}
+ \ifthenelse{\boolean{active}}{}{\mdseries}%
+ }%
+ }
+
+%%% Defining flipped stepped - itemize / enumerate / eqlist
+%%% compact itemize / compact enumerate / compact eqlist - environments.
+\newenvironment{flipitem}[1][0cm]{%
+ \tpl@addmargin{#1}
+ \tpl@collect@body\@flipitem}%
+ {\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
+ \step{}
+ \end{#1}}
+ \fi\fi
+}
+
+\newcommand\@flipitem[1]{%
+ \@fliplist{olditemize}{#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}}
+}{}
+
+%%% Defining dimmed stepped - itemize / enumerate / eqlist /
+%%% compact itemize / compact enumerate / compact eqlist - environments.
+\newenvironment{dimitem}[1][0cm]{%
+ \tpl@addmargin{#1}
+ \tpl@collect@body\@dimitem}%
+ {\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\@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}}
+}{}
+
+%%% Defining stepped - itemize / enumerate / eqlist /
+%%% compact itemize / compact enumerate / compact eqlist - environments.
+\newenvironment{stepitem}[1][0cm]{%
+ \tpl@addmargin{#1}
+ \tpl@collect@body\@stepitem}%
+ {\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}
+}{}
+
+\ifthenelse{\boolean{tpl@pausestep}}{%
+% Using \pause for step* lists
+\newcommand\@steplist[2]{%
+ \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
+}
+}{
+% Using \liststepwise for step* lists
+\newcommand\@steplist[2]{%
+ \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}{\vstep\tpl@origitem}%
+ #2
+ \end{#1}%
+ \else
+ \liststepwise{%
+ \begin{#1}
+ \iftpl@instepenv\else\let\tpl@origitem=\item\fi
+ \tpl@instepenvtrue
+ \renewcommand{\item}{\vstep\tpl@origitem}%
+ #2
+ \end{#1}}
+ \fi\fi\fi
+}
+}
+
+\newcommand\@stepitem[1]{%
+ \@steplist{olditemize}{#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}}
+}{}
+
+%%% Defining compact eqlist
+\newenvironment{compacteqlist}[1][0cm]{%
+ % \tpl@addmargin{#1}
+ \begin{eqlist}[\parsep0pt\itemsep0pt]}%
+ {\end{eqlist}}
+
+
+%%% Redefining enumerate and itemize to handle changes made by
+%%% introducing steps and leftmargini-option.
+\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}}
+
+%%% Redefining compactenum and compactitem to handle changes made by
+%%% introducing steps and leftmargini-option.
+\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}}
+}{}
+%KEEPCOMMENTS
+%</tplists>
+%=======================================================================================================================
+%<*tppstcol>
+%<<KEEPCOMMENTS
+%=======================================================================================================================
+% File: tppstcol.sty
+%
+% Replacement for ``pstcol.sty'' with some quirks corrected.
+% There is a small problem with pstcol.sty which makes it impossible
+% to set something like "fillcolor=\linecolor" in pstricks (see LaTeX
+% Bug graphics/3366). As this is absolutely indispensible for
+% automata.sty, I had to make a modified version to be used until the
+% bug is mended.
+% The following code is identical with the original pstcol.sty, with
+% some modifications to correct the bug.
+%
+% This package is an addition to the TeXPower bundle, to be found at
+%
+% http://texpower.sourceforge.net/
+%
+% Beware! As soon as the original bug in pstcol is corrected, this
+% package will be deleted.
+%
+%=======================================================================================================================
+
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{tppstcol}
+ [2001/08/28 v0.2 PSTricks color compatibility (DPC; revised
+ by STL)]
+%%%%%%%%%%%%%%%%%%
+\let\saved@gray\color@gray
+\RequirePackage{pstricks}
+\let\color@gray\saved@gray
+%%%%%%%%%%%%%%%%
+\DeclareOption*{\PassOptionsToPackage\CurrentOption{color}}
+\ProcessOptions
+\RequirePackage{color}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\pst@getcolor#1#2{%
+\@ifundefined{\string\color@#1}%
+{\@pstrickserr{Color `#1' not defined}\@eha}%
+ {\edef#2{#1}}}
+\def\pst@usecolor#1%
+{%
+ \expandafter\expandafter\expandafter
+ \c@lor@to@ps\csname\string\color @#1\endcsname\@@\space%
+ }
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\definecolor{darkgray}{gray}{.25}
+\definecolor{gray}{gray}{.5}
+\definecolor{lightgray}{gray}{.75}
+\definecolor{gradbegin}{rgb}{0,1,1}
+\definecolor{gradend}{rgb}{0,.1,.95}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\psset@bordercolor{white}
+\psset@doublecolor{white}
+\psset@linecolor{black}
+\psset@fillcolor{white}
+\psset@hatchcolor{black}
+\psset@gridcolor{black}
+\psset@gridlabelcolor{black}
+\psset@shadowcolor{darkgray}
+\psset@subgridcolor{gray}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\newgray#1{%
+ \definecolor{#1}{gray}}
+\def\newrgbcolor#1#2{%
+ \newrgbcolorx{#1}#2\@@}
+\def\newrgbcolorx#1#2 #3 #4\@@{%
+ \definecolor{#1}{rgb}{#2,#3,#4}}
+\def\newcmykcolor#1#2{%
+ \newcmykcolorx{#1}#2\@@}
+\def\newcmykcolorx#1#2 #3 #4 #5\@@{%
+ \definecolor{#1}{cmyk}{#2,#3,#4,#5}}
+%KEEPCOMMENTS
+%</tppstcol>
+%=======================================================================================================================
+%<*tpsem-a4>
+%<<KEEPCOMMENTS
+% Fixed for LaTeX2e (\paperwidth and \paperheight are dimensions) by
+% Stephan Lehmke.
+\setlength\paperwidth{210mm}
+\setlength\paperheight{297mm}
+\input sem-page.sty
+\slidewidth 222mm
+\slideheight 152mm
+%KEEPCOMMENTS
+%</tpsem-a4>
+\endinput
diff --git a/Master/texmf-dist/source/latex/texpower/texpower-cfg.dtx b/Master/texmf-dist/source/latex/texpower/texpower-cfg.dtx
new file mode 100644
index 00000000000..372fa047ba0
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/texpower-cfg.dtx
@@ -0,0 +1,422 @@
+% \iffalse meta-comment
+% --------------------------------------------------------------
+% TeXPower bundle - dynamic online presentations with LaTeX
+% Copyright (C) 1999-2004 Stephan Lehmke
+%
+% 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.
+% --------------------------------------------------------------
+%
+% texpower-cfg.dtx,v 1.2 2004/07/27 11:40:36 hansfn Exp
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\documentclass{article}
+\begin{document}
+\typeout{***********************************************************}
+\typeout{*}
+\typeout{*\space\space\space\space\space\space\space Do NOT compile this dtx file!}
+\typeout{*}
+\typeout{***********************************************************}
+\end{document}
+%</driver>
+%
+% \fi
+%<*tpcolors>
+%<<KEEPCOMMENTS
+%=======================================================================================================================
+% File: tpcolors.cfg
+%
+% Color configuration for the texpower package.
+%
+%=======================================================================================================================
+
+%=======================================================================================================================
+% Standard colors.
+%
+% For every of the colors described in the "Defined colors for emphasis and highlighting elements" section of the
+% documentation, there is one default value which is defined here. Further default colors are for background, panel and
+% navigation elements.
+%
+% Note that this file is loaded _only_ if TeXPower's color management is active.
+%
+% Redefine colors for individual taste. Please remember, however, that a document transferred into another configuration
+% where a different tpcolors.cfg is present, will look different on compilation. So for a `stable' color configuration,
+% it might be better to put the respective \defineTPcolor commands into the preamble of the document or into a style
+% file.
+
+% Color definitions for white background.
+
+\defineTPcolor[whitebg]{pagecolor}{rgb}{1,1,1}% Page background (for background style `plain').
+
+\defineTPcolor[whitebg]{bgndstartcolor}{rgb}{1,1,0.9}% Start color for gradient background.
+\defineTPcolor[whitebg]{bgndendcolor}{rgb}{1,1,1}% End color for gradient background.
+\defineTPcolor[whitebg]{bgndmidcolor}{rgb}{0.9,1,0.9}% Middle color for gradient background (`double' gradient).
+
+\defineTPcolor[whitebg]{textcolor}{rgb}{0,0,0.5}% Normal text.
+
+\defineTPcolor[whitebg]{emcolor}{rgb}{0,0,0.8}% Emphasised text (if coloremph option is given).
+\defineTPcolor[whitebg]{altemcolor}{rgb}{0,0.5,0.8}% Double emphasised text (if coloremph option is given).
+
+\defineTPcolor[whitebg]{mathcolor}{rgb}{0,0.5,0}% Math (if colormath option is given).
+
+\defineTPcolor[whitebg]{codecolor}{rgb}{0,0.5,0}% \code (additional emphasising command).
+\defineTPcolor[whitebg]{underlcolor}{rgb}{0.7,0,0.3}% \underl (additional emphasising command).
+\defineTPcolor[whitebg]{conceptcolor}{rgb}{0.6,0,0}% \concept (additional emphasising command).
+\defineTPcolor[whitebg]{inactivecolor}{rgb}{0.7,0.7,0.7}% \inactive (additional emphasising command).
+\defineTPcolor[whitebg]{presentcolor}{rgb}{1,1,0.8}% Background color for \present (emphasising command).
+\defineTPcolor[whitebg]{highlightcolor}{rgb}{1,1,0.7}% Background color for \highlight (emphasising command).
+
+\defineTPcolor[whitebg]{buttoncolor}{rgb}{0.8,0.8,0.9}% Background color for buttons.
+\defineTPcolor[whitebg]{buttonshadowcolor}{rgb}{.001,0,.502}% Button shadow.
+\defineTPcolor[whitebg]{buttonframecolor}{gray}{0}% Button frame.
+\defineTPcolor[whitebg]{buttontextcolor}{gray}{0}% Button text.
+
+\defineTPcolor[whitebg]{toppanelcolor}{gray}{0.9}% Top panel background.
+\defineTPcolor[whitebg]{bottompanelcolor}{gray}{0.9}% Bottom panel background.
+\defineTPcolor[whitebg]{leftpanelcolor}{gray}{0.9}% Left panel background.
+\defineTPcolor[whitebg]{rightpanelcolor}{gray}{0.9}% Right panel background.
+\defineTPcolor[whitebg]{toppaneltextcolor}{gray}{0}% Top panel text.
+\defineTPcolor[whitebg]{bottompaneltextcolor}{gray}{0}% Bottom panel text.
+\defineTPcolor[whitebg]{leftpaneltextcolor}{gray}{0}% Left panel text.
+\defineTPcolor[whitebg]{rightpaneltextcolor}{gray}{0}% Right panel text.
+
+
+% Color definitions for `light' background.
+
+\defineTPcolor[lightbg]{pagecolor}{rgb}{1,1,0.9}% Page background (for background style `plain').
+
+\defineTPcolor[lightbg]{bgndstartcolor}{rgb}{1,1,0.8}% Start color for gradient background.
+\defineTPcolor[lightbg]{bgndendcolor}{rgb}{1,1,1}% End color for gradient background.
+\defineTPcolor[lightbg]{bgndmidcolor}{rgb}{0.8,1,0.8}% Middle color for gradient background (`double' gradient).
+
+\defineTPcolor[lightbg]{textcolor}{rgb}{0,0,0.5}% Normal text.
+
+\defineTPcolor[lightbg]{emcolor}{rgb}{0,0,0.8}% Emphasised text (if coloremph option is given).
+\defineTPcolor[lightbg]{altemcolor}{rgb}{0,0.5,0.8}% Double emphasised text (if coloremph option is given).
+
+\defineTPcolor[lightbg]{mathcolor}{rgb}{0,0.4,0}% Math (if colormath option is given).
+
+\defineTPcolor[lightbg]{codecolor}{rgb}{0,0.5,0}% \code (additional emphasising command).
+\defineTPcolor[lightbg]{underlcolor}{rgb}{0.7,0,0.3}% \underl (additional emphasising command).
+\defineTPcolor[lightbg]{conceptcolor}{rgb}{0.6,0,0}% \concept (additional emphasising command).
+\defineTPcolor[lightbg]{inactivecolor}{rgb}{0.7,0.7,0.7}% \inactive (additional emphasising command).
+\defineTPcolor[lightbg]{presentcolor}{rgb}{1,1,1}% Background color for \present (emphasising command).
+\defineTPcolor[lightbg]{highlightcolor}{rgb}{1,1,0.6}% Background color for \highlight (emphasising command).
+
+\defineTPcolor[lightbg]{buttoncolor}{rgb}{0.8,0.8,0.9}% Background color for buttons.
+\defineTPcolor[lightbg]{buttonshadowcolor}{rgb}{.001,0,.502}% Button shadow.
+\defineTPcolor[lightbg]{buttonframecolor}{gray}{0}% Button frame.
+\defineTPcolor[lightbg]{buttontextcolor}{gray}{0}% Button text.
+
+\defineTPcolor[lightbg]{toppanelcolor}{gray}{0.9}% Top panel background.
+\defineTPcolor[lightbg]{bottompanelcolor}{gray}{0.9}% Bottom panel background.
+\defineTPcolor[lightbg]{leftpanelcolor}{gray}{0.9}% Left panel background.
+\defineTPcolor[lightbg]{rightpanelcolor}{gray}{0.9}% Right panel background.
+\defineTPcolor[lightbg]{toppaneltextcolor}{gray}{0}% Top panel text.
+\defineTPcolor[lightbg]{bottompaneltextcolor}{gray}{0}% Bottom panel text.
+\defineTPcolor[lightbg]{leftpaneltextcolor}{gray}{0}% Left panel text.
+\defineTPcolor[lightbg]{rightpaneltextcolor}{gray}{0}% Right panel text.
+
+
+% Color definitions for `dark' background.
+
+\defineTPcolor[darkbg]{pagecolor}{rgb}{0,0,0.4}% Page background (for background style `plain').
+
+\defineTPcolor[darkbg]{bgndstartcolor}{rgb}{0,0,0.2}% Start color for gradient background.
+\defineTPcolor[darkbg]{bgndendcolor}{rgb}{0,0,0.6}% End color for gradient background.
+\defineTPcolor[darkbg]{bgndmidcolor}{rgb}{0,0.3,0.4}% Middle color for gradient background (`double' gradient).
+
+\defineTPcolor[darkbg]{textcolor}{rgb}{1,1,0.6}% Normal text.
+
+\defineTPcolor[darkbg]{emcolor}{rgb}{1,1,0}% Emphasised text (if coloremph option is given).
+\defineTPcolor[darkbg]{altemcolor}{rgb}{1,0.6,0}% Double emphasised text (if coloremph option is given).
+
+\defineTPcolor[darkbg]{mathcolor}{rgb}{1,0.5,1}% Math (if colormath option is given).
+
+\defineTPcolor[darkbg]{codecolor}{rgb}{0,0.7,0}% \code (additional emphasising command).
+\defineTPcolor[darkbg]{underlcolor}{rgb}{0.3,1,0.7}% \underl (additional emphasising command).
+\defineTPcolor[darkbg]{conceptcolor}{rgb}{0.4,1,1}% \concept (additional emphasising command).
+\defineTPcolor[darkbg]{inactivecolor}{rgb}{0.4,0.4,0.4}% \inactive (additional emphasising command).
+\defineTPcolor[darkbg]{presentcolor}{rgb}{0,0,0}% Background color for \present (emphasising command).
+\defineTPcolor[darkbg]{highlightcolor}{rgb}{0,0,0.1}% Background color for \highlight (emphasising command).
+
+\defineTPcolor[darkbg]{buttoncolor}{rgb}{0.4,0.4,0.6}% Background color for buttons.
+\defineTPcolor[darkbg]{buttonshadowcolor}{gray}{0}% Button shadow.
+\defineTPcolor[darkbg]{buttonframecolor}{gray}{0}% Button frame.
+\defineTPcolor[darkbg]{buttontextcolor}{gray}{0}% Button text.
+
+\defineTPcolor[darkbg]{toppanelcolor}{gray}{0.4}% Top panel background.
+\defineTPcolor[darkbg]{bottompanelcolor}{gray}{0.4}% Bottom panel background.
+\defineTPcolor[darkbg]{leftpanelcolor}{gray}{0.4}% Left panel background.
+\defineTPcolor[darkbg]{rightpanelcolor}{gray}{0.4}% Right panel background.
+\defineTPcolor[darkbg]{toppaneltextcolor}{gray}{1}% Top panel text.
+\defineTPcolor[darkbg]{bottompaneltextcolor}{gray}{1}% Bottom panel text.
+\defineTPcolor[darkbg]{leftpaneltextcolor}{gray}{1}% Left panel text.
+\defineTPcolor[darkbg]{rightpaneltextcolor}{gray}{1}% Right panel text.
+
+
+% Color definitions for black background.
+
+\defineTPcolor[blackbg]{pagecolor}{rgb}{0,0,0}% Page background (for background style `plain').
+
+\defineTPcolor[blackbg]{bgndstartcolor}{rgb}{0,0,0}% Start color for gradient background.
+\defineTPcolor[blackbg]{bgndendcolor}{rgb}{0,0,0.2}% End color for gradient background.
+\defineTPcolor[blackbg]{bgndmidcolor}{rgb}{0,0.2,0.2}% Middle color for gradient background (`double' gradient).
+
+\defineTPcolor[blackbg]{textcolor}{rgb}{1,1,0.6}% Normal text.
+
+\defineTPcolor[blackbg]{emcolor}{rgb}{1,1,0}% Emphasised text (if coloremph option is given).
+\defineTPcolor[blackbg]{altemcolor}{rgb}{1,0.5,0}% Double emphasised text (if coloremph option is given).
+
+\defineTPcolor[blackbg]{mathcolor}{rgb}{1,0.5,1}% Math (if colormath option is given).
+
+\defineTPcolor[blackbg]{codecolor}{rgb}{0,0.7,0}% \code (additional emphasising command).
+\defineTPcolor[blackbg]{underlcolor}{rgb}{0.3,1,0.7}% \underl (additional emphasising command).
+\defineTPcolor[blackbg]{conceptcolor}{rgb}{0.4,1,1}% \concept (additional emphasising command).
+\defineTPcolor[blackbg]{inactivecolor}{rgb}{0.4,0.4,0.4}% \inactive (additional emphasising command).
+\defineTPcolor[blackbg]{presentcolor}{rgb}{0,0,0.3}% Background color for \present (emphasising command).
+\defineTPcolor[blackbg]{highlightcolor}{rgb}{0,0,0.4}% Background color for \highlight (emphasising command).
+
+\defineTPcolor[blackbg]{buttoncolor}{rgb}{0.4,0.4,0.6}% Background color for buttons.
+\defineTPcolor[blackbg]{buttonshadowcolor}{gray}{0}% Button shadow.
+\defineTPcolor[blackbg]{buttonframecolor}{gray}{0}% Button frame.
+\defineTPcolor[blackbg]{buttontextcolor}{gray}{0}% Button text.
+
+\defineTPcolor[blackbg]{toppanelcolor}{gray}{0.4}% Top panel background.
+\defineTPcolor[blackbg]{bottompanelcolor}{gray}{0.4}% Bottom panel background.
+\defineTPcolor[blackbg]{leftpanelcolor}{gray}{0.4}% Left panel background.
+\defineTPcolor[blackbg]{rightpanelcolor}{gray}{0.4}% Right panel background.
+\defineTPcolor[blackbg]{toppaneltextcolor}{gray}{1}% Top panel text.
+\defineTPcolor[blackbg]{bottompaneltextcolor}{gray}{1}% Bottom panel text.
+\defineTPcolor[blackbg]{leftpaneltextcolor}{gray}{1}% Left panel text.
+\defineTPcolor[blackbg]{rightpaneltextcolor}{gray}{1}% Right panel text.
+
+
+% The default definitions of TeXPower's standard colors do not include dimmed and enhanced variants, leaving the
+% variants to be calculated automatically. This works quite well for the dimmed variant, but the automatically
+% calculated enhanced variant might not be to everybody's taste. The following example (if uncommented) will define
+% custom enhanced versions of all standard `text body' colors in all color sets which look slightly better than the
+% automatically calculated ones. Note that background and panels are not affected by dimming and enhancing.
+
+%% Enhanced color variants for white background.
+
+% \defineTPcolor[whitebg]{etextcolor}{rgb}{0,0,0.7}% Normal text.
+
+% \defineTPcolor[whitebg]{eemcolor}{rgb}{0,0,1}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[whitebg]{ealtemcolor}{rgb}{0,0.6,0.9}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[whitebg]{emathcolor}{rgb}{0,0.6,0}% Math (if colormath option is given).
+
+% \defineTPcolor[whitebg]{ecodecolor}{rgb}{0,0.6,0}% \code (additional emphasising command).
+% \defineTPcolor[whitebg]{eunderlcolor}{rgb}{0.8,0,0.4}% \underl (additional emphasising command).
+% \defineTPcolor[whitebg]{econceptcolor}{rgb}{0.8,0,0}% \concept (additional emphasising command).
+% \defineTPcolor[whitebg]{einactivecolor}{rgb}{0.6,0.6,0.6}% \inactive (additional emphasising command).
+% \defineTPcolor[whitebg]{epresentcolor}{rgb}{1,1,0.8}% Background color for \present (emphasising command).
+% \defineTPcolor[whitebg]{ehighlightcolor}{rgb}{1,1,0.7}% Background color for \highlight (emphasising command).
+
+
+%% Enhanced color variants for `light' background.
+
+% \defineTPcolor[lightbg]{etextcolor}{rgb}{0,0,0.7}% Normal text.
+
+% \defineTPcolor[lightbg]{eemcolor}{rgb}{0,0,1}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[lightbg]{ealtemcolor}{rgb}{0,0.6,0.9}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[lightbg]{emathcolor}{rgb}{0,0.6,0}% Math (if colormath option is given).
+
+% \defineTPcolor[lightbg]{ecodecolor}{rgb}{0,0.65,0}% \code (additional emphasising command).
+% \defineTPcolor[lightbg]{eunderlcolor}{rgb}{0.8,0,0.4}% \underl (additional emphasising command).
+% \defineTPcolor[lightbg]{econceptcolor}{rgb}{0.8,0,0}% \concept (additional emphasising command).
+% \defineTPcolor[lightbg]{einactivecolor}{rgb}{0.6,0.6,0.6}% \inactive (additional emphasising command).
+% \defineTPcolor[lightbg]{epresentcolor}{rgb}{.95,1,.95}% Background color for \present (emphasising command).
+% \defineTPcolor[lightbg]{ehighlightcolor}{rgb}{1,1,0.4}% Background color for \highlight (emphasising command).
+
+
+%% Enhanced color variants for `dark' background.
+
+% \defineTPcolor[darkbg]{etextcolor}{rgb}{1,1,0.8}% Normal text.
+
+% \defineTPcolor[darkbg]{eemcolor}{rgb}{1,1,0.3}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[darkbg]{ealtemcolor}{rgb}{1,0.8,0}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[darkbg]{emathcolor}{rgb}{1,0.6,1}% Math (if colormath option is given).
+
+% \defineTPcolor[darkbg]{ecodecolor}{rgb}{0,0.9,0}% \code (additional emphasising command).
+% \defineTPcolor[darkbg]{eunderlcolor}{rgb}{0.4,1,0.8}% \underl (additional emphasising command).
+% \defineTPcolor[darkbg]{econceptcolor}{rgb}{0.7,1,1}% \concept (additional emphasising command).
+% \defineTPcolor[darkbg]{einactivecolor}{rgb}{0.5,0.5,0.5}% \inactive (additional emphasising command).
+% \defineTPcolor[darkbg]{epresentcolor}{rgb}{0.1,0,0}% Background color for \present (emphasising command).
+% \defineTPcolor[darkbg]{ehighlightcolor}{rgb}{0,0,0}% Background color for \highlight (emphasising command).
+
+
+%% Enhanced color variants for black background.
+
+% \defineTPcolor[blackbg]{etextcolor}{rgb}{1,1,0.8}% Normal text.
+
+% \defineTPcolor[blackbg]{eemcolor}{rgb}{1,1,0.3}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[blackbg]{ealtemcolor}{rgb}{1,0.4,0}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[blackbg]{emathcolor}{rgb}{1,0.6,1}% Math (if colormath option is given).
+
+% \defineTPcolor[blackbg]{ecodecolor}{rgb}{0,0.9,0}% \code (additional emphasising command).
+% \defineTPcolor[blackbg]{eunderlcolor}{rgb}{0.4,1,0.8}% \underl (additional emphasising command).
+% \defineTPcolor[blackbg]{econceptcolor}{rgb}{0.7,1,1}% \concept (additional emphasising command).
+% \defineTPcolor[blackbg]{einactivecolor}{rgb}{0.5,0.5,0.5}% \inactive (additional emphasising command).
+% \defineTPcolor[blackbg]{epresentcolor}{rgb}{0,0,0.4}% Background color for \present (emphasising command).
+% \defineTPcolor[blackbg]{ehighlightcolor}{rgb}{0,0,0.5}% Background color for \highlight (emphasising command).
+
+
+
+% Remember that the color definitions above only represent _one_ example for a possible color configuration.
+% The following example (if uncommented) completely redefines the standard colors for the darkbackground option. This
+% works for one or all colors of this or other background options by analogy. (Comment out the definition of the
+% darkbackground colors above if convenient.)
+
+%% Color definitions for `dark' background.
+
+% \defineTPcolor[darkbg]{pagecolor}{rgb}{0,0.1,0}% Page background (for background style `plain').
+
+% \defineTPcolor[darkbg]{bgndstartcolor}{rgb}{0,0.05,0}% Start color for gradient background.
+% \defineTPcolor[darkbg]{bgndendcolor}{rgb}{0,0.4,0}% End color for gradient background.
+% \defineTPcolor[darkbg]{bgndmidcolor}{rgb}{0,0.2,0.5}% Middle color for gradient background (`double' gradient).
+
+% \defineTPcolor[darkbg]{textcolor}{rgb}{1,0.6,1}% Normal text.
+
+% \defineTPcolor[darkbg]{emcolor}{rgb}{1,0,1}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[darkbg]{altemcolor}{rgb}{1,0,0.5}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[darkbg]{mathcolor}{rgb}{0.5,1,1}% Math (if colormath option is given).
+
+% \defineTPcolor[darkbg]{codecolor}{rgb}{0.8,0,0}% \code (additional emphasising command).
+% \defineTPcolor[darkbg]{underlcolor}{rgb}{1,0.7,0.3}% \underl (additional emphasising command).
+% \defineTPcolor[darkbg]{conceptcolor}{rgb}{1,1,0.4}% \concept (additional emphasising command).
+% \defineTPcolor[darkbg]{inactivecolor}{rgb}{0.4,0.4,0.4}% \inactive (additional emphasising command).
+% \defineTPcolor[darkbg]{presentcolor}{rgb}{0,0,0}% Background color for \present (emphasising command).
+% \defineTPcolor[darkbg]{highlightcolor}{rgb}{0,0.3,0}% Background color for \highlight (emphasising command).
+
+% \defineTPcolor[darkbg]{buttoncolor}{rgb}{0.4,0.4,0.6}% Background color for buttons.
+% \defineTPcolor[darkbg]{buttonshadowcolor}{gray}{0}% Button shadow.
+% \defineTPcolor[darkbg]{buttonframecolor}{gray}{0}% Button frame.
+% \defineTPcolor[darkbg]{buttontextcolor}{gray}{0}% Button text.
+
+% \defineTPcolor[darkbg]{toppanelcolor}{gray}{0.4}% Top panel background.
+% \defineTPcolor[darkbg]{bottompanelcolor}{gray}{0.4}% Bottom panel background.
+% \defineTPcolor[darkbg]{leftpanelcolor}{gray}{0.4}% Left panel background.
+% \defineTPcolor[darkbg]{rightpanelcolor}{gray}{0.4}% Right panel background.
+% \defineTPcolor[darkbg]{toppaneltextcolor}{gray}{1}% Top panel text.
+% \defineTPcolor[darkbg]{bottompaneltextcolor}{gray}{1}% Bottom panel text.
+% \defineTPcolor[darkbg]{leftpaneltextcolor}{gray}{1}% Left panel text.
+% \defineTPcolor[darkbg]{rightpaneltextcolor}{gray}{1}% Right panel text.
+
+
+% In the usual standard defaults given above, no dimmed or enhanced variants are included, to demonstrate TeXPower's
+% automatic dimming and enhancing capabilities. It is possible, however, to provide `hand-tuned' dimmed and enhanced
+% variants for nicer results. This is done by prefixing "d" or "e" to the color name. In the following, custom dimmed
+% and enhanced variants of some of the colors defined above are specified. Note that background and panels are not
+% affected by dimming and enhancing, so only the `text body' colors are specified.
+
+%% Dimmed color variants for `dark' background.
+
+% \defineTPcolor[darkbg]{dtextcolor}{rgb}{0.5,0.4,0.5}% Normal text.
+
+% \defineTPcolor[darkbg]{demcolor}{rgb}{0.5,0,0.5}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[darkbg]{daltemcolor}{rgb}{0.5,0,0.2}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[darkbg]{dmathcolor}{rgb}{0.2,0.5,0.5}% Math (if colormath option is given).
+
+% \defineTPcolor[darkbg]{dcodecolor}{rgb}{0.5,0,0}% \code (additional emphasising command).
+% \defineTPcolor[darkbg]{dunderlcolor}{rgb}{0.5,0.3,0.1}% \underl (additional emphasising command).
+% \defineTPcolor[darkbg]{dconceptcolor}{rgb}{0.5,0.5,0.2}% \concept (additional emphasising command).
+% \defineTPcolor[darkbg]{dinactivecolor}{rgb}{0.2,0.2,0.2}% \inactive (additional emphasising command).
+% \defineTPcolor[darkbg]{dpresentcolor}{rgb}{0,0.05,0}% Background color for \present (emphasising command).
+% \defineTPcolor[darkbg]{dhighlightcolor}{rgb}{0,0.15,0}% Background color for \highlight (emphasising command).
+
+
+%% Enhanced color variants for `dark' background.
+
+% \defineTPcolor[darkbg]{etextcolor}{rgb}{1,0.8,1}% Normal text.
+
+% \defineTPcolor[darkbg]{eemcolor}{rgb}{1,0.2,1}% Emphasised text (if coloremph option is given).
+% \defineTPcolor[darkbg]{ealtemcolor}{rgb}{1,0.2,0.7}% Double emphasised text (if coloremph option is given).
+
+% \defineTPcolor[darkbg]{emathcolor}{rgb}{0.7,1,1}% Math (if colormath option is given).
+
+% \defineTPcolor[darkbg]{ecodecolor}{rgb}{1,0,0}% \code (additional emphasising command).
+% \defineTPcolor[darkbg]{eunderlcolor}{rgb}{1,0.9,0.5}% \underl (additional emphasising command).
+% \defineTPcolor[darkbg]{econceptcolor}{rgb}{1,1,0.6}% \concept (additional emphasising command).
+% \defineTPcolor[darkbg]{einactivecolor}{rgb}{0.5,0.5,0.5}% \inactive (additional emphasising command).
+% \defineTPcolor[darkbg]{epresentcolor}{rgb}{0.2,0,0}% Background color for \present (emphasising command).
+% \defineTPcolor[darkbg]{ehighlightcolor}{rgb}{0,0.4,0}% Background color for \highlight (emphasising command).
+
+
+
+% The following example (if uncommented) shows what is neccessary for defining a completely new standard color which is
+% recognized by TeXPower commands like \dimcolors, \enhancecolors (and display commands using those) as well as the
+% commands \whitebackground, \lightbackground, \darkbackground, and \blackbackground.
+%
+% If you don't want to give different definitions of your color for different backgrounds, you can define it just in the
+% current color set (leaving out the optional argument to \defineTPcolor), but then it will stay the same on all
+% backgrounds and not be adapted when the background color changes.
+%
+% You don't have to define dimmed and enhanced variants of your color (with prefix d and e, respectively). If you just
+% leave them out, TeXPower will calculate appropriate variants automatically.
+
+% \defineTPcolor[whitebg]{mycolor}{rgb}{1,0.5,0}% Variants of mycolor for white backgrounds.
+% \defineTPcolor[whitebg]{dmycolor}{rgb}{0.9,0.8,0.6}%
+% \defineTPcolor[whitebg]{emycolor}{rgb}{1,0.7,0}%
+% %
+% \defineTPcolor[lightbg]{mycolor}{rgb}{1,0.5,0}% Variants of mycolor for light backgrounds.
+% \defineTPcolor[lightbg]{dmycolor}{rgb}{0.9,0.8,0.6}%
+% \defineTPcolor[lightbg]{emycolor}{rgb}{1,0.7,0}%
+% %
+% \defineTPcolor[darkbg]{mycolor}{rgb}{0,0.5,1}% Variants of mycolor for dark backgrounds.
+% \defineTPcolor[darkbg]{dmycolor}{rgb}{0.1,0.2,0.4}%
+% \defineTPcolor[darkbg]{emycolor}{rgb}{0,0.3,1}%
+% %
+% \defineTPcolor[blackbg]{mycolor}{rgb}{0,0.5,1}% Variants of mycolor for black backgrounds.
+% \defineTPcolor[blackbg]{dmycolor}{rgb}{0.1,0.2,0.4}%
+% \defineTPcolor[blackbg]{emycolor}{rgb}{0,0.3,1}%
+
+%KEEPCOMMENTS
+%</tpcolors>
+%=======================================================================================================================
+%<*tpoptions>
+%<<KEEPCOMMENTS
+%=======================================================================================================================
+% File: tpoptions.cfg
+%
+% System-specific configuration of options defined by the texpower package.
+%
+%=======================================================================================================================
+
+% The following example (if uncommented) will turn on the display option by default.
+
+%\ExecuteOptions{display}
+
+%KEEPCOMMENTS
+%</tpoptions>
+%=======================================================================================================================
+%<*tpsettings>
+%<<KEEPCOMMENTS
+%=======================================================================================================================
+% File: tpsettings.cfg
+%
+% System-specific configuration of defaults defined by the texpower package.
+%
+%=======================================================================================================================
+
+
+%KEEPCOMMENTS
+%</tpsettings>
+\endinput
diff --git a/Master/texmf-dist/source/latex/texpower/texpower-doc.dtx b/Master/texmf-dist/source/latex/texpower/texpower-doc.dtx
new file mode 100644
index 00000000000..12da428ead6
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/texpower-doc.dtx
@@ -0,0 +1,7653 @@
+% \iffalse meta-comment
+% --------------------------------------------------------------
+% TeXPower bundle - dynamic online presentations with LaTeX
+% Copyright (C) 1999-2004 Stephan Lehmke
+%
+% 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.
+% --------------------------------------------------------------
+%
+% texpower-doc.dtx,v 1.3 2004/07/27 16:19:55 hansfn Exp
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\documentclass{article}
+\begin{document}
+\typeout{***********************************************************}
+\typeout{*}
+\typeout{*\space\space\space\space\space\space\space Do NOT compile this dtx file!}
+\typeout{*}
+\typeout{***********************************************************}
+\end{document}
+%</driver>
+%
+% \fi
+%
+%<faq-disp>\ProvidesFile{FAQ-display.tex}%
+%<faq-print>\ProvidesFile{FAQ-printout.tex}%
+%<faq-disp|faq-print> [2004/07/27 TeXPower FAQ]
+%
+%<manual>\ProvidesFile{manual.tex}%
+%<manual> [2004/07/27 TeXPower manual]
+%<fulldemo>\ProvidesFile{fulldemo.tex}%
+%<fulldemo> [2004/07/27 TeXPower full demo and manual]
+%
+%<bckwrdexample>\ProvidesFile{bckwrdexample.tex}%
+%<bgndexample>\ProvidesFile{bgndexample.tex}%
+%<divexample>\ProvidesFile{divexample.tex}%
+%<fancyexample>\ProvidesFile{fancyexample.tex}%
+%<foilsdemo>\ProvidesFile{foilsdemo.tex}%
+%<hilitexample>\ProvidesFile{hilitexample.tex}%
+%<ifmslidemo>\ProvidesFile{ifmslidemo.tex}%
+%<mathexample>\ProvidesFile{mathexample.tex}%
+%<panelexample>\ProvidesFile{panelexample.tex}%
+%<parexample>\ProvidesFile{parexample.tex}%
+%<pdfscrdemo>\ProvidesFile{pdfscrdemo.tex}%
+%<pdfslidemo>\ProvidesFile{pdfslidemo.tex}%
+%<picexample>\ProvidesFile{picexample.tex}%
+%<pp4sldemo>\ProvidesFile{pp4sldemo.tex}%
+%<prosperdemo>\ProvidesFile{prosperdemo.tex}%
+%<seminardemo>\ProvidesFile{seminardemo.tex}%
+%<simpledemo>\ProvidesFile{simpledemo.tex}%
+%<slidesdemo>\ProvidesFile{slidesdemo.tex}%
+%<spanelexample>\ProvidesFile{spanelexample.tex}%
+%<tabexample>\ProvidesFile{tabexample.tex}%
+%<bckwrdexample|bgndexample|divexample|fancyexample|foilsdemo|hilitexample|ifmslidemo> [2004/07/27 TeXPower example file]
+%<mathexample|panelexample|parexample|pdfscrdemo|pdfslidemo|picexample|pp4sldemo> [2004/07/27 TeXPower example file]
+%<prosperdemo|seminardemo|simpledemo|slidesdemo|spanelexample|tabexample> [2004/07/27 TeXPower example file]
+%
+% \CheckSum{0}
+%
+% \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 \~}
+%
+%<*config>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: __TPcfg.tex
+%
+% Code for user-specific configuration of TeXPower documentation files.
+%
+% This file is input by others. Don't compile it separately.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 22, 2000: First version for the pre-alpha release of TeXPower.
+%
+\hypersetup{baseurl={http://texpower.sourceforge.net/doc/}}
+\hypersetup{pdfsubject={Documentation and Examples for the texpower package}}
+\hypersetup{pdfauthor={Stephan Lehmke}}
+%KEEPCOMMENTS
+%</config>
+%=================================================================================================================
+%<*preamble>
+%<<KEEPCOMMENTS
+%
+\documentclass
+[%
+%-----------------------------------------------------------------------------------------------------------------
+% Document class options:
+% -----------------------
+%
+% Landscape slides formatted for letter paper fit most screen resolutions (more or less).
+%
+ letterpaper,%
+ landscape,%
+%
+% The KOMA option makes powersem load scrartcl.cls instead of article.cls.
+%
+ KOMA,%
+% KOMA document class options are accepted.
+ smallheadings,%
+%
+% The calcdimensions option makes powersem calculate the slide dimensions automatically from paper size and margins.
+ calcdimensions,%
+%
+% The display option sets everything up for producing slides to be displayed interactively.
+% This option is also recognized by the texpower package.
+%
+ display%
+%-----------------------------------------------------------------------------------------------------------------
+]
+%-----------------------------------------------------------------------------------------------------------------
+% Document class powersem, based on seminar.cls for simulating ppower via latex+distiller (instead of pdflatex).
+%
+{powersem}
+%-----------------------------------------------------------------------------------------------------------------
+%
+% First part of the preamble of TeXPower demos.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+% v0.0.2 Mar 21, 2000: Remedying an incompatibility between LaTeX releases concerning the implementation of
+% \@iiiparbox (Apr 11: this code is now part of texpower.sty).
+% v0.0.3 Apr 11, 2000: Color emphasis code moved into texpower.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+% Set slide margins rather small for maximum use of space. This is a demo, remember.
+%
+\renewcommand{\slidetopmargin}{5mm}
+\renewcommand{\slidebottommargin}{5mm}
+
+\renewcommand{\slideleftmargin}{5mm}
+\renewcommand{\sliderightmargin}{5mm}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Some setup for more reasonable spacing.
+%
+
+\makeatletter
+
+\renewcommand\section{\@startsection{section}{1}{\z@}%
+ {-1.5ex\@plus -1ex \@minus -.5ex}%
+ {.5ex \@plus .2ex}%
+ {\raggedsection\normalfont\size@section\sectfont}}
+
+\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
+ {-1.25ex\@plus -1ex \@minus -.2ex}%
+ {.5ex \@plus .2ex}%
+ {\raggedsection\normalfont\size@subsection\sectfont}}
+
+\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
+ {-1.25ex\@plus -1ex \@minus -.2ex}%
+ {.5ex \@plus .2ex}%
+ {\raggedsection\normalfont\size@subsubsection\sectfont}}
+
+\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
+ {1.25ex \@plus1ex \@minus.2ex}%
+ {-1em}%
+ {\raggedsection\normalfont\size@paragraph\sectfont}}
+
+\def\slideitemsep{.5ex plus .3ex minus .2ex}
+
+\makeatother
+
+%-----------------------------------------------------------------------------------------------------------------
+% We need some more packages...
+%
+
+\usepackage{url}
+
+\usepackage[latin1]{inputenc}
+
+% One more Text emphasis command...
+
+\let\name=\textsc
+
+% Second part of the preamble of TeXPower demos.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+% v0.0.2 Mar 22, 2000: Now loading the config file.
+% v0.0.3 Mar 29, 2000: texpower doesn't load hyperref any more; there's now a package fixseminar.
+% v0.0.4 Apr 19, 2000: Added \slidetitle command.
+% v0.0.5 Sep 11, 2000: Added plainpages=false to the hyperref options to get correct page anchors.
+% v0.0.5 Sep 11, 2002: Slight changes to title page.
+%
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% We load hyperref and fixseminar which fixes some problems with seminar.
+%
+\usepackage[plainpages=false,bookmarksopen,colorlinks,urlcolor=red,pdfpagemode=FullScreen]{hyperref}
+\usepackage{fixseminar}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, the texpower package is loaded.
+%
+\usepackage{texpower}
+
+%% The configuration file allows user-specific settings.
+
+\input{__TPcfg}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Some more parameters...
+%
+\slidesmag{5}
+\slideframe{none}
+\pagestyle{empty}
+\setcounter{tocdepth}{2}
+\renewcommand{\currentpagevalue}{\value{slide}}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The following command produces a title page for every example and documentation file.
+
+\newcommand{\makeslidetitle}[1]
+{%
+ \title{The \TeX Power bundle\\[2ex]{\normalfont #1}}
+ \author
+ {%
+ Stephan Lehmke\\
+ \mdseries
+ University of Dortmund\\
+ \mdseries
+ Department of Computer Science I\\
+ \url{mailto:Stephan.Lehmke@udo.edu}%
+ }
+ {\centerslidestrue
+ \maketitle
+ \newslide}
+ \setcounter{firststep}{1}% This way, the first step of all examples is displayed.
+}
+%KEEPCOMMENTS
+%</preamble>
+%=================================================================================================================
+%<*indexing>
+%<<KEEPCOMMENTS
+%
+% Setting up indexing for the TeXPower fulldemo and manual.
+%
+%-----------------------------------------------------------------------------------------------------------------
+
+\usepackage{makeidx}
+\makeindex
+\newcommand{\indexcode}[1]{\index{#1@\code{#1}}}
+\newcommand{\indexmacro}[1]{\index{#1@\macroname{#1}}}
+\newcommand{\indexmacroopt}[2]{%
+ \index{#1 macro options@\macroname{#1} macro options!#2@\code{#2}}%
+ \index{#2@\code{#2}|see{\macroname{#1} macro options}}}
+\newcommand{\indexfile}[2]{\index{#1@\code{#1} #2}}
+\newcommand{\indexpckopt}[2]{%
+ \index{#1 package options@\code{#1} package options!#2@\code{#2}}%
+ \index{#2@\code{#2}|see{\code{#1} package options}}}
+\newcommand{\indexpckswitch}[2]{%
+ \index{#1 package switches@\code{#1} package switches!#2@\code{#2}}%
+ \index{#2@\code{#2}|see{\code{#1} package switches}}}
+\newcommand{\indexstepwise}[2]{%
+ \index{stepwise@\macroname{stepwise}!#1@\code{#1} (#2)}%
+ \index{#1@\code{#1}|see{\macroname{stepwise}}}}
+
+%KEEPCOMMENTS
+%</indexing>
+%=================================================================================================================
+%<*faq-disp>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: FAQ-display.tex
+%
+% Frequently Asked Questions list for the TeXPower bundle (screen version).
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 FAQ-display
+%
+% afterwards processing the resulting ps file with
+%
+% distill FAQ-display.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 31, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Jun 14, 2000: Changed slidesmag to 4 so slides look less `squeezed'. The `display' version is for demonstrating
+% effects, not a template for `real' presentations.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+% Enable all color emphasis and highlighting options; use a light background and slifonts.
+
+\PassOptionsToPackage{coloremph,colormath,colorhighlight,lightbackground}{texpower}
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={TeXPower Frequently Asked Questions list}}
+
+\slidesmag{4}
+
+% The package soul is needed for \highlighttext to work.
+
+\usepackage{soul}
+
+
+% The following package makes code look a little nicer, but it may not be present on all systems.
+
+\IfFileExists{cmtt.sty}{\usepackage[override]{cmtt}}{}
+
+\usepackage{fancyvrb}
+
+\usepackage{array}
+
+\usepackage{longtable}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</faq-disp>
+%=================================================================================================================
+%<*faq-print>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: FAQ-printout.tex
+%
+% Frequently Asked Questions list for the TeXPower bundle (printout version).
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 31, 2000: First version for the pre-alpha release of TeXPower.
+%
+
+\documentclass[12pt]{scrartcl}
+
+%-----------------------------------------------------------------------------------------------------------------
+% We need some more packages...
+%
+
+\usepackage{url}
+
+\usepackage[latin1]{inputenc}
+
+% The following package makes code look a little nicer, but it may not be present on all systems.
+
+\IfFileExists{cmtt.sty}{\usepackage[override]{cmtt}}{}
+
+% Loading the soul package enables the \highlighttext command.
+
+\usepackage{soul}
+
+% One more Text emphasis command...
+
+\let\name=\textsc
+
+
+\usepackage{fancyvrb}
+
+\usepackage{array}
+
+\usepackage{longtable}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Load hyperref.
+%
+\usepackage[bookmarksopen,colorlinks]{hyperref}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, the texpower package is loaded.
+%
+\usepackage{texpower}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The configuration file allows user-specific settings.
+
+\input{__TPcfg}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The code in the file __TPFAQ is meant for the document class seminar. Thus, it contains some seminar-specific commands
+% which are replaced by dummies here.
+
+\let\newslide=\relax
+
+%-----------------------------------------------------------------------------------------------------------------
+% The following command produces the title for this document.
+
+\newcommand{\makeslidetitle}[1]
+{%
+ \hypersetup{pdftitle={#1}}
+ \title{The \TeX Power bundle\\{\normalfont #1}}
+ \author{Stephan Lehmke\\\url{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+ \maketitle
+}
+
+ \tolerance 1414
+ \hbadness 1414
+ \emergencystretch 1.5em
+ \hfuzz 0.3pt
+ \vfuzz \hfuzz
+ \relax
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+
+\begin{document}
+%KEEPCOMMENTS
+%</faq-print>
+%=================================================================================================================
+%<*faq>
+%<<KEEPCOMMENTS
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 31, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Jun 9, 2000: Some additions in the `problems' and `how to' section.
+%
+% v0.0.3 Jun 15, 2000: Additions in the `usage', `how to', and `problems' sections.
+%
+% v0.0.4 Jun 22, 2000: Additions in the `usage' and `problems' section.
+%
+% v0.0.5 May 15, 2003: Update related to move to SourceForge.net.
+%
+\def\docversion{v0.0.5 of May 15, 2003}
+\def\tpversion{v0.0.9d of May 15, 2003}
+
+\providecommand{\vanishcolor}{}
+
+\DefineVerbatimEnvironment{LaTeXCode}{Verbatim}
+{gobble=2,formatcom=\codeswitch,frame=single,numbers=left,xleftmargin=1em,numbersep=.5em}
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle
+{%
+ Frequently asked questions list%
+ \thanks{FAQ \docversion\ for \TeX Power \tpversion\ (alpha).}%
+ }%
+
+\setcounter{firststep}{0}
+
+\tableofcontents
+
+\newslide
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\section{General}
+\subsection{Where can I get the newest version of the \TeX Power FAQ\,?}
+You can download the latest version of the \TeX Power FAQ from the following URLs:
+
+\begin{center}
+Screen version:\\
+\url{http://texpower.sourceforge.net/doc/FAQ-display.pdf}
+
+Printout version:\\
+\url{http://texpower.sourceforge.net/doc/FAQ-printout.pdf}
+\end{center}
+
+
+\newslide
+
+\subsection{What is \TeX Power\,?}
+The \TeX Power bundle contains style and class files for creating dynamic online presentations with \LaTeX.
+
+The heart of the bundle is the package \code{texpower.sty} which implements some commands for presentation effects. This
+includes setting page transitions, color highlighting and displaying pages incrementally.
+
+The document class \code{powersem.cls} is a wrapper for seminar which sets up everything for dynamic presentations.
+
+
+\newslide
+
+\subsection{Where can I obtain \TeX Power\,?}
+The complete bundle, together with its documentation, can be found under the URL
+\begin{center}
+ \url{http://texpower.sourceforge.net/}
+\end{center}
+
+\newslide
+
+\subsection{Where can I discuss \TeX Power or ask for help\,?}
+Bug and problem reports should go to
+\href{http://sourceforge.net/tracker/?group_id=60743&atid=495145}{the bug tracker}.
+
+Discussions about \TeX Power should take place on
+\href{http://lists.sourceforge.net/lists/listinfo/texpower-users/}{the mailing list}
+or in
+\href{http://sourceforge.net/forum/forum.php?forum_id=204738}{the discussion forum}.
+
+
+\newslide
+
+\subsection{What alternatives are there to using \TeX Power\,?}
+The most prominent alternative to \TeX Power is the \concept{Pdf Presentation Post Processor} PPower4, the homepage of
+which is
+\begin{quote}
+ \url{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/}
+\end{quote}
+
+Another alternative is the \concept{Utopia PDF Presentations Bundle}, which provides a complete presentation design
+environment. Its home page is
+\begin{quote}
+ \url{http://www.utopiatype.com.au/products/ubundle.html}
+\end{quote}
+
+Comparisons of different presentation packages can be found on the home page of \name{Prof.\,D.\,P.\,Story}:
+\begin{quote}
+ \url{http://www.math.uakron.edu/~dpstory/pdf_demos.html}
+\end{quote}
+and in the talk held by \name{Ross Moore} at the \name{California Institute of Technology} on 8th May 2000:
+\begin{quote}
+ \url{http://www.cds.caltech.edu/caltex/2000/}
+\end{quote}
+
+
+
+
+
+\newslide
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\section{Usage}
+
+\subsection{How do I design a presentation with \TeX Power\,?}
+It should be stressed that \TeX Power is \underl{not} (currently) a complete presentation package. It just adds dynamic
+presentation effects (and some other gimmicks specifically interesting for dynamic presentations) and should always be
+combined with a document class dedicated to designing presentations (or a package like
+\href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfslide.html}{\code{pdfslide}}).
+
+There are demos in the \href{http://texpower.sourceforge.net/doc/}{\code{doc}} directory for most
+popular presentation-making document classes and packages.
+
+
+\newslide
+
+\subsection{I find \TeX Power very complicated. How can I learn how to realize dynamic effects\,?}
+
+As always with \TeX, you should first make up your mind what kind of effect you desire, and what \LaTeX{} structures
+will be involved.
+
+Then you should check the examples in the \href{http://texpower.sourceforge.net/doc/}{\code{doc}}
+directory for anything similar to what you want. If you find anything suitable, read the corresponding code. There are
+some inline comments to explain what's going on. Print out the
+\href{http://texpower.sourceforge.net/doc/manual.pdf}{\code{manual}} for documentation of the \TeX
+Power commands.
+
+Further `recepies' can be found in section \ref{Sec:HowTo}.
+
+If you don't find anything suitable you can modify to your needs, and can't figure out from the documentation how to
+achieve your aims, please ask on
+\href{http://lists.sourceforge.net/lists/listinfo/texpower-users/}{the mailing list}. If
+you've found an application for \TeX Power not covered by the examples, a new example should be created.
+
+
+\newslide
+
+\subsection{Can I combine \TeX Power with PPower4\,?}
+There is no problem postprocessing documents in which \TeX Power is used. This can be useful, for instance, for
+realising structured backgrounds with the \code{background} package from the
+\href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/}{PPower4 bundle}.
+
+If there are presentation effects for which you'd like to use PPower4's implementation of the \macroname{pause} command,
+then just load PPower4's \code{pause} package. PPower4's definition of \macroname{pause} will override
+\code{texpower}'s. Then you can combine PPower4's \macroname{pause} functionality with \TeX Power's \macroname{stepwise}
+functionality, for maximum expressive power.
+
+\newslide
+
+\subsection{I'm missing some of the classes and packages used in the demo and example files.}
+
+First of all, it has to be said that \TeX Power makes use of some `modern' features which have been introduced into the
+\TeX{} System quite recently and are evolving swiftly. The core of the \code{texpower} package, namely the commands
+\macroname{pause} and \macroname{stepwise} is implemented in `pure' \LaTeX{} and should be largely independent of any
+fancy extensions, but to get most out of \TeX Power's presentation features and process the more advanced examples, it
+is recommended to have a moderately new \TeX{} distribution installed (rule of thumb: not older than one year).
+
+But even if your distribution is quite new, it might not contain some of the classes and packages used by the demos and
+examples. Here's a list of (hopefully all of) the packages and classes used (which are not part of core \LaTeX) and
+their availability:
+
+
+\newlength{\twidth}%
+{%
+ \makeatletter
+ \ifthenelse{\boolean{display}}{\def\@outputpage{\setbox\@cclv\box\@outputbox\slide@output}}{}%
+ \makeatother
+ \setlength{\twidth}{\linewidth-\widthof{\code{pdfscreen}}-2cm-6\tabcolsep}%
+\begin{longtable}{lp{2cm}>{\raggedright\footnotesize}p{\twidth}}
+ Package&used in&\normalsize available from\tabularnewline\hline\endhead
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/hyperref.html}{\code{hyperref}}&most
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/hyperref}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/url.html}{\code{url}}&most
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/other/misc}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}}&many
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/soul}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pstricks.html}{\code{pstricks}}
+ &\small\code{fulldemo}, \code{picexample}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\ \url{ftp://ftp.dante.de/tex-archive/graphics/pstricks}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/xr.html}{\code{xr-hyper}}
+ &\small\code{manual}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/hyperref}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/fancyvrb.html}{\code{fancyvrb}}
+ &\small\code{FAQ}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/fancyvrb}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfscreen.html}{\code{pdfscreen}}
+ &\small\code{pdfscrdemo}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/pdfscreen}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfslide.html}{\code{pdfslide}}
+ &\small\code{pdfslidemo}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/pdfslide}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/ppower4.html}{\code{pp4slide}}
+ &\small\code{pp4sldemo}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/support/ppower4/pp4sty.zip}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/ifmslide.html}{\code{ifmslide}}
+ &\small\code{ifmslidemo}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/ifmslide}
+ \tabularnewline
+\end{longtable}
+}
+
+{%
+ \makeatletter
+ \ifthenelse{\boolean{display}}{\def\@outputpage{\setbox\@cclv\box\@outputbox\slide@output}}{}%
+ \makeatother
+ \setlength{\twidth}{\linewidth-\widthof{\code{scrartcl}}-2cm-6\tabcolsep}%
+\begin{longtable}{lp{2cm}>{\raggedright\footnotesize}p{\twidth}}
+ Class&used in&\normalsize available from\tabularnewline\hline\endhead
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/seminar.html}{\code{seminar}}&most
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/other/seminar}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/koma-script.html}{\code{scrartcl}}&most
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/contrib/supported/koma-script}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/slides.html}{\code{slides}}
+ &\small\code{slidesdemo}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/macros/latex/base/}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/foiltex.html}{\code{foils}}
+ &\small\code{foilsdemo}, \code{pp4sldemo}
+ &\href{http://www.ctan.org/}{CTAN}, e.\,g.\
+ \url{ftp://ftp.dante.de/tex-archive/nonfree/macros/latex/contrib/supported/foiltex}
+ \tabularnewline
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/prosper.html}{\code{prosper}}
+ &\small\code{prosperdemo}
+ &\url{http://prosper.sourceforge.net/}
+ \tabularnewline
+\end{longtable}
+}
+
+\newslide
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\section{How do I\dots}\label{Sec:HowTo}
+
+\subsection{How can I incrementally display a paragraph of text\,?}\label{Q:Par}
+
+The easiest solution is to use \macroname{parstepwise}, but if the arguments of \macroname{step} are long, you'll get
+problems with line breaks, as \macroname{parstepwise} forces \macroname{step} to put its argument in a box.
+
+You can use \macroname{hidetext} like this:
+
+\begin{LaTeXCode}
+ \stepwise[\let\hidestepcontents=\hidetext]
+ {\step{Line breaks} \step{work in here.}}
+\end{LaTeXCode}
+
+
+\stepwise[\let\hidestepcontents=\hidetext]
+{%
+ \ifthenelse{\boolean{display}}
+ {%
+ yields
+ \present
+ {%
+ \begin{minipage}{7em}
+ \step{Line breaks} \step{work in here.}
+ \end{minipage}%
+ }
+ }
+ {}
+
+ But note that \macroname{hidetext}, being implemented using the \code{soul} package, is quite fragile (compare
+ \ref{Sec:hidetext}).
+
+ }
+
+\newslide
+
+If you're not using structured backgrounds, \macroname{hidevanish} is another alternative which can be used exactly like
+\macroname{hidetext}, but is much more robust (note that this will fail whenever your text should appear in front of
+different background colors, for any reason).
+
+In the argument of \macroname{hidevanish}, which uses \macroname{textcolor}, paragraph breaks are not allowed. Using
+\macroname{vstep} is a little less restrictive:
+
+
+\begin{LaTeXCode}
+ \stepwise
+ {%
+ {\vstep Line and paragraph breaks
+ \vstep work in here.\par Yeah!}%
+ }
+\end{LaTeXCode}
+
+\stepwise[\renewcommand{\vanishcolor}{presentcolor}]
+{%
+ \ifthenelse{\boolean{display}}
+ {%
+ yields
+ \present
+ {%
+ \begin{minipage}{13em}
+ \vstep Line and paragraph breaks \vstep work in here.\par Yeah!
+ \end{minipage}%
+ }
+ }
+ {}
+}
+
+\newslide
+
+To facilitate the decision, here's a side-by-side comparison of the pros and cons:
+
+\macroname{parstepwise}:
+\begin{itemize}
+\item[\origmath{+}] robust
+\item[\origmath{+}] works with structured backgrounds
+\item[\origmath{-}] no automatic line breaks in \macroname{step}'s argument
+\item[\origmath{-}] no paragraph breaks in \macroname{step}'s argument
+\end{itemize}
+
+\macroname{hidetext}:
+\begin{itemize}
+\item[\origmath{-}] very fragile
+\item[\origmath{+}] works with structured backgrounds
+\item[\origmath{+}] allows automatic line breaks in \macroname{step}'s argument
+\item[\origmath{-}] no paragraph breaks in \macroname{step}'s argument
+\end{itemize}
+
+\newslide
+
+\macroname{hidevanish}:
+\begin{itemize}
+\item[\origmath{+}] robust
+\item[\origmath{-}] fails with structured backgrounds
+\item[\origmath{+}] allows automatic line breaks in \macroname{step}'s argument
+\item[\origmath{-}] no paragraph breaks in \macroname{step}'s argument
+\end{itemize}
+
+\macroname{vstep}:
+\begin{itemize}
+\item[\origmath{+}] very robust
+\item[\origmath{-}] fails with structured backgrounds
+\item[\origmath{+}] allows automatic line breaks
+\item[\origmath{+}] allows paragraph breaks
+\end{itemize}
+
+\newslide
+
+
+\subsection{Instead of making text appear `out of nowhere', I'd rather just change colors from `dimmed' to normal.}
+
+There are some analogies between this item and \ref{Q:Par}.
+
+If you're using \code{texpower}'s standard colors, probably \macroname{hidedimmed} does what you want:
+
+\begin{LaTeXCode}
+ \stepwise[\let\hidestepcontents=\hidedimmed]
+ {%
+ \step{This works with} \step{\emph{all}}
+ \step{\highlighttext{highlighting} commands.}%
+ }
+\end{LaTeXCode}
+
+\stepwise[\let\hidestepcontents=\hidedimmed]
+{%
+ \ifthenelse{\boolean{display}}
+ {%
+ yields
+ \present
+ {%
+ \begin{minipage}{10em}
+ \step{This works with} \step{\emph{all}} \step{\highlighttext{highlighting} commands.}
+ \end{minipage}%
+ }
+ }
+ {}
+ }
+
+\newslide
+
+In the argument of \macroname{hidedimmed}, which uses \macroname{textcolor}, paragraph breaks are not allowed. Using
+\macroname{dstep} is a little less restrictive. The following achieves the same result as above:
+
+\begin{LaTeXCode}
+ \stepwise
+ {%
+ \dstep This works with \dstep \emph{all}
+ \dstep \highlighttext{highlighting} commands.%
+ }
+\end{LaTeXCode}
+
+\newslide
+
+If the dimmed colors look too fancy to you, you can also use \macroname{vstep} for this purpose, setting
+\macroname{vanishcolor} to some `dimmed' color:
+
+\begin{LaTeXCode}
+ \stepwise[\renewcommand{\vanishcolor}{inactivecolor}]
+ {%
+ \vstep This works with \vstep \emph{all}
+ \vstep \highlighttext{highlighting} commands.%
+ }
+\end{LaTeXCode}
+
+\stepwise[\renewcommand{\vanishcolor}{inactivecolor}]
+{%
+ \ifthenelse{\boolean{display}}
+ {%
+ yields
+ \present
+ {%
+ \begin{minipage}{10em}
+ \vstep This works with \vstep \emph{all} \vstep \highlighttext{highlighting} commands.
+ \end{minipage}%
+ }
+ }
+ {}
+ }
+
+Achieving the same with \macroname{hidevanish} is left as an exercise to the reader.
+
+\newslide
+
+\subsection{\macroname{dstep} and \macroname{hidedimmed} work only with \code{texpower}'s standard colors. How can I dim
+ my own colors\,?}
+
+\code{texpower} maintains a list of colors which will be affected by \macroname{dimcolors} (which is behind
+\macroname{dstep} and \macroname{hidedimmed}).
+
+You can add your own colors to this list by issuing \commandapp{addTPcolor}{mycolor}. Then you only have to define
+another color \code{dmycolor} which will be replaced for \code{mycolor} automatically when \macroname{dimcolors} is
+executed.
+
+\newslide
+
+For instance:
+{\small
+\begin{LaTeXCode}
+ \definecolor{mycolor}{rgb}{1,0.5,0}%
+ \definecolor{dmycolor}{rgb}{0.9,0.8,0.6}%
+ \addTPcolor{mycolor}
+ \stepwise
+ {\dstep My \emph{own} \dstep \textcolor{mycolor}{color}.}
+\end{LaTeXCode}
+}%
+
+\ifthenelse{\boolean{display}}
+{%
+ \definecolor{mycolor}{rgb}{1,0.5,0}%
+ \definecolor{dmycolor}{rgb}{0.9,0.8,0.6}%
+ \addTPcolor{mycolor}%
+ \liststepwise
+ {%
+ yields
+ \present
+ {%
+ \dstep My \emph{own} \dstep \textcolor{mycolor}{color}.
+ }
+ }
+ }
+{}
+
+Note that if you ever wish to use \macroname{enhancecolors} or \macroname{highlightenhanced}, you'll also need an
+\emph{enhanced} version of your new color named \code{emycolor}.
+
+If you wish to use one of the commands \macroname{whitebackground}, \macroname{lightbackground},
+\macroname{darkbackground}, or \macroname{blackbackground}, you'll need even more variants of your new color. In this
+case, you'll better define it in the file \code{tpsettings.cfg} (which contains an example).
+
+
+\newslide
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\section{Problems}
+
+\subsection{I'm loading the \code{texpower} package, but dynamic features don't seem to work.}
+
+Remember that you have to turn on dynamic features explicitly by giving the \code{display} option either to
+\code{texpower} or as a global option. Otherwise, a printout version of your document is produced.
+
+\newslide
+
+\subsection{When I use the \code{colormath} option, my displayed formulae are not colored.}
+
+Don't use the \TeX{} environment \code{\$\$}\dots\code{\$\$} for displayed formulae if you want to profit from math
+coloring.
+
+\code{texpower} supports \LaTeX's environments \macroname{[}\dots\macroname{]}, \code{displaymath}, \code{equation},
+\code{eqnarray}, and \code{eqnarray*}. It also works with the diverse displayed math environments from the
+\href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/amsmath.html}{\code{amsmath}} package.
+
+Replacing \code{\$\$}\dots\code{\$\$} everywhere by \macroname{[}\dots\macroname{]} should solve this problem.
+
+\newslide
+
+\subsection{It seems I can't use \macroname{vfill} in combination with \macroname{pause}.}
+
+This is a problem indeed, as \LaTeX{} never gets to see anything after \macroname{pause} when the first part of the
+sequence is produced. You can use \macroname{vfill} with \macroname{stepwise} if you
+\begin{enumerate}
+\item use a configuration where \macroname{step} leaves blank space (to ensure proper vertical spacing);
+\item put \emph{all} \macroname{vfill}s into the argument of \macroname{stepwise}, \emph{outside} the argument of any
+ \macroname{step}.
+\end{enumerate}
+
+For instance:
+
+\begin{LaTeXCode}
+ \parstepwise
+ {\step{One.}\vfill\step{Two.}\vfill\step{Three.}}
+\end{LaTeXCode}
+
+\parstepwise
+{%
+ \ifthenelse{\boolean{display}}
+ {%
+ yields
+ \present
+ {%
+ \begin{minipage}[c][10ex][s]{10em}
+ \step{One.}\vfill\step{Two.}\vfill\step{Three.}
+ \end{minipage}
+ }
+ }
+ {}
+ }
+
+
+\newslide
+
+\subsection{When I use \LaTeX+\code{dvips}+\code{distiller}, the result looks strange and `hyper' features don't work.}
+
+Check the \code{log} file of your document. If it contains the line
+{\codeswitch%
+\begin{verbatim}
+*hyperref using default driver hypertex*
+\end{verbatim}%
+}%
+then the default hyperref driver for your system is not suited for processing by \code{dvips}+\code{distiller}.
+
+Either you set another default driver (for instance, in the file \code{hyperref.cfg}), or you use the option
+\code{dvips} in your document as a global option or an option to \commandapp{usepackage}{hyperref}. See the
+documentation of the \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/hyperref.html}{\code{hyperref}} package
+for details.
+
+\newslide
+
+\subsection{When using \macroname{highlighttext} or \macroname{hidetext}, I'm getting strange error messages.}
+\label{Sec:hidetext}
+
+Note that both these commands are implemented using the
+\href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}} package. \code{soul} has some rather
+severe restrictions concerning what is allowed to appear in the argument of commands using it. Consult the documentation
+of \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}} for a detailed description of
+these restrictions.
+
+The most prominent one is that almost no \LaTeX{} command is allowed in the argument of a command implemented using
+\code{soul}. For instance, to use an emphasis or highlighting command like \macroname{emph}, you have to use a sequence
+of \macroname{highlighttext} commands, putting \macroname{emph} `outside'. Expect glitches in display quality though.
+
+\code{\small\commandapp{highlighttext}{This~}\discretionary{\%}{}{}\commandapp{emph}{\commandapp{highlighttext}{annoying~}}\discretionary{\%}{}{}\commandapp{highlighttext}{behaviour}}
+yields \highlighttext{This }\emph{\highlighttext{annoying }}\highlighttext{behaviour}.
+
+\newslide
+
+Another restriction is that accents are separated from the characters they belong to and break. You have to enclose the
+complete accented character with braces or use an appropriate input encoding, typing accented characters `as one'.
+\begin{center}
+ \begin{tabular}{l@{ yields }l}
+ \commandapp{highlighttext}{S\{\macroname{"}u\}\macroname{ss} es}&\highlighttext{S{\"u}\ss es}\\
+ \commandapp{highlighttext}{Süßes}&\highlighttext{Süßes}\\
+ \end{tabular}
+\end{center}
+
+\newslide
+
+\subsection{Inside the argument of \macroname{stepwise}, all counters seem to be freezed on all pages of the sequence
+ generated. How can I use a self-defined counter which does not freeze\,?}
+
+Freezing counters is a desirable behaviour in general, for instance to stop equation numbers from going astray.
+
+But \code{texpower} maintains a list of counters which are \emph{not} freezed, containing for instance the counter
+\code{step}.
+
+If you need a counter for special effects while the incremental sequence is generated (for instance: generating a
+sequence of MetaPost figures with the \code{emp} and \code{feynmp} packages), use
+\begin{LaTeXCode}
+ \releasecounter{mycounter}
+\end{LaTeXCode}
+to release the counter \code{mycounter}.
+%KEEPCOMMENTS
+%</faq>
+%=================================================================================================================
+%<*manual>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: manual.tex
+%
+% (Preliminary) documentation of the TeXPower bundle.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 11, 2000: Now producing a document which is meant for printing on paper.
+%
+
+\documentclass[12pt]{scrartcl}
+
+%-----------------------------------------------------------------------------------------------------------------
+% We need some more packages...
+%
+\usepackage[nottoc]{tocbibind}
+
+\usepackage{textcomp}% Just for \textregistered. Comment out if you like.
+
+\usepackage{url}
+
+% The following package makes code look a little nicer, but it may not be present on all systems.
+
+\IfFileExists{cmtt.sty}{\usepackage[override]{cmtt}}{}
+
+% Loading the soul package enables the \highlighttext command.
+
+\IfFileExists{soul.sty}{\usepackage{soul}}
+
+% One more Text emphasis command...
+
+\let\name=\textsc
+
+% We input the xr package for external references.
+
+\usepackage{xr-hyper}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Load hyperref.
+%
+\usepackage[bookmarksopen,colorlinks]{hyperref}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, the texpower package is loaded.
+%
+\usepackage{texpower}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The configuration file allows user-specific settings.
+
+\input{__TPcfg}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Setting up indexing and custom indexing commands
+\input{__TPindexing}
+
+%-----------------------------------------------------------------------------------------------------------------
+% We use references from the full demo file.
+
+%\externaldocument{fulldemo}[http://texpower.sourceforge.net/doc/fulldemo.pdf]
+\externaldocument{fulldemo}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% The code in the manual (doc tag) is meant for the document class seminar. Thus, it contains some
+% seminar-specific commands which are replaced by dummies here.
+
+\let\newslide=\relax
+
+%-----------------------------------------------------------------------------------------------------------------
+% The following command produces the title for this document.
+
+\newcommand{\makeslidetitle}[1]
+{%
+ \hypersetup{pdftitle={#1}}
+ \title{The \TeX Power bundle\\{\normalfont #1}}
+ \author
+ {%
+ Stephan Lehmke\\\url{mailto:Stephan.Lehmke@udo.edu}
+ \and
+ Hans Fr.\ Nordhaug\\\url{mailto:hansfn@users.sourceforge.net}%
+ }
+ \maketitle
+
+ \tableofcontents
+
+ \subsubsection*{}
+}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% As the documentation text contains a lot of stuff in boxes, we use \sloppy to avoid stuff projecting into the margin.
+
+\sloppy
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+
+\begin{document}
+%KEEPCOMMENTS
+%</manual>
+%=================================================================================================================
+%<*fulldemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: fulldemo.tex
+%
+% Demo & Manual for the package texpower.sty (pre-alpha release).
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf fulldemo
+%
+% afterwards processing the resulting ps file with
+%
+% distill fulldemo.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Oct 26, 1999: seven examples completed; parts of inline documentation
+%
+% v0.0.2 Feb 18, 2000: inline documentation of examples completed
+%
+% v0.0.3 Mar 1, 2000: added examples for \pause and page transitions; Documentation section started
+%
+% v0.0.4 Mar 10, 2000: Documentation for the first pre-alpha release completed
+%
+% v0.0.5 Mar 20, 2000: Documentation split into several files to reduce compilation problems; tested with pdflatex
+%
+% v0.0.6 May 2, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+% v0.0.7 May 24, 2000: Some small changes in preparation of the update to TeXpower v0.0.8.
+%
+% v0.0.8 Aug 29, 2000: Added backgroundstyle command for the update to TeXpower v0.0.9.
+%
+
+
+%-----------------------------------------------------------------------------------------------------------------
+
+% Version info
+\def\tpversion{v0.0.9d of May 15, 2003 (alpha)}
+
+% Enable all color emphasis and highlighting options; use a light background and slifonts.
+
+\PassOptionsToPackage{coloremph,colormath,colorhighlight,lightbackground}{texpower}
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower full demo and documentation}}
+
+% To get correct links in the index (and remove annoying warnings)
+\pausesafecounter{slide}
+
+% Setting up indexing and custom indexing commands
+\input{__TPindexing}
+
+\backgroundstyle{vgradient}
+
+\setlength{\unitlength}{5mm}
+
+\ifthenelse{\boolean{psspecialsallowed}}% Can we use PSTricks?
+{% Yes.
+ % PsTricks is used for creating the picture example.
+
+ \usepackage{pstcol}
+ \usepackage{pst-node}
+
+ \psset{unit=\unitlength}
+ }
+{% No. We'll make do without.
+ }
+
+
+% We also include an mps (metapost postscript) image...
+\usepackage{graphicx}
+% The mps extension isn't supported out-of-the-box for latex+dvips
+\ifthenelse{\boolean{psspecialsallowed}}{%
+\DeclareGraphicsExtensions{.mps}}{}
+
+% ... and write some aligned equations.
+\usepackage{amsmath}
+% Make nested braces grow.
+\delimitershortfall-1sp
+
+
+% The package soul is needed for \highlighttext to work.
+
+\usepackage{soul}
+
+
+% The following package makes code look a little nicer, but it may not be present on all systems.
+
+\IfFileExists{cmtt.sty}{\usepackage[override]{cmtt}}{}
+
+% Hack to override seminar's definition of twocolumn needed by theindex
+\makeatletter
+\let\slidebox@restore@orig=\slidebox@restore%
+\def\slidebox@restore{%
+ \slidebox@restore@orig%
+ \long\def\twocolumn[##1]{\section{Index}}%
+}
+\makeatother
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%
+% First, some words of explanation.
+%
+ \title
+ {%
+ The \TeX Power bundle\\
+ {%
+ \normalfont
+ Creating dynamic online presentations with \LaTeX\\
+ Full demo and documentation for \TeX Power \tpversion%
+ }%
+ }
+
+ \author{Stephan Lehmke\\\url{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+
+ \maketitle
+
+ \newslide
+
+ This document is a demonstration and manual for the \TeX Power bundle which allows to create dynamic
+ presentations in a very flexible way.
+
+ The heart of the bundle is the package \code{texpower} which implements some commands for presentation effects. This
+ includes setting page transitions, color highlighting and displaying pages incrementally.
+
+ All features of \code{texpower} are implemented entirely using \TeX{} and \LaTeX; they are meant for `online'
+ presentation with \concept{Adobe Acrobat\textsuperscript{\textregistered} Reader} and work with all ways of \code{pdf}
+ creation. The combination of \LaTeX{} + \code{dvips} + Acrobat Distiller /
+ \code{ps2pdf} is possible as well as pdf\LaTeX{} and other \code{pdf} creation
+ methods.
+
+ \newslide
+
+ \minisec{Disclaimer}
+ This is a \emph{alpha} release of the \TeX Power bundle.
+
+ During the subsequent error correction and extension of the functionality, the syntax and implementation of the macros
+ described here are liable to change.
+
+ The transformation to the dtx format is also not completed.
+
+ \newslide
+
+ \minisec{Credits}%
+ I am indepted to \href{mailto:guntermann@iti.informatik.tu-darmstadt.de}{\name{Klaus Guntermann}}. His package
+ \href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/pp4sty.zip}{\code{texpause}} from the \concept{Pdf
+ Presentation Post Processor} \href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/}{PPower4} bundle
+ is the basis for the code of \code{texpower}.
+
+ Further thanks go to \href{mailto:dongen@cs.ucc.ie}{\name{Marc van Dongen}} for allowing me to include his code for
+ page transitions and to \href{mailto:Martin.Schroeder@ACM.org}{\name{Martin Schr\"oder}} for permission to use his
+ \concept{everyshi} code.
+
+ Useful hints for error corrections and improvements of code have been provided by \name{Marc van Dongen},
+ \name{Friedrich Eisenbrand}, \name{Thomas Emmel}, \name{Ross Moore}, \name{Heiko Oberdiek}, \name{Heiner Richter}, and
+ \name{Robert J.\ Vanderbei}.
+
+ \newslide
+
+ \tableofcontents
+\end{slide}
+\begin{slide}
+ %-----------------------------------------------------------------------------------------------------------------
+ %
+ \section{Examples}\label{Sec:Ex}
+ First, two simple examples for the \macroname{pause} command.
+
+ All other examples are meant to illustrate the expressive power of the \macroname{stepwise} command.
+
+ Looking at the code for the examples will probably be the best way of understanding how certain effects can be
+ achieved.
+
+ \newslide
+
+ %-----------------------------------------------------------------------------------------------------------------
+ %
+ \subsection{Some examples for \macroname{pause}}
+ % It doesn't hurt to put \pause inside a paragraph, but a new paragraph is forced at each occurrence of \pause.
+ \begin{center}
+ a\pause b\pause c
+ \end{center}
+
+ \pause
+
+ % We set Page Transitions to Dissolve for the rest of this slide.
+ \pageTransitionDissolve
+ \begin{itemize}
+ \item foo\pause
+ \item bar\pause
+ \item baz
+ \end{itemize}
+
+ \newslide
+ % Page Transitions are set back to Replace.
+ \pageTransitionReplace
+
+%-----------------------------------------------------------------------------------------------------------------
+% The `titles' for the examples are simply subsection headings.
+
+\renewcommand{\makeslidetitle}[1]
+{%
+ \subsection{#1}%
+}
+
+%KEEPCOMMENTS
+%</fulldemo>
+%<*fulldemo-middle>
+%<<KEEPCOMMENTS
+\end{slide}
+
+\begin{slide}\relax
+
+%-----------------------------------------------------------------------------------------------------------------
+% The `title' for the documentation is a section heading. As sectioning in the manual (doc-tag) file starts with
+% \section, we have to `downgrade' sectioning commands.
+
+\let\origsection=\section
+
+\renewcommand{\makeslidetitle}[1]
+{%
+ \let\section\subsection
+ \let\subsection\subsubsection
+ \def\thanks##1{}%
+ \origsection{#1}
+}
+
+ \addtocontents{toc}{\protect\clearpage}
+
+%KEEPCOMMENTS
+%</fulldemo-middle>
+%=================================================================================================================
+%<*docu>
+%<<KEEPCOMMENTS
+%
+%-----------------------------------------------------------------------------------------------------------------
+%
+% Documentation of the TeXPower bundle.
+%
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Mar 29, 2000: Added `usage and basic options' section.
+%
+% v0.0.3 Apr 04, 2000: Added `Color Emphasis and Highlighting' section.
+%
+% v0.0.4 Apr 12, 2000: A lot of small additions in preparation of the update to TeXpower v0.0.7.
+%
+% v0.0.5 May 31, 2000: Updated for TeXpower v0.0.8.
+%
+% v0.0.6 Jun 09, 2000: Some updates for TeXpower v0.0.8b.
+%
+% v0.0.6a Jun 13, 2000: Some updates for TeXpower v0.0.8c.
+%
+% v0.0.6b Jun 23, 2000: Some updates for TeXpower v0.0.8e.
+%
+% v0.0.6c Jul 25, 2000: Some updates for TeXpower v0.0.8g. Colors section rewritten for new color management kernel.
+%
+% v0.0.7 May 15, 2003: Added index and updates for TeXpower v0.0.9d.
+%
+% v0.0.8 July 27, 2004: Added the "Miscellaneous commands" section. Moved the tpslifonts doc into tpslifonts.dtx.
+%
+%-----------------------------------------------------------------------------------------------------------------
+%
+\def\docversion{v0.0.8 of July 27, 2004}
+\def\tpversion{v0.1b of July 27, 2004}
+
+\makeslidetitle
+{%
+ Documentation%
+ \thanks{Documentation \docversion\ for \TeX Power \tpversion\ (alpha).}%
+ }%
+
+The \TeX Power bundle contains style and class files for creating dynamic online presentations with \LaTeX.
+
+The heart of the bundle is the package \code{texpower.sty} which implements some commands for presentation effects. This
+includes setting page transitions, color highlighting and displaying pages incrementally.
+
+For finding out how to achieve special effects (as shown in the \nameref{Sec:Ex}),
+please look at the comments inside the files ending with \code{example.tex} and \code{demo.tex}
+and read this manual to find out what's going on.
+
+\newslide
+
+For your own first steps with \TeX Power, the simple demo file \code{simpledemo.tex} is the best starting
+place. There, some basic applications of the dynamic features provided by the \code{texpower} package are
+demonstrated. You can make your own dynamic presentations by modifying that demo to your convenience.
+
+\code{simpledemo.tex} uses the \code{article} document class for maximum
+compatibility. There are other simple demos named
+\code{slidesdemo.tex}, \code{foilsdemo.tex}, \code{seminardemo.tex},
+\code{pp4sldemo.tex}, \code{pdfslidemo.tex}, \code{pdfscrdemo.tex},
+\code{prosperdemo.tex}, and \code{ifmslidemo.tex}
+which demonstrate how to combine \TeX Power with the
+most popular presentation-making document classes and packages.
+
+\newslide
+
+The other, more sophisticated examples demonstrate the expressive power of the
+\code{texpower} package. Look at the commented code of these examples to find out how to achieve special effects and
+create your own presentation effects with \TeX Power.
+
+For the first \emph{alpha} release, this documentation will be completed. For the first \emph{beta} release, when the
+code is a little more stable, the \code{texpower} package will be made into a properly documented \code{.dtx} file.
+
+\newslide
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\section{Usage and general options}
+The \code{texpower} package is loaded by putting
+\begin{center}
+ \present{\commandapp{usepackage}{texpower}}
+\end{center}
+into the preamble of a document.
+
+There are no specific restrictions as to which document classes can be used.
+
+It should be stressed that \TeX Power is \underl{not} (currently) a complete presentation package. It just adds dynamic
+presentation effects (and some other gimmicks specifically interesting for dynamic presentations) and should always be
+combined with a document class dedicated to designing presentations (or a package like
+\href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfslide.html}{\code{pdfslide}}).
+
+Some of the presentation effects created by \code{texpower} require special capabilities of the viewer which is used for
+presenting the resulting document. The target for the development of \code{texpower} has so far been
+\href{http://www.adobe.com/products/acrobat/readermain.html}%
+{\concept{Adobe Acrobat\textsuperscript{\textregistered} Reader}}, which means the
+document should (finally) be produced in \code{pdf} format. The produced
+\code{pdf} documents should display well in
+\href{http://www.cs.wisc.edu/~ghost/gsview/}{\concept{GSview}} also, but that
+viewer doesn't support page transitions and duration.
+
+There are no specific restrictions as to which way the \code{pdf} format is produced. All demos and examples
+have been tested with pdf\LaTeX{} and standard \LaTeX, using
+\code{dvips} and \href{http://www.adobe.com/products/acrobat/}%
+{\concept{Adobe Acrobat\textsuperscript{\textregistered} Distiller}}
+or \code{dvips} and \code{ps2pdf} (from the \href{http://www.ghostscript.com/}%
+{\concept{Ghostscript suite}}) for generating \code{pdf}.
+
+\newslide
+
+\subsection{General options}\label{Sec:GenOpt}
+\begin{description}
+\item[\present{option: \code{display}}.]\indexpckopt{texpower}{display} Enable `dynamic' features. If not set, it is assumed that the document is to be
+ printed, and all commands for dynamic presentations, like \macroname{pause} or \macroname{stepwise} have no effect.
+
+\item[\present{option: \code{printout} (default)}.]\indexpckopt{texpower}{printout} Disable `dynamic' features. As this is the default behaviour,
+ setting this option explicitly is useful only if the option \code{display} is set by default for instance in the
+ \code{tpoptions.cfg} file (see section \ref{Sec:Config}).
+
+\item[\present{option: \code{verbose}}.]\indexpckopt{texpower}{verbose} Output some administrative info.
+\end{description}
+Some font options are listed in section \ref{Sec:BaseFont}.
+
+\newslide
+
+\subsection{Side effects of page contents duplication}\label{Sec:Dupl}
+In the implementation of the \macroname{pause} and \macroname{stepwise} commands, it is neccessary to duplicate some
+material on the page.
+
+This way, not only `visible' page contents will be duplicated, but also some `invisible' control code stored in
+\concept{whatsits} (see the \TeX book for an explanation of this concept). Duplicating whatsits can lead to undesirable
+side effects.
+
+For instance, a \macroname{section} command creates a whatsit for writing the table of contents entry. Duplicating this
+whatsit will also duplicate the toc entry.
+
+\newslide
+
+So, whatsit items effecting file access are inhibited when duplicating page material.
+
+A second type of whatsits is created by \TeX's \macroname{special} command which is used for instance for color
+management. Some drivers, like \code{dvips} and \code{textures}, use a color stack which is controlled by
+\macroname{special} items included in the dvi file. When page contents are duplicated, then these \macroname{special}s
+are also duplicated, which can seriously mess up the color stack.
+
+\newslide
+
+\code{texpower} implements a `color stack correction' method by maintaining a stack of color corrections, which should
+counteract this effect. Owing to potential performance problems, this method is turned off by default.
+\begin{description}
+\item[\present{option: \code{fixcolorstack}}]\indexpckopt{texpower}{fixcolorstack} switches on color stack correction. Use it if you experience strange color
+ switches in your document.
+\end{description}
+
+\newslide
+
+\subsection{Setting the base font}\label{Sec:BaseFont}
+\code{texpower} offers no options for setting the base font of the document.
+Use the \code{tpslifonts} package in stead. Read more in section \ref{Sec:TPslifonts}.
+
+Further, there are packages like \code{cmbright} or \code{beton} which change the whole set of fonts to something less
+fragile than cmr.
+
+\newslide
+
+\subsection{Switches}
+There are some boolean registers provided and set automatically by \code{texpower}.
+
+\begin{description}
+\item[\present{boolean: \code{psspecialsallowed}}]\indexpckswitch{texpower}{psspecialsallowed} True if PostScript\textsuperscript{\textregistered} specials may be
+ used.
+
+ \code{texpower} tries to find out whether or not PostScript\textsuperscript{\textregistered} specials may be used in
+ the current document. For instance, pdf\LaTeX{} can't interpret arbitrary specials. This switch is set automatically
+ and can be used inside a document to enable/disable parts which need PostScript\textsuperscript{\textregistered}
+ specials.
+
+\newslide
+
+\item[\present{boolean: \code{display}}]\indexpckswitch{texpower}{display} True if \code{display} option was given.
+
+ This switch indicates whether `dynamic' features of \code{texpower} are enabled. Use it inside your document
+ to distinguish between the `presented' and the printed version of your document.
+
+\item[\present{boolean: \code{TPcolor}}]\indexpckswitch{texpower}{TPcolor} True if any of the color highlighting options (see section
+ \ref{Sec:ColorEmphasis}) were given.
+
+ This switch indicates whether `color' features of \code{texpower} are enabled (compare section
+ \ref{Sec:ColorEmphasis}). You can use it inside your document to distinguish between a `colored' and a `monochrome'
+ version of your document.
+\end{description}
+
+\newslide
+
+\subsection{Configuration files}\label{Sec:Config}
+\code{texpower} loads three configuration files (if present):
+\begin{description}
+\item[\present{file: \code{tpoptions.cfg}}]\indexcode{tpoptions.cfg}
+ is loaded before options are processed. Can be used to set default options
+ in a system-specific way. See the comments inside the file
+ \code{tpoptions.cfg} which is part of the \TeX Power bundle
+ for instructions.
+
+\item[\present{file: \code{tpsettings.cfg}}]\indexcode{tpsettings.cfg}
+ is loaded at the end of \code{texpower}. Here, you can do some
+ system-specific settings. See the comments inside the
+ file \code{tpsettings.cfg} which is part of the
+ \TeX Power bundle for instructions.
+
+\item[\present{file: \code{tpcolors.cfg}}]\indexcode{tpcolors.cfg}
+ is loaded if \code{TPcolor} is true. The file defines the standard
+ colors/colorsets (see section \ref{Sec:ColorEmphasis}). See the
+ comments inside the file \code{tpcolors.cfg} which is part of the
+ \TeX Power bundle for instructions.
+\end{description}
+
+\newslide
+
+\subsection{Miscellaneous commands}\label{Sec:MiscCmd}
+Some important commands that don't fit in the latter sections:
+\begin{description}
+\item[\present{\commandapp{currentpagevalue}{\carg{value}}}]\indexmacro{currentpagevalue}
+ sets how to find the number of the current page, \commandapp{value}{page} is default.
+ Used to name the hyper target on the first subpage of every page. Also used in the
+ TeXPower navigation buttons.
+\item[\present{\commandapp{pausesafecounter}{\carg{counter}}}]\indexmacro{pausesafecounter}
+ is used to add counters that are to be restored to their original value after \macroname{pause}. The \code{page}
+ counter is always restored. In addition the \code{slide} counter is restored if the \code{seminar} class is used. If
+ you need more counters to be restored after \macroname{pause}, use \macroname{pausesafecounter}.
+\end{description}
+
+\newslide
+
+\subsection{Dependencies on other packages}
+\code{textpower} always loads the packages \code{ifthen} and \code{calc}, as the extended command syntax provided by
+these is indispensable for the macros to work. They are in the \code{base} and \code{tools} area of the \LaTeX{}
+distribution, respectively, so I hope they are available on all systems.
+
+Furthermore, \code{texpower} loads the package \code{color} if any color-specific options are set (see section
+\ref{Sec:ColorEmphasis}).
+
+Further packages are \emph{not} loaded automatically by \code{texpower} to avoid incompatibilities, although some
+features of \code{texpower} are enabled \emph{only} if a certain package is loaded. If you wish to use these features,
+you are responsible for loading the respective package yourself.
+
+If some necessary package is \emph{not} loaded, \code{texpower} will issue a warning and disable the respective
+features.
+
+The following packages are neccessary for certain features of \code{texpower}:
+\begin{description}
+\item[\present{package: \code{hyperref}}]\indexfile{hyperref}{package}
+ is neccessary for page transition effects to work (see section
+ \ref{Sec:PageTrans}).
+
+ In particular, the \macroname{pageDuration} (see section \ref{Sec:PageDuration}) command only works if the version of
+ hyperref loaded is at least v6.70a (where the \code{pdfpageduration} key was introduced).
+
+ Commands which work only when \code{hyperref} is loaded are marked with \textbf{\textsf{h}} in the description.
+
+\newslide
+
+\item[\present{package: \code{soul}}]\indexfile{soul}{package}
+ is neccessary for the implementation of the commands \macroname{hidetext} and
+ \macroname{highlighttext} (see section \ref{Sec:displaycustom}).
+
+ Commands which work only when \code{soul} is loaded are marked with \textbf{\textsf{s}} in the description.
+\end{description}
+
+\newslide
+
+\subsection{What else is part of the \TeX Power bundle?}
+Besides the package \code{texpower} (which is described here), there are four
+more packages, \code{tpslifonts}, \code{fixseminar}, \code{automata} and
+\code{tplists}, and one document class,
+\code{powersem}, in the \TeX Power bundle which so far have no documentation
+of their own. They will be described in this section until they are turned
+into \code{dtx} files producing their own documentation.
+
+See the file \code{00readme.txt} which is part of the \TeX Power bundle for a short description of all files.
+
+\newslide
+
+\minisec{The document class \code{powersem}}\indexfile{powersem}{class}
+This is planned to provide a more `modern' version of \code{seminar} which can be used for creating dynamic
+presentations.
+
+Currently, this document class doesn't do much more than load \code{seminar} and apply some fixes, but it is planned to
+add some presentation-specific features (like navigation panels).
+
+\newslide
+
+There are three new options which are specific for \code{powersem}, all other options are passed to \code{seminar}:
+\begin{description}
+\item[\present{option: \code{display}}]\indexpckopt{powersem}{display}
+ Turns off all features of \code{seminar} (notes, vertical centering of slides)
+ which can disturb dynamic presentations.
+
+\item[\present{option: \code{calcdimensions}}]\indexpckopt{powersem}{calcdimensions}
+ \code{seminar} automatically calculates the slide dimensions
+ \macroname{slidewidth} and \macroname{slideheight} only for the default \code{letter} and for its own option
+ \code{a4}. For all the other paper sizes which are possible with the \code{KOMA} option, the slide dimensions are not
+ calculated automatically.
+
+ The \code{calcdimensions} option makes \code{powersem} calculate the slide dimensions automatically from paper size
+ and margins.
+
+\newslide
+
+\item[\present{option: \code{truepagenumbers}}]\indexpckopt{powersem}{truepagenumbers}
+ The truepagenumbers option makes powersem count pages with the counter page, independently of the counter slide. This
+ enables proper working of TeXPowers navigation buttons (some of which calculate relative page numbers) even when the
+ counter slide is reset frequently (for slide numberings of the type \verb|<l>.<n>.<m>|).
+
+\item[\present{option: \code{KOMA}}]\indexpckopt{powersem}{KOMA} Makes
+ \code{seminar} load \code{scrartcl} (from the KOMA-Script bundle) instead of
+ \code{article} as its base class. All new features of \code{scrartcl} are then available also for slides.
+
+\item[\present{option: \code{UseBaseClass}}]\indexpckopt{powersem}{UseBaseClass}
+ Makes \code{seminar} load the class \macroname{baseclass} (initially \code{article}) instead of
+ \code{article} as its base class.
+
+\item[\present{option: \code{reportclass}}]\indexpckopt{powersem}{reportclass}
+ Makes \code{seminar} load the class \macroname{baseclass} (initially \code{report}) instead of
+ \code{article}.
+
+\item[\present{option: \code{bookclass}}]\indexpckopt{powersem}{bookclass}
+ Makes \code{seminar} load the class \macroname{baseclass} (initially \code{book}) instead of
+ \code{article}.
+
+\end{description}
+
+There is one change in \code{powersem} which will lead to incompatibilities with \code{seminar}. \code{seminar} has the
+unfortunate custom of \emph{not} exchanging \macroname{paperwidth} and \macroname{paperheight} when making landscape
+slides, as for instance \code{typearea} and \code{geometry} do.
+
+This leads to problems with setting the paper size for \code{pdf} files, as done for instance by the \code{hyperref}
+package.
+
+\code{powersem} effectively turns off \code{seminar}'s papersize management and leaves this to the base class (with the
+pleasant side effect that you can use e.\,g.\ \commandapp[KOMA,a0paper]{documentclass}{powersem} for making posters).
+
+In consequence, the \code{portrait} option of \code{seminar} is turned on by \code{powersem} to avoid confusing
+\code{seminar}. You have to explicitly use the \code{landscape} option (and a base class or package which understands
+this option) to get landscape slides with powersem.
+
+\newslide
+
+\minisec{The package \code{fixseminar}}\indexfile{fixseminar}{package}
+Unfortunately, there are some fixes to seminar which can \emph{not} be applied in \code{powersem} because they have to
+be applied after \code{hyperref} is loaded (if this package should be loaded).
+
+The package \code{fixseminar} applies these fixes, so this package should be loaded after \code{hyperref} (if
+\code{hyperref} is loaded at all, otherwise \code{fixseminar} can be loaded anywhere in the preamble).
+
+\newslide
+
+It applies two fixes:
+\begin{itemize}
+\item In case \code{pdflatex} is being run, the lengths \macroname{pdfpageheight} and \macroname{pdfpagewidth} have to
+ be set in a `magnification-sensitive' way.
+
+\item \code{hyperref} introduces some code at the beginning of every page which can produce spurious vertical space,
+ which in turn disturbs building dynamic pages. This code is `fixed' so it cannot produce vertical space.
+\end{itemize}
+
+\newslide
+
+\minisec{The package \code{tpslifonts}}
+\indexfile{tpslifonts}{package}\label{Sec:TPslifonts}
+Presentations to be displayed `online' with a video beamer have special needs concerning font configuration owing to low
+`screen' resolution and bad contrast caused by possibly bad light conditions combined with color highlighting.
+
+This package tries to cater to these needs by offering a holistic configuration of all document fonts, including text,
+typewriter, and math fonts. Special features are `smooth scaling' of Type1 fonts and careful design size selection for
+optimal readability.
+
+\newslide
+
+For more information on package options and used fonts (and on implementation) read the documentation coming with the
+package - check the \code{tpslifonts} directory.
+
+\minisec{The package \code{automata}}\indexfile{automata}{package}
+Experimental package for drawing automata in the sense of theoretical computer
+science (using PSTricks) and animating them with TeXPower. Only DFA and Mealy
+automata are supported so far.
+
+\newslide
+
+\minisec{The package \code{tplists}}\indexfile{tplists}{package}
+Experimental package providing easy dynamic lists. Currently there are stepped, flipped and dimmed versions of itemize
+and enumerate (and corresponding lists from the \code{eqlist} and \code{paralist} package). For more information
+and an example read the start of the file \code{tplists.sty}.
+
+\newslide
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\section{The \macroname{pause} command}\label{Sec:pause}
+\present{\macroname{pause}}\indexmacro{pause} is derived from the \macroname{pause} command from the package
+\href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/pp4sty.zip}{\code{texpause}} which is part of the
+\href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/}{PPower4 suite} by
+\href{mailto:guntermann@iti.informatik.tu-darmstadt.de}{Klaus Guntermann}.
+
+ It will ship out the current page, start a new page and copy whatever was on the current page onto the new page, where
+ typesetting is resumed.
+
+ \ifthenelse{\boolean{display}}{Here, let's do a little demo\pause}{}
+
+ This will create the effect of a \concept{pause} in the presentation, i.\,e.\ the presentation stops because the
+ current page ends at the point where the \macroname{pause} command occurred and is resumed at this point when the
+ presenter switches to the next page.
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item \macroname{pause} should appear in \concept{vertical mode} only, i.\,e.\ between paragraphs or at places where
+ ending the current paragraph doesn't hurt.
+
+ \item This means \macroname{pause} is forbidden in all \concept{boxed} material (including \code{tabular}),
+ \concept{headers/footers}, and \concept{floats}.
+
+ \item \macroname{pause} shouldn't appear either in environments which have to be \emph{closed} to work properly, like
+ \code{picture}, \code{tabbing}, and (unfortunately) environments for \concept{aligned math formulas}.
+
+ \item \macroname{pause} does work in all environments which mainly influence paragraph formatting, like \code{center},
+ \code{quote} or all \concept{list} environments.
+
+ \newslide
+
+ \item \macroname{pause} doesn't really have problems with automatic page breaking, but beware of \emph{overfull}
+ pages/slides. In this case, it may occur that only the last page(s)/slide(s) of a sequence are overfull, which
+ changes vertical spacing, making lines `wobble' when switching to the last page/slide of a sequence.
+
+ \newslide
+
+ \item The duplication of page material done by \macroname{pause} can lead to unwanted side effects. See section
+ \ref{Sec:Dupl} for further explanations. In particular, if you should experience strange color switches when using
+ \macroname{pause} (and you are \underl{not} using \code{pdftex}), turn on color stack correction with the option
+ \code{fixcolorstack}. In addition you should be aware of \macroname{pausesafecounter}, see section
+ \ref{Sec:MiscCmd}.
+
+ \end{enumerate}
+
+ A lot of the restrictions for the use of pause can be avoided by using \macroname{stepwise} (see next section).
+
+ \newslide
+
+ %-----------------------------------------------------------------------------------------------------------------
+ %
+ \section{The \macroname{stepwise} command}
+ \present{\commandapp{stepwise}{\carg{contents}}}\indexmacro{stepwise} is a command for displaying some part of a \LaTeX{} document (which
+ is contained in \carg{contents}) `step by step'. As of itself, \macroname{stepwise} doesn't do very much. If
+ \carg{contents} contains one or more constructs of the form \present{\commandapp{step}{\carg{stepcontents}}}\indexmacro{step}, the
+ following happens:
+ \begin{enumerate}
+ \item The current contents of the page are saved (as with \macroname{pause}).
+
+ \item As many pages as there are \macroname{step} commands in \carg{contents} are produced.
+
+ Every page starts with what was on the current page when \macroname{stepwise} started.
+
+ \newslide
+
+ The first page also contains everything in \carg{contents} which is \emph{not} in \carg{stepcontents} for any
+ \macroname{step} command.
+
+ The second page additionally contains the \carg{stepcontents} for the \emph{first} \macroname{step} command, and so
+ on, until all \carg{stepcontents} are displayed.
+
+ \item When all \carg{stepcontents} are displayed, \macroname{stepwise} ends and typesetting is resumed (still on the
+ current page).
+ \end{enumerate}
+
+ \parstepwise{This will create the effect that the \macroname{step} commands are executed `\step{step} \step{by}
+ \step{step}'.}
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item \macroname{stepwise} should appear in \concept{vertical mode} only, i.\,e.\ between paragraphs, just like
+ \macroname{pause}.
+
+ \item Don't put \macroname{pause} or nested occurrences of \macroname{stepwise} into \carg{contents}.
+
+ \item Structures where \macroname{pause} does not work (like \code{tabular} or aligned equations) can go
+ \emph{completely} into \carg{contents}, where \macroname{step} can be used freely (see \nameref{Sec:Ex}).
+
+ \item As \carg{contents} is read as a macro argument, constructs involving \concept{catcode} changes (like
+ \macroname{verb} or language switches) won't work in \carg{contents}. Using a suggestion by \name{Ross
+ Moore}, I hope to remedy this until the \emph{alpha} release.
+
+\newslide
+
+ \item Several instances of \macroname{stepwise} may occur on one page, also combined with \macroname{pause} (outside
+ of \carg{contents}).
+
+ But beware of page breaks in \carg{contents}. This will really mess things up.
+
+ Overfull pages/slides are also a problem, just like with \macroname{pause}. See the description of \macroname{pause}
+ (section \ref{Sec:pause}) concerning this and also concerning side effects of duplicating page material.
+
+ \item \macroname{step} can go in \carg{stepcontents}. The order of execution of \macroname{step} commands is just the
+ order in which they appear in \carg{contents}, independent of nesting within each other.
+
+ \newslide
+
+ \item As \carg{contents} is executed several times, \LaTeX{} constructs changing \concept{global counters}, accessing
+ \concept{files} etc.\ are problematic. This concerns sections, numbered equations, labels, hyperlinks and the like.
+
+ Counters are taken care of explicitly by \macroname{stepwise}, so equation numbers are no problem.
+
+ Commands accessing toc files and such (like \macroname{section}) are taken care of by the whatsit suppression
+ mechanism (compare section \ref{Sec:Dupl}).
+
+ Labels and hyperlinks work sort of (giving a lot of warnings though).
+
+ I will try to remedy remaining problems until the first \emph{alpha} release.
+ \end{enumerate}
+
+ \newslide
+
+ \subsection{\macroname{boxedsteps} and \macroname{nonboxedsteps}}\label{Sec:boxedsteps}%
+ By default, \carg{stepcontents} belonging to a \macroname{step} which is not yet `active' are ignored altogether. This
+ makes it possible to include e.\,g.\ tabulators \code{\&} or line breaks into \carg{stepcontents} without breaking
+ anything.
+
+ Sometimes, however, this behaviour is undesirable, for instance when stepping through an equation `from outer to
+ inner', or when filling in blanks in a paragraph. Then, the desired behaviour of a \macroname{step} which is not yet
+ `active' is to create an appropriate amount of \emph{blank space} where \carg{stepcontents} can go as soon as it is
+ activated.
+
+ \newslide
+
+ The simplest and most robust way of doing this is to create an empty box (aka \macroname{phantom}) with the same
+ dimensions as the text to be hidden.
+
+ This behaviour is toggled by the following commands. See section \ref{Sec:displaycustom} for more sophisticated
+ (albeit more fragile) variants.
+ \begin{description}
+ \item[\present{\macroname{boxedsteps}}]\indexmacro{boxedsteps} makes \macroname{step} create a blank box the size of \carg{stepcontents} when
+ inactive and put \carg{stepcontents} into a box when active.
+ \item[\present{\macroname{nonboxedsteps}}]\indexmacro{nonboxedsteps} makes \macroname{step} ignore \carg{stepcontents} when inactive and leave
+ \carg{stepcontents} alone when active (default).
+ \end{description}
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item The settings effected by \macroname{boxedsteps} and \macroname{nonboxedsteps} are \emph{local}, i.\,e.\ whenever
+ a group closes, the setting is restored to its previous value.
+
+ \item Putting stuff into boxes can break things like tabulators (\code{\&}). It can also mess up math spacing, which
+ then has to be corrected manually. Compare the following examples:
+
+ \parstepwise{%
+ \begin{displaymath}
+ \left(\frac{a+b}{c}\right)\qquad\left(\frac{a\step{+b}}{c}\right)\qquad\left(\frac{a\restep{{}+b}}{c}\right)
+ \end{displaymath}%
+ }%
+ \end{enumerate}
+
+ \newslide
+
+ \subsection{Custom versions of \macroname{stepwise}}%
+ Sometimes, it might happen that vertical spacing is different on every page of a sequence generated by
+ \macroname{stepwise}, making lines `wobble'.
+
+ This is caused by interactions between different ways vertical spacing is added to the page. Hopefully, problems
+ caused this way can be reduced until the first \emph{alpha} release.
+
+ \newslide
+
+ There are two custom versions of \macroname{stepwise} which should produce better vertical spacing.
+ \begin{description}
+ \item[\present{\commandapp{liststepwise}{\carg{contents}}}]
+ \indexmacro{liststepwise} works exactly like \macroname{stepwise}, but adds
+ an `invisible rule' before \carg{contents}. Use for list environments and
+ aligned equations.
+ \item[\present{\commandapp{parstepwise}{\carg{contents}}}]
+ \indexmacro{parstepwise} works like \macroname{liststepwise}, but
+ \macroname{boxedsteps} is turned on by default. Use for texts where
+ \macroname{step}s are to be filled into blank spaces.
+ \end{description}
+
+ \newslide
+
+ \subsection{Starred versions of \macroname{stepwise} commands}\label{Sec:StarredStepwise}%
+ Usually, the first page of a sequence produced contains \emph{only} material which is \emph{not} part of any
+ \carg{stepcontents}. The first \carg{stepcontents} are displayed on the second page of the sequence.
+
+ For special effects (see example \ref{Sec:Exhl}), it might be desirable to have the first \carg{stepcontents} active
+ even on the first page of the sequence.
+
+ All variants of \macroname{stepwise} have a starred version (e.\,g.\ \macroname{stepwise*}) which does exactly that.
+
+ \newslide
+
+ \subsection{The optional argument of \macroname{stepwise}}%
+ Every variant of \macroname{stepwise} takes an optional argument, like this
+ \begin{center}
+ \present{\commandapp[\carg{settings}]{stepwise}{\carg{contents}}}.
+ \end{center}
+ \carg{settings} will be placed right before the internal loop which produces the sequence of pages. It can
+ contain settings of parameters which modify the behaviour of \macroname{stepwise} or \macroname{step}. \carg{settings}
+ is placed inside a group so all changes are local to this call of \macroname{stepwise}.
+
+ Some internal macros and counters which can be adjusted are explained in the following.
+
+ \newslide
+
+ \subsection{Customizing the way \carg{stepcontents} is diplayed}\label{Sec:displaycustom}%
+ Internally, there are three macros (taking one argument each) which control how \carg{stepcontents} is displayed:
+ \macroname{displaystepcontents}\indexmacro{displaystepcontents},
+ \macroname{hidestepcontents}\indexmacro{hidestepcontents}, and
+ \macroname{activatestep}\indexmacro{activatestep}. Virtually, every
+ \commandapp{step}{\carg{stepcontents}} is replaced by
+ \begin{description}
+ \item[\present{\commandapp{hidestepcontents}{\carg{stepcontents}}}]\mbox{}\\ when this step is not yet active.
+ \item[\present{\commandapp{displaystepcontents}{\commandapp{activatestep}{\carg{stepcontents}}}}] when this step is
+ activated \emph{for the first time}.
+ \item[\present{\commandapp{displaystepcontents}{\carg{stepcontents}}}]\mbox{}\\
+ when this step has been activated before.
+ \end{description}
+
+ By redefining these macros, the behaviour of \macroname{step} is changed accordingly. You can redefine them inside
+ \carg{contents} to provide a change affecting one \macroname{step} only, or in the optional argument of
+ \macroname{stepwise} to provide a change for all \macroname{step}s inside \carg{contents}.
+
+ In the \nameref{Sec:Ex}, it is demonstrated how special effects can be achieved by redefining these macros.
+
+ \macroname{activatestep} is set to \macroname{displayidentical} by default, the default settings of
+ \macroname{hidestepcontents} and \macroname{displaystepcontents} depend on whether \macroname{boxedsteps} or
+ \macroname{nonboxedsteps} (default) is used.
+
+ \newslide
+
+ \code{texpower} offers nine standard definitions.
+
+ For interpreting \macroname{displaystepcontents}:
+ \begin{description}
+ \item[\present{\macroname{displayidentical}}]\indexmacro{displayidentical}
+ Simply expands to its argument. The same as \LaTeX s
+ \macroname{@ident}. Used by \macroname{nonboxedsteps} (default).
+
+ \item[\present{\macroname{displayboxed}}]\indexmacro{displayboxed}
+ Expands to an \macroname{mbox} containing its argument. Used by
+ \macroname{boxedsteps}.
+ \end{description}
+
+ \newslide
+
+ For interpreting \macroname{hidestepcontents}:
+ \begin{description}
+ \item[\present{\macroname{hideignore}}]\indexmacro{hideignore}
+ Expands to nothing. The same as \LaTeX s \macroname{@gobble}. Used by
+ \macroname{nonboxedsteps} (default).
+
+ \item[\present{\macroname{hidephantom}}]\indexmacro{hidephantom}
+ Expands to a \macroname{phantom} containing its argument. Used by
+ \macroname{boxedsteps}.
+
+ \item[\present{\macroname{hidevanish}}]\indexmacro{hidevanish}
+ In a colored document, makes its argument `vanish' by setting all colors to
+ \macroname{vanishcolor} (defaults to \code{pagecolor}; compare section
+ \ref{Sec:Colorcommands}). Note that this will give weird results with
+ structures backgrounds.
+
+ For monochrome documents, there is no useful interpretation for this command, so it is disabled.
+
+ \newslide
+
+ \item[{\present[s]{\macroname{hidetext}}}]\indexmacro{hidetext}
+ Produces blank space of the same dimensions as the space that would be
+ occupied if its argument would be typeset in the current paragraph. Respects automatic hyphenation and line breaks.
+
+ This command needs the \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}} package
+ to work, which is not loaded by \code{texpower} itself. Consult the documentation of
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}} concerning restrictions on
+ commands implemented using \code{soul}. If you don't load the \code{soul} package yourself, there is no useful
+ definition for this command, so it defaults to \macroname{hidephantom}.
+
+ \newslide
+
+ \item[\present{\macroname{hidedimmed}}]\indexmacro{hidedimmed}
+ In a colored document, displays its argument with dimmed colors (compare
+ section \ref{Sec:Colors}). Note that this doesn't make the argument completely invisible.
+
+ For monochrome documents, there is no useful interpretation for this command, so it is disabled.
+ \end{description}
+
+ \newslide
+
+ For interpreting \macroname{activatestep}:
+ \begin{description}
+ \item[\present{\macroname{highlightboxed}}]\indexmacro{highlightboxed}
+ If the \code{colorhighlight} option (see section \ref{Sec:ColorEmphasis})
+ is set, expands to a \highlightboxed{box with colored background} containing its argument. Otherwise, expands to an
+ \macroname{fbox} containing its argument. It is made sure that the resulting box has the same dimensions as the
+ argument (the outer frame may overlap surrounding text).
+
+ There is a new length register \present{\macroname{highlightboxsep}}
+ \indexmacro{highlightboxsep} which acts like \macroname{fboxsep} for the
+ resulting box and defaults to \code{0.5\macroname{fboxsep}}.
+
+ \newslide
+
+ \item[{\present[s]{\macroname{highlighttext}}}]\indexmacro{highlighttext}
+ If the \code{colorhighlight} option (see section \ref{Sec:ColorEmphasis})
+ is set, puts its argument \highlighttext{on colored background}. Otherwise, underlines its
+ argument. It is made sure that the resulting text has the same dimensions as the argument (the outer frame may
+ overlap surrounding text).
+
+ \present{\macroname{highlightboxsep}} is used to determine the extent of the coloured box(es) used as background.
+
+ This command needs the \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}} package
+ to work (compare the description of \macroname{hidetext}). If you don't load the \code{soul} package yourself, there
+ is no useful definition for this command, so it is disabled.
+
+ \newslide
+
+ \item[\present{\macroname{highlightenhanced}}]\indexmacro{highlightenhanced}
+ In a colored document, displays its argument \highlightenhanced{with
+ enhanced colors} (compare section \ref{Sec:Colors}).
+
+ For monochrome documents, there is no useful interpretation for this command, so it is disabled.
+ \end{description}
+
+ \newslide
+
+ \subsection{Variants of \macroname{step}}
+ There are a couple of custom versions of \macroname{step} which make it easier to achieve special effects needed
+ frequently.
+ \begin{description}
+ \item[\present{\macroname{bstep}}]\indexmacro{bstep}
+ Like \macroname{step}, but is \emph{always} boxed (see section
+ \ref{Sec:boxedsteps}). \commandapp{bstep}{\carg{stepcontents}} is
+ implemented in principle as
+ \code{\{\macroname{boxedsteps}\commandapp{step}{\carg{stepcontents}}\}}.
+
+ In aligned equations where \macroname{stepwise} is used for being able to put tabulators into \carg{stepcontents},
+ but where nested occurrences of \macroname{step} should be boxed to assure correct sizes of growing braces or such,
+ this variant of \macroname{step} is more convenient than using \macroname{boxedsteps} for every nested occurrence
+ of \macroname{step}.
+
+ \item[\present{\commandapp{switch}{\carg{ifinactive}\}\{\carg{ifactive}}}]
+ \indexmacro{switch} is a variant of \macroname{step} which,
+ instead of making its argument appear, switches between \carg{ifinactive}
+ and \carg{ifactive} when activated.
+
+ In fact, \commandapp{step}{\carg{stepcontents}} is in principle implemented by
+ \begin{tabbing}
+ \macroname{switch}\=\code{\{\commandapp{hidestepcontents}{\carg{stepcontents}}\}}\\
+ \>\code{\{\commandapp{displaystepcontents}{\carg{stepcontents}}\}}
+ \end{tabbing}
+
+ This command can be used, for instance, to add an \macroname{underbrace} to a formula, which is difficult using
+ \macroname{step}.
+
+ Beware of problems when \carg{ifinactive} and \carg{ifactive} have different dimensions.
+
+ \newslide
+
+ \item[\present{\macroname{dstep}}]\indexmacro{dstep}
+ A variant of \macroname{step} which takes \underl{no} argument, but simply
+ switches colors to `dimmed' (compare section \ref{Sec:Colors}) if not
+ active. Not that the scope of this color change will
+ last until the next outer group closes. This command does nothing in a monochrome document.
+
+ \item[\present{\macroname{vstep}}]\indexmacro{vstep}
+ A variant of \macroname{step} which takes \underl{no} argument, but simply
+ switches all colors to \macroname{vanishcolor} (defaults to
+ \code{pagecolor}; compare section \ref{Sec:Colorcommands}) if not
+ active. Not that the scope of this color change will last until the next outer group closes. This command does
+ nothing in a monochrome document.
+
+ \item[\present{\macroname{steponce}}]\indexmacro{steponce}
+ % \steponce[<activatefirst>]{<stepcontents>}
+ Like \macroname{step}, but goes inactive again in the subsequent step.
+
+ \item[\present{\macroname{multistep}}]\indexmacro{multistep}
+ is a shorthand macro for executing several steps successively. In
+ fact, it would better be called \macroname{multiswitch}, because it's
+ functionality is based on \macroname{switch}, it only acts like a
+ (simplified) \macroname{step} command which is executed `several times'.
+ The syntax is
+ \begin{center}
+ \commandapp[\carg{activatefirst}]{multistep}{\carg{n}\}\{\carg{stepcontents}}
+ \end{center}
+ where \carg{n} is the number of steps. Only one instance of
+ \carg{stepcontents} is displayed at a time. Inside \carg{stepcontents}, a
+ counter \code{substep} can be evaluated which tells the number of the
+ current instance. In the starred form the last instance of
+ \carg{stepcontents} stays visible.
+
+ \item[\present{\macroname{movie}}]\indexmacro{movie}
+ works like \macroname{multistep}, but between \macroname{steps}, pages are
+ advanced automatically every \carg{dur} seconds. The syntax is
+ \begin{center}
+ \commandapp{movie}{\carg{n}\}\{\carg{dur}\}[\carg{stop}]\{\carg{stepcontents}}
+ \end{center}
+ where \carg{n} is the number of steps. The additional optional argument
+ \carg{stop} gives the code (default: \macroname{stopAdvancing})
+ \indexmacro{stopAdvancing} which stops the animation.
+ (\macroname{movie} accepts the same first optional argument as
+ \macroname{multistep} but it was left out above.)
+
+
+ \item[\present{\macroname{overlays}}]\indexmacro{overlays}
+ is another shorthand macro for executing several steps successively. In
+ contrast to \macroname{multistep}, it doesn't print things \emph{after}
+ each other, but \emph{over} each other. The syntax is
+ \begin{center}
+ \commandapp[\carg{activatefirst}]{overlays}{\carg{n}\}\{\carg{stepcontents}}
+ \end{center}
+ where \carg{n} is the number of steps. Inside \carg{stepcontents}, a
+ counter \code{substep} can be evaluated which tells the number of the
+ current instance.
+ \newslide
+
+ \item[\small%
+ \present{\macroname{restep}}\indexmacro{restep},
+ \present{\macroname{rebstep}}\indexmacro{rebstep},
+ \present{\macroname{reswitch}}\indexmacro{reswitch},
+ \present{\macroname{redstep}}\indexmacro{redstep},
+ \present{\macroname{revstep}}\indexmacro{revstep}.]\mbox{}\\
+ Frequently, it is desirable for two or more steps to appear at the same
+ time, for instance to fill in arguments at
+ several places in a formula at once (see example \ref{Sec:ExEq}).
+
+ \present{\commandapp{restep}{\carg{stepcontents}}} is identical with \commandapp{step}{\carg{stepcontents}}, but is
+ activated at the same time as the previous occurrence of \macroname{step}.
+
+ \present{\macroname{rebstep}}, \present{\macroname{reswitch}}, \present{\macroname{redstep}}, and
+ \present{\macroname{revstep}} do the same for \macroname{bstep}, \macroname{switch}, \macroname{dstep}, and
+ \macroname{vstep}.
+ \end{description}
+
+ \newslide
+
+ \subsection{Optional arguments of \macroname{step}}%
+ Sometimes, letting two \macroname{step}s appear at the same time (with \macroname{restep}) is not the only desirable
+ modification of the order in which \macroname{step}s appear. \macroname{step}, \macroname{bstep} and
+ \macroname{switch} take two optional arguments for influencing the mode of activation, like this:
+ \begin{center}
+ \present{\commandapp[{\carg{activatefirst}][\carg{whenactive}}]{step}{\carg{stepcontents}}}.
+ \end{center}
+ Both \carg{activatefirst} and \carg{whenactive} should be conditions in the syntax of the \macroname{ifthenelse}
+ command (see the documentation of the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/ifthen.html}{\code{ifthen}} package for details).
+
+ \newslide
+
+ \present{\carg{activatefirst}} checks whether this \macroname{step} is to be activated \emph{for the first time}. The
+ default value is \present{\commandapp{value}{step}=\commandapp{value}{stepcommand}} (see section \ref{Sec:Internals}
+ for a list of internal values). By using \commandapp{value}{step}=\carg{$n$}, this \macroname{step} can be forced to
+ appear as the $n$th one. See example \ref{Sec:ExPar} for a demonstration of how this can be used to make
+ \macroname{step}s appear in arbitrary order.
+
+ \present{\carg{whenactive}} checks whether this \macroname{step} is to be considered active \emph{at all}. The default
+ behaviour is to check whether this \macroname{step} has been activated before (this is saved internally for every
+ step). See example \ref{Sec:ExFooling} for a demonstration of how this can be used to make \macroname{step}s appear
+ and disappear after a defined fashion.
+
+ \minisec{If you know what you're doing\dots}
+ Both optional arguments allow two syntctical forms:
+ \begin{enumerate}
+ \item enclosed in square brackets \code{[]} like explained above.
+ \item enclosed in braces \code{()}. In this case, \carg{activatefirst} and \carg{whenactive} are \emph{not} treated as
+ conditions in the sense of \macroname{ifthenelse}, but as conditionals like those used internally by \LaTeX. That
+ means, \carg{activatefirst} (when enclosed in braces) can contain arbitrary \TeX{} code which then takes two
+ arguments and expands to one of them, depending on whether the condition is fulfilled or not fulfilled. For
+ instance, \commandapp[{\carg{activatefirst}}]{step}{\carg{stepcontents}} could be replaced by
+ \macroname{step}\code{(\commandapp{ifthenelse}{\carg{activatefirst}})\{\carg{stepcontents}\}}.
+
+ See example \ref{Sec:ExBackwards} for a simple application of this syntax.
+ \end{enumerate}
+
+ Internally, the default for the treatment of \carg{whenactive} is \code{(\macroname{if@first@TP@true})}, where
+ \macroname{if@first@TP@true} is an internal condition checking whether this \macroname{step} has been activated before.
+
+ \newslide
+
+ \subsection{Finding out what's going on}\label{Sec:Internals}%
+ Inside \carg{settings} and \carg{contents}, you can refer to the following internal state variables which provide
+ information about the current state of the process executed by \macroname{stepwise}:
+ \begin{description}
+ \item[\present{counter: \code{firststep}}]
+ \indexstepwise{firststep}{counter}
+ The number from which to start counting steps (see counter \code{step}
+ below). Is $0$ by default and $1$ for starred versions (section \ref{Sec:StarredStepwise}) of \macroname{stepwise}.
+ You can set this in \carg{settings} for special effects (see example \ref{Sec:ExBackwards}).
+
+ \item[\present{counter: \code{totalsteps}}]
+ \indexstepwise{totalsteps}{counter}
+ The total number of \macroname{step} commands occurring in \carg{contents}.
+
+ \newslide
+
+ \item[\present{counter: \code{step}}]
+ \indexstepwise{step}{counter}
+ The number of the current iteration, i.\,e.\ the number of the current page in
+ the sequence of pages produced by \macroname{stepwise}. Runs from \commandapp{value}{firststep} to
+ \commandapp{value}{totalsteps}.
+
+ \item[\present{counter: \code{stepcommand}}]
+ \indexstepwise{stepcommand}{counter}
+ The number of the \macroname{step} command currently being executed.
+
+ \item[\present{boolean: \code{firstactivation}}]
+ \indexstepwise{firstactivation}{boolean}
+ \code{true} if this \macroname{step} is active for the first time,
+ \code{false} otherwise.
+
+ \item[\present{boolean: \code{active}}]\indexstepwise{active}{boolean}
+ \code{true} if this \macroname{step} is currently active, \code{false}
+ otherwise.
+ \end{description}
+ \code{stepcommand}, \code{firstactivation}, and \code{active} are useful only inside \carg{stepcontents}.
+
+
+ \newslide
+
+ \subsection{\macroname{afterstep}}\indexmacro{afterstep}%
+ It might be neccessary to set some parameters which affect the appearance of the \emph{page} (like page transitions)
+ inside \carg{stepcontents}. However, the \macroname{step} commands are usually placed deeply inside some structure, so
+ that all \emph{local} settings are likely to be undone by groups closing before the page is completed.
+
+ \present{\commandapp{afterstep}{\carg{settings}}} puts \carg{settings} right before the end of the page, after the
+ current step is performed.
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item There can be only one effective value for \carg{settings}. Every occurrence of \macroname{afterstep} overwrites
+ this value globally.
+
+ \item \macroname{afterstep} will \emph{not} be executed in \carg{stepcontents} if the corresponding \macroname{step}
+ is not active, even if \carg{stepcontents} is displayed owing to a redefinition of \macroname{hidestepcontents},
+ like in example \ref{Sec:Exhl}.
+
+ \item As \carg{settings} is put immediately before the page break, there is no means of restoring the original value
+ of whatever has been set. So if you set something via \macroname{afterstep} and want it to be reset in some later
+ step, you have to reset it explicitly with another call of \macroname{afterstep}.
+ \end{enumerate}
+
+ \newslide
+
+ %-----------------------------------------------------------------------------------------------------------------
+ %
+ \section{Page transitions and automatic advancing}\label{Sec:PageTrans}
+ \subsection{Page transitions}
+ I am indepted to \href{mailto:dongen@cs.ucc.ie}{\name{Marc van Dongen}} for allowing me to include a suite of commands
+ written by him and posted to the \href{http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/}{PPower4}
+ mailing list which set page transitions (using
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/hyperref.html}{\code{hyperref}s} \macroname{hypersetup}).
+
+ These commands work only if the \code{hyperref} package is loaded.
+
+ \newslide
+
+ The following page transition commands are defined:\pause
+ \begin{description}
+ \item[{\present[h]{\macroname{pageTransitionSplitHO}}}]
+ \indexmacro{pageTransitionSplitHO}
+ Split Horizontally to the outside. \pageTransitionSplitHO\pause
+
+ \item[{\present[h]{\macroname{pageTransitionSplitHI}}}]
+ \indexmacro{pageTransitionSplitHI}
+ Split Horizontally to the inside. \pageTransitionSplitHI\pause
+
+ \item[{\present[h]{\macroname{pageTransitionSplitVO}}}]
+ \indexmacro{pageTransitionSplitVO}
+ Split Vertically to the outside. \pageTransitionSplitVO\pause
+
+ \item[{\present[h]{\macroname{pageTransitionSplitVI}}}]
+ \indexmacro{pageTransitionSplitVI}
+ Split Vertically to the inside. \pageTransitionSplitVI\pause
+
+ \item[{\present[h]{\macroname{pageTransitionBlindsH}}}]
+ \indexmacro{pageTransitionBlindsH}
+ Horizontal Blinds. \pageTransitionBlindsH\pause
+
+ \item[{\present[h]{\macroname{pageTransitionBlindsV}}}]
+ \indexmacro{pageTransitionBlindsV}
+ Vertical Blinds. \pageTransitionBlindsV
+
+ \newslide
+
+ \item[{\present[h]{\macroname{pageTransitionBoxO}}}]
+ \indexmacro{pageTransitionBoxO}
+ Growing Box. \pageTransitionBoxO\pause
+
+ \item[{\present[h]{\macroname{pageTransitionBoxI}}}]
+ \indexmacro{pageTransitionBoxI}
+ Shrinking Box. \pageTransitionBoxI\pause
+
+ \item[{\present[h]{\commandapp{pageTransitionWipe}{\carg{angle}}}}]
+ \indexmacro{pageTransitionWipe}\mbox{}\\
+ Wipe from one edge of the page to the facing edge.
+
+ \stepwise
+ {%
+ \carg{angle} is a number between $0$ and $360$ which specifies the direction (in degrees) in which to wipe.
+
+ Apparently, only the values \afterstep{\pageTransitionWipe{0}}$0$, \step{\afterstep{\pageTransitionWipe{90}}$90$,}
+ \step{\afterstep{\pageTransitionWipe{180}}$180$,} \step{$270$ are supported.}%
+ }%
+ \pageTransitionWipe{270}\pause
+
+ \item[{\present[h]{\macroname{pageTransitionDissolve}}}]
+ \indexmacro{pageTransitionDissolve}
+ Dissolve. \pageTransitionDissolve
+
+ \newslide
+
+ \item[{\present[h]{\commandapp{pageTransitionGlitter}{\carg{angle}}}}]
+ \indexmacro{pageTransitionGlitter}\mbox{}\\
+ Glitter from one edge of the page to the facing edge.
+
+ \stepwise
+ {%
+ \carg{angle} is a number between $0$ and $360$ which specifies the direction (in degrees) in which to glitter.
+
+ Apparently, only the values \afterstep{\pageTransitionGlitter{0}}$0$,
+ \step{\afterstep{\pageTransitionGlitter{270}}$270$,} \step{$315$ are supported.}%
+ }%
+ \pageTransitionGlitter{315}\pause
+
+ \item[{\present[h]{\macroname{pageTransitionReplace}}}]
+ \indexmacro{pageTransitionReplace}
+ Simple Replace (the default).
+ \end{description}
+
+ \pageTransitionReplace
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item The setting of the page transition is a property of the \emph{page}, i.~e.\ whatever page transition is in
+ effect when a page break occurs, will be assigned to the corresponding pdf page.
+
+ \item The setting of the page transition is undone when a group ends.
+
+ Make sure no \LaTeX{} environment is ended between a \macroname{pageTransition} setting and the next page break. In
+ particular, in \carg{stepcontents}, \macroname{afterstep} should be used (see example \ref{Sec:ExPic}).
+
+ \newslide
+
+ \item Setting page transitions works well with \macroname{pause}. Here, \macroname{pause} acts as a page break,
+ i.\,e.\ a different page transition can be set before every occurrence of \macroname{pause}.
+ \end{enumerate}
+
+ \newslide
+
+ \subsection{Automatic advancing of pages}\label{Sec:PageDuration}
+ If you have loaded a sufficiently new version of the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/hyperref.html}{\code{hyperref}} package (which allows to
+ set \code{pdfpageduration}), then the following command is defined which enables automatic advancing of \code{pdf}
+ pages.
+
+ \present[h]{\commandapp{pageDuration}{\carg{dur}}}\indexmacro{pageDuration}
+ causes pages to be advanced automatically every \carg{dur}
+ seconds. \carg{dur} should be a non-negative fixed-point number.
+
+ \pageDuration{2}\pause
+
+ Depending on the \code{pdf} viewer, this will happen only in full-screen mode.
+
+ See example \ref{Sec:ExFooling} for a demonstration of this effect.
+
+ \stopAdvancing
+
+ \newslide
+
+ The same restrictions as for \concept{page transitions} apply. In particular, the page duration setting is undone by
+ the end of a group, i.\,e.\ it is useless to set the page duration if a \LaTeX{} environment ends before the next page
+ break.
+
+ There is no `neutral' value for \carg{dur} ($0$ means advance as fast as possible). You can make automatic advancing
+ stop by calling \commandapp{pageDuration}{}. \code{texpower} offers the custom command
+ \begin{center}
+ \present[h]{\macroname{stopAdvancing}}\indexmacro{stopAdvancing}
+ \end{center}
+ to do this.
+
+ \newslide
+
+ %-----------------------------------------------------------------------------------------------------------------
+ %
+ \section{Color management, color emphasis and highlighting}\label{Sec:ColorEmphasis}
+ \TeX Power tries to find out whether you are making a colored document. This is assumed if
+ \begin{itemize}
+ \item the \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/color.html}{\code{color}} package has been
+ loaded before the \code{texpower} package or
+ \item a color-related option (see sections \ref{Sec:ColBgdOpt} and \ref{Sec:ColorOptions}) is given to the
+ \code{texpower} package (in this case, the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/color.html}{\code{color}} package is loaded
+ automatically).
+ \end{itemize}
+ If this is the case, \TeX Power installs an extensive color management scheme on top of the kernel of the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/color.html}{\code{color}} package.
+
+ In the following, some new concepts established by this management scheme are explained. Sections \ref{Sec:ColBgdOpt}
+ and \ref{Sec:ColorOptions} list options for color activation, section \ref{Sec:Colorcommands} lists some new
+ highlighting commands, and section \ref{Sec:Colors} gives the names and meaning of \TeX Power's predefined colors.
+
+ Note that parts of the kernel of the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/color.html}{\code{color}} package are overloaded for
+ special purposes (getting driver-independent representations of defined colors to be used by \macroname{colorbetween}
+ (\ref{Sec:MiscColorCommands}), for instance), so it is recommended to execute color definition commands like
+ \macroname{definecolor} \emph{after} the \code{texpower} package has been loaded (see also the next section on
+ \macroname{defineTPcolor}).
+
+ \newslide
+
+ \subsection{Standard colors}\label{Sec:StdCols}
+ \TeX Power maintains a list of \concept{standard colors} which are recognized and handled by \TeX Power's color
+ management. Some commands like \macroname{dimcolors} (see section \ref{Sec:ColorVariants}) affect \emph{all} standard
+ colors. There are some predefined colors which are in this list from the outset (see section \ref{Sec:Colors}).
+
+ If colors defined by the user are to be recognized by \TeX Power, they have to be included in this list. The easiest
+ way is to use the following command for defining them.
+
+ \newslide
+
+ \present{\commandapp{defineTPcolor}{\carg{name}\}\{\carg{model}\}\{\carg{def}}}
+ \indexmacro{defineTPcolor} acts like \macroname{definecolor}
+ \indexmacro{defineTPcolor} from the \code{color} package, but the color
+ \carg{name} is also added to the list of standard colors.
+
+ If you want to make a color a standard color which is defined elsewhere (by a document class, say), you can simply add
+ it to the list of standard colors with the command
+ \present{\commandapp{addTPcolor}{\carg{name}}}\indexmacro{addTPcolor}.
+
+ \newslide
+
+ \subsection{Color sets}
+ Every standard color may be defined in one or several \concept{color sets}. There are two fundamentally different
+ types of color set:
+ \begin{description}
+ \item[The current color set.] This contains the current definition of every standard color which is actually used at
+ the moment. Every standard color should be defined at least in the current color set. The current color set is not
+ distinguished by a special name.
+
+ \newslide
+
+ \item[Named color sets.] These are `containers' for a full set of color definitions (for the standard colors) which
+ can be activated by respective commands (see below). The color sets are distinguished by their names. Color
+ definitions in a named color set are not currently available, they have to be made available by activating the named
+ color set.
+
+ There are four predefined color sets named \code{whitebg}\indexcode{whitebg},
+ \code{lightbg}\indexcode{lightbg}, \code{darkbg}\indexcode{darkbg},
+ \code{blackbg}\indexcode{blackbg}, each of which contains a full set of (predefined)
+ standard colors customized for a white, light, dark, black background
+ color, respectively.
+ \end{description}
+
+ \newslide
+
+ There are the following commands for manipulating color sets:
+ \begin{description}
+ \item[\present{\commandapp{usecolorset}{\carg{name}}}]\indexmacro{usecolorset}
+ Make the color set named \carg{name} the current color set.
+ \emph{All standard colors in the current color set which are also in color set \carg{name} are overwritten.}
+
+ The standard color \code{textcolor} is set automatically after activating color set \carg{name}.
+
+ \item[\present{\commandapp{dumpcolorset}{\carg{name}}}]\indexmacro{dumpcolorset}
+ Copy the definitions of \emph{all} standard colors in the
+ current color set into color set named \carg{name}. All standard colors in color set \carg{name} will be
+ overwritten.
+ \end{description}
+
+ \newslide
+
+ Using \commandapp{defineTPcolor}{\carg{name}} or \commandapp{definecolor}{\carg{name}} will define the color
+ \carg{name} in the \emph{current} color set. To define a color in color set \carg{cset}, use
+ \present{\commandapp[\carg{cset}]{defineTPcolor}{\carg{name}}}.
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item Color sets are not really `\TeX{} objects', but are distinguished by color name suffixes. This means, a color
+ named \code{foo} is automatically in the current color set. Executing \commandapp[\carg{cset}]{defineTPcolor}{foo}
+ means executing \macroname{definecolor} for a specific color the name of which is a combination of \code{foo} and
+ \carg{cset}.
+
+ Consequently, \macroname{usecolorset} and \macroname{dumpcolorset} do not copy color sets as composite objects, but
+ simply all colors the names of which are generated from the list of standard colors.
+
+ \newslide
+
+ \item The command \commandapp{usecolorset}{\carg{name}} overwrites only those colors which have been defined in color
+ set \carg{name}. If a standard color is defined in the current color set, but not in color set \carg{name}, it is
+ preserved (but if \commandapp{dumpcolorset}{\carg{name}} is executed later, then it will also be copied back into
+ the color set \carg{name}).
+ \end{enumerate}
+
+ \newslide
+
+ \subsection{Color Background Options}\label{Sec:ColBgdOpt}
+ For activating the predefined color sets, there are shorthands
+ \macroname{whitebackground}\indexmacro{whitebackground},
+ \macroname{lightbackground}\indexmacro{lightbackground},
+ \macroname{darkbackground}\indexmacro{darkbackground},
+ \macroname{blackbackground}\indexmacro{blackbackground} which execute
+ \macroname{usecolorset} and additionally set the background color to its current value.
+
+ \newslide
+
+ When one of the following options is given, the respective command is executed automatically at the beginning of the
+ document.
+ \begin{description}
+ \item[\present{option: \code{whitebackground} (default)}]
+ \indexpckopt{texpower}{whitebackground}
+ Set standard colors to match a white background color.
+
+ \item[\present{option: \code{lightbackground}}]
+ \indexpckopt{texpower}{lightbackground}
+ Set standard colors to match a light (but not white) background color.
+
+ \item[\present{option: \code{darkbackground}}]
+ \indexpckopt{texpower}{darkbackground}
+ Set standard colors to match a dark (but not black) background color.
+
+ \item[\present{option: \code{blackbackground}}]
+ \indexpckopt{texpower}{blackbackground}
+ Set standard colors to match a black background color.
+ \end{description}
+
+ \newslide
+
+ \subsection{Color variants}\label{Sec:ColorVariants}
+ In addition to color sets, \TeX Power implements a concept of \concept{color variant}. Currently, every color has three
+ variants: \concept{normal}, \concept{dimmed}, and \concept{enhanced}. The normal variant is what is usually seen, text
+ written in the dimmed variant appears ``faded into the background'' and text written in the enhanced variant appears
+ to ``stick out''.
+
+ \newslide
+
+ When switching variants, for every color one of two cases can occur:
+ \begin{enumerate}
+ \item A \concept{designated color} for this variant has been defined.
+
+ For color \carg{color} the designated name of the \concept{dimmed}
+ \indexcode{dimmed color variant} variant is \code{d\carg{color}}, the designated
+ name of the \concept{enhanced}\indexcode{enhanced color variant} variant is
+ \code{e\carg{color}}.
+
+ If a color by that name exists at the time the variant is switched to, then variant switching is executed by
+ replacing color \carg{color} with the designated color.
+
+ \newslide
+
+ \item A \concept{designated color} for this variant has not been defined.
+
+ If a color by the designated name does not exist at the time a color variant is switched to, then variant switching
+ is executed by \concept{automatically} calculating the color variant from the original color.
+
+ The method for calculation depends on the variant:
+
+ \newslide
+
+ \begin{description}
+ \item[dimmed.] The dimmed variant is calculated by \concept{interpolating} between \code{pagecolor} and the color to
+ be dimmed, using the \macroname{colorbetween} command (see \ref{Sec:MiscColorCommands}).
+
+ There is a command \present{\macroname{dimlevel}}\indexmacro{dimlevel}
+ which contains the parameter \carg{weight} given to \macroname{colorbetween}
+ (default: \code{0.7}). This default can be overridden by either redefining
+ \macroname{dimlevel} or giving an alternative \carg{weight} as an optional
+ argument to the color dimming command (see below).
+
+ \newslide
+
+ \item[enhanced.] The enhanced variant is calculated by \concept{extrapolating} the color to be enhanced (relative to
+ \code{pagecolor}).
+
+ There is a command \present{\macroname{enhancelevel}}\indexmacro{enhancelevel}
+ which gives the \concept{extent} of the extrapolation (default: \code{0.5}).
+ The same holds for overriding this default as for \macroname{dimlevel}.
+ \end{description}
+ \end{enumerate}
+
+ \newslide
+
+ The following commands switch color variants:
+ \begin{description}
+ \item[\present{\commandapp[\carg{level}]{dimcolor}{\carg{color}}}]
+ \indexmacro{dimcolor} switches color \carg{color} to the \concept{dimmed}
+ variant. If given, \carg{level} replaces the value of \macroname{dimlevel} in automatic calculation of the dimmed
+ variant (see above).
+
+ \item[\present{\code{\macroname{dimcolors}[\carg{level}]}}]
+ \indexmacro{dimcolors} switches \emph{all} standard colors to the \concept{dimmed}
+ variant. The optional argument \carg{level} acts as for \macroname{dimcolor}.
+
+ \newslide
+
+ \item[\present{\commandapp[\carg{level}]{enhancecolor}{\carg{color}}}]
+ \indexmacro{enhancecolor} switches color \carg{color} to the
+ \concept{enhanced} variant. If given, \carg{level} replaces the value of \macroname{enhancelevel} in automatic
+ calculation of the enhanced variant (see above).
+
+ \item[\present{\code{\macroname{enhancecolors}[\carg{level}]}}]
+ \indexmacro{enhancecolors} switches \emph{all} standard colors to the
+ \concept{enhanceed} variant. The optional argument \carg{level} acts as for \macroname{enhancecolor}.
+ \end{description}
+
+ \newslide
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item While automatic calculation of a \concept{dimmed} color will almost always yield the desired result
+ (interpolating between colors by calculating a weighted average is trivial), automatic calculation of an
+ \concept{enhanced} color by `extrapolating' is tricky at best and will often lead to unsatisfactory results. This is
+ because the idea of making a color `stronger' is very hard to formulate numerically.
+
+ \newslide
+
+ The following effects of the current algorithm should be kept in mind:
+ \begin{itemize}
+ \item if the background color is light, enhancing a color will make it darker;
+ \item if the background color is dark, enhancing a color will make it lighter;
+ \item sometimes, the numerical values describing an enhanced color have to be \concept{bounded} to avoid exceeding
+ the allowed range, diminishing the enhancing effect. For instance, if the background color is black and the color
+ to be enhanced is a `full-powered' yellow, there is no way of enhancing it by simple numeric calculation.
+ \end{itemize}
+
+ \newslide
+
+ As a conclusion, for best results it is recommended to provide custom \code{e} variants of colors to be enhanced. By
+ default, \TeX Power does not provide dedicated enhanced colors, but the file \code{tpsettings.cfg} contains complete
+ sets of enhanced variants for the standard colors in the different color sets, which you can uncomment and
+ experiment with as convenient.
+
+ \newslide
+
+ \item Currently, switching to a different color variant is done by simply overwriting the current definitions of all
+ standard colors. This means
+ \begin{itemize}
+ \item there is no way of `undimming' a color once it has been dimmed,
+ \item a dimmed color can not be enhanced and vice versa.
+ \end{itemize}
+ Maybe this will be solved in a slightly more clever way in subsequent releases of \TeX Power.
+
+ \newslide
+
+ Hence, it is recommended to
+ \begin{itemize}
+ \item restrict the \concept{scope} of a global variant switching command like \macroname{dimcolors},
+ \macroname{enhancecolors} or \macroname{dstep} by enlcosing it into a \LaTeX{} group (like \code{\{\dots\}}) or
+ \item use \macroname{dumpcolorset} before the command to save the current definitions of all colors, to be restored
+ with \macroname{usecolorset}.
+
+ At the very beginning of a \macroname{stepwise} command, \TeX Power executes \commandapp{dumpcolorset}{stwcolors},
+ so you can restore the colors anywhere in the argument of \macroname{stepwise} by saying
+ \commandapp{usecolorset}{stwcolors}.
+ \end{itemize}
+
+ \newslide
+
+ \item Some rudimentary attempts are made to keep track of which color is in what variant, to the effect that
+ \begin{itemize}
+ \item a color which is not in the normal variant will neither be dimmed nor enhanced;
+ \item when \macroname{usecolorset} overwrites a color with its normal variant, this is registered.
+ \end{itemize}
+ Still, it is easy to get in trouble by mixing variant changes with color set changes (say, if not all standard
+ colors are defined in a color set, or if a color set is dumped when not all colors are in normal variant), so it is
+ recommended not to use or dump color sets when outside the normal variant (unless for special applications like
+ undoing a variant change by \commandapp{usecolorset}{stwcolors}).
+ \end{enumerate}
+
+
+ \newslide
+
+ \subsection{Miscellaneous color management commands}\label{Sec:MiscColorCommands}
+ \begin{description}
+ \item[\present{\commandapp[\carg{tset}]{replacecolor}{\carg{tcolor}\}[\carg{sset}]\{\carg{scolor}}}]
+ \indexmacro{} makes
+ \carg{tcolor} have the same definition as \carg{scolor} (if \carg{scolor} is defined at all), where \carg{tcolor}
+ and \carg{scolor} are color names as given in the first argument of \macroname{definecolor}. If (one of)
+ \carg{tset} and \carg{sset} are given, the respective color is taken from the respective color set, otherwise from
+ the current color set.
+
+ If \carg{scolor} is not defined (in color set \carg{sset}), \carg{tcolor} is left alone.
+
+ \newslide
+
+ \item[\present{\commandapp[\carg{weight}]{colorbetween}{\carg{src1}\}\{\carg{src2}\}\{\carg{target}}}]
+ \indexmacro{colorbetween} calculates a
+ `weighted average' between two colors. \carg{src1} and \carg{src2} are the names of the two colors. \carg{weight}
+ (default: $0.5$) is a fixed-point number between $0$ and $1$ giving the `weight' for the interpolation between
+ \carg{src1} and \carg{src2}. \carg{target} is the name to be given to the resulting mixed color.
+
+ If \carg{weight} is $1$, then \carg{target} will be identical to \carg{src1} (up to color model conversions, see
+ below), if \carg{weight} is $0$, then \carg{target} will be identical to \carg{src2}, if \carg{weight} is $0.5$
+ (default), then \carg{target} will be exactly in the middle between \carg{src1} and \carg{src2}.
+
+ \macroname{colorbetween} supports the following color models: \code{rgb}, \code{RGB}, \code{gray}, \code{cmyk},
+ \code{hsb}. If both colors are of the same model, the resulting color is also of the respective model. If
+ \carg{src1} and \carg{src2} are from \emph{different} models, then \carg{target} will \emph{always} be an \code{rgb}
+ color. The only exception is the \code{hsb} color model: As I don't know how to convert \code{hsb} to \code{rgb},
+ mixing \code{hsb} with another color model will always raise an error.
+
+ \newslide
+
+ \item[\present{\commandapp{mkfactor}{\carg{expr}\}\{\carg{macroname}}}]
+ \indexmacro{mkfactor} is a helper command for automatically
+ generating the fixed point numbers between $0$ and $1$ which are employed by the color calculation commands.
+ \carg{expr} can be any expression which can stand behind \code{*} in expressions allowed by the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/calc.html}{\code{calc}} package (for instance:
+ \code{\commandapp{value}{counter}/\commandapp{value}{maxcounter}} or \macroname{ratio} or whatever).
+ \carg{macroname} should be a valid macro name. \carg{expr} is converted into a fixed-point representation which is
+ then assigned to \carg{macroname}.
+
+ \newslide
+
+ \item[\present{\code{\macroname{vanishcolors}[\carg{color}]}}]
+ \indexmacro{vanishcolors} is similar to the color variant command
+ \macroname{dimcolors}, but instead of dimming colors, all standard colors are replaced by a single color given by
+ the new command \present{\macroname{vanishcolor}} (default: \code{pagecolor}). Hence, the result of calling
+ \macroname{vanishcolors} should be that all text vanishes, as it is written in the background color (this doesn't
+ work with structured backgrounds, of course).
+
+ For getting a color different from the default \code{pagecolor}, you can either redefinine \macroname{vanishcolor}
+ or give an alternative \carg{color} as an optional argument to \macroname{vanishcolors}.
+
+ There is no dedicated command for making a single color vanish. To achieve this, use
+ \commandapp{replacecolor}{\carg{color}\}\{\macroname{vanishcolor}}.
+ \end{description}
+
+
+ \subsection{Color Emphasis and Highlighting}\label{Sec:ColorOptions}
+ \code{texpower} offers some support for text emphasis and highlighting with colors (instead of, say, font
+ changes). These features are enabled by the following options:
+ \begin{description}
+ \item[\present{option: \code{coloremph}}]\indexpckopt{texpower}{coloremph}
+ Make \macroname{em} and \macroname{emph} switch colors instead of fonts.
+
+ \item[\present{option: \code{colormath}}]\indexpckopt{texpower}{colormath}
+ Color all mathematical formulae.
+
+ \item[\present{option: \code{colorhighlight}}]\indexpckopt{texpower}{colorhighlight}
+ Make new highlighting and emphasis commands defined by \code{texpower}
+ use colors.
+ \end{description}
+
+ \minisec{Things to pay attention to}
+ \begin{enumerate}
+ \item You need the \code{color} package to use any of the color features.
+
+ \item To implement the options \code{coloremph} and \code{colormath}, it is neccessary to redefine some \LaTeX{}
+ internals. This can lead to problems and incompatibilities with other packages. Use with caution.
+
+ \item If the \code{colorhighlight} option is \emph{not} given, new highlighting and emphasis commands defined by
+ \code{texpower} are realized otherwise. Sometimes, however, there is no good alternative to colors, so different
+ emphasis commands can become disabled or indistinguishable.
+
+ \newslide
+
+ \item Because of font changes, emphasized or highlighted text can have different dimensions whether or not the options
+ \code{coloremph}, \code{colormath}, and \code{colorhighlight} are set. Prepare for different line and page breaks
+ when changing one of these options.
+
+ \item Color emphasis and highlighting makes use of the predefined standard colors described in section
+ \ref{Sec:Colors}. See sections \ref{Sec:StdCols} to \ref{Sec:ColBgdOpt} for further information on standard colors,
+ color sets, and customization.
+ \end{enumerate}
+
+ \newslide
+
+ \subsection{New commands for emphasis and highlighting elements}\label{Sec:Colorcommands}
+ Some things like setting the page or text color, making emphasised text or math colored are done automatically when
+ the respective options are set. There are some additional new commands for creating emphasis and highlighting
+ elements.
+
+ \minisec{Concerning math:}
+ \begin{description}
+ \item[\present{\macroname{origmath}}]\indexmacro{origmath}
+ When the \code{colormath} option is given, \emph{everything} which appears in
+ math mode is colored accordingly. Sometimes, however, math mode is used for something besides mathematical formulae.
+ Some \LaTeX{} commands which internally use math mode (like \code{tabular} or \macroname{textsuperscript}) are
+ redefined accordingly when the \code{colormath} option is given (this is a potential source of trouble; beware of
+ problems\dots).
+
+ If you need to use math mode for something which is not to be colored (like a symbol for \code{itemize}), you can
+ use the \macroname{origmath} command which works exactly like \macroname{ensuremath} but doesn't color its argument.
+ If a nested use of math mode should occur in the argument of \macroname{origmath}, it will again be colored.
+ \end{description}
+
+ \newslide
+
+ \minisec{Documenting \TeX{} code:}
+ \begin{description}
+ \item[\present{\macroname{code}}]\indexmacro{code}
+ Simple command for typesetting \code{code} (like shell commands).
+
+ \item[\present{\macroname{macroname}}]\indexmacro{macroname}
+ For \macroname{macro names}. Like \macroname{code}, but with a \macroname{} in
+ front.
+
+ \item[\present{\commandapp[\carg{opt arg}]{commandapp}{\carg{command}\}\{\carg{arg}}}]
+ \indexmacro{commandapp} For \TeX{} commands. \carg{arg}
+ stands for the command argument, \carg{opt arg} for an optional argument.
+
+ \item[\present{\macroname{carg}}]\indexmacro{carg}
+ For \carg{macro arguments}.
+ \end{description}
+
+ \newslide
+
+ \minisec{Additional emphasis commands:}
+ \begin{description}
+ \item[\present{\macroname{underl}}]\indexmacro{underl}
+ Additional \underl{emphasis} command. Can be used like \macroname{emph}. Defaults
+ to \textbf{bold face} if the \code{colorhighlight} option is not given.
+
+ \item[\present{\macroname{concept}}]\indexmacro{concept}
+ Additional \concept{emphasis} command, especially for new concepts. Can be
+ augmented by things like automatic index entry creation. Also defaults to \textbf{bold face} if the
+ \code{colorhighlight} option is not given.
+
+ \item[\present{\macroname{inactive}}]\indexmacro{inactive}
+ Additional \inactive{emphasis} command, this time for `de-emphasising'. There is
+ no sensible default if the \code{colorhighlight} option is not given, as base \LaTeX{} doesn't offer an appropriate
+ font. In this case, \macroname{inactive} defaults to \macroname{monochromeinactive}, which does nothing.
+
+ You can (re-)define \macroname{monochromeinactive} to provide some sensible behaviour in the absence of colors, for
+ instance striking out if you're using the
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/soul.html}{\code{soul}} package.
+ \end{description}
+
+
+ \minisec{Color Highlighting:}
+ \begin{description}
+ \item[\present{\macroname{present}}]\indexmacro{present}
+ Highlighting command which puts its argument into a \present{box with colored
+ background}. Defaults to an \fbox{\macroname{fbox}} if the \code{colorhighlight} option is not given.
+
+ See section \ref{Sec:displaycustom} for some further highlighting commands.
+ \end{description}
+
+ \newslide
+
+ \subsection{Predefined standard colors}\label{Sec:Colors}
+ In previous subsections, it has been mentioned that \TeX Power predefines some standard colors which have appropriate
+ values in the predefined color sets \code{whitebg}, \code{lightbg}, \code{darkbg}, and \code{blackbg} (see sections
+ \ref{Sec:StdCols} to \ref{Sec:ColBgdOpt} for further information on standard colors, color sets, and customization).
+ \begin{description}
+ \item[\present{color: \code{pagecolor}}]\indexcode{pagecolor}
+ Background color of the page. Is set automatically at the beginning of the
+ document if color management is active.
+
+ \item[\present{color: \code{textcolor}}]\indexcode{textcolor}
+ Color of normal text. Is set automatically at the beginning of the
+ document if color management is active.
+
+ \item[\present{color: \code{emcolor}}]\indexcode{emcolor}
+ Color used for \emph{emphasis} if the \code{coloremph} option is set.
+
+ \item[\present{color: \code{altemcolor}}]\indexcode{altemcolor}
+ Color used \emph{for \emph{double} emphasis} if the \code{coloremph} option
+ is set.
+
+ \item[\present{color: \code{mathcolor}}]\indexcode{mathcolor}
+ Color used for math $a^2+b^2=c^2$ if the \code{colormath} option is set.
+
+ \item[\present{color: \code{codecolor}}]\indexcode{codecolor}
+ Color used by the \macroname{code} command if the \code{colorhighlight}
+ option is set.
+
+ \item[\present{color: \code{underlcolor}}]\indexcode{underlcolor}
+ Color used by the \underl{\macroname{underl} command} if the
+ \code{colorhighlight} option is set.
+
+ \item[\present{color: \code{conceptcolor}}]\indexcode{conceptcolor}
+ Color used by the \concept{\macroname{concept} command} if the
+ \code{colorhighlight} option is set.
+
+ \newslide
+
+ \item[\present{color: \code{inactivecolor}}]\indexcode{inactivecolor}
+ Color used by the \inactive{\macroname{inactive} command} if the
+ \code{colorhighlight} option is set.
+
+ \item[\present{color: \code{presentcolor}}]\indexcode{presentcolor}
+ Color used as background color by the \present{\macroname{present}}
+ command if the \code{colorhighlight} option is set.
+
+ \item[\present{color: \code{highlightcolor}}]\indexcode{highlightcolor}
+ Color used as background color by the
+ \highlightboxed{\macroname{highlightboxed}} and \macroname{highlighttext} commands (see section
+ \ref{Sec:displaycustom}) if the \code{colorhighlight} option is set.
+ \end{description}
+
+\ifthenelse{\boolean{TPcolor}}
+{%
+ \newslide
+
+ \whitebackground
+
+ \minisec{Color tables}
+
+ \newlength{\widthfirstcol}
+ \settowidth{\widthfirstcol}{\textbf{\footnotesize white background}}
+
+ \vspace*{\fill}
+ \begin{center}
+ \begin{tabular}{|p{\widthfirstcol}*{3}{|p{2cm}}|}
+ \cline{2-4}
+ \multicolumn{1}{l|}{\textbf{\footnotesize white background}}&standard&dimmed&enhanced\\\hline
+ \code{textcolor}&\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{emcolor}&\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{altemcolor}&\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{mathcolor}&\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{codecolor}&\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{underlcolor}&\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{conceptcolor}&\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{inactivecolor}&\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{presentcolor}&\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{highlightcolor}&\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \end{tabular}
+ \end{center}
+
+ \newslide
+
+ \lightbackground
+
+ \vspace*{\fill}
+ \begin{center}
+ \begin{tabular}{|p{\widthfirstcol}*{3}{|p{2cm}}|}
+ \cline{2-4}
+ \multicolumn{1}{l|}{\textbf{\footnotesize light background}}&standard&dimmed&enhanced\\\hline
+ \code{textcolor}&\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{emcolor}&\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{altemcolor}&\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{mathcolor}&\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{codecolor}&\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{underlcolor}&\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{conceptcolor}&\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{inactivecolor}&\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{presentcolor}&\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{highlightcolor}&\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \end{tabular}
+ \end{center}
+
+ \newslide
+
+ \darkbackground
+
+ \vspace*{\fill}
+ \begin{center}
+ \begin{tabular}{|p{\widthfirstcol}*{3}{|p{2cm}}|}
+ \cline{2-4}
+ \multicolumn{1}{l|}{\textbf{\footnotesize dark background}}&standard&dimmed&enhanced\\\hline
+ \code{textcolor}&\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{emcolor}&\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{altemcolor}&\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{mathcolor}&\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{codecolor}&\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{underlcolor}&\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{conceptcolor}&\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{inactivecolor}&\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{presentcolor}&\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{highlightcolor}&\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \end{tabular}
+ \end{center}
+
+ \newslide
+
+ \blackbackground
+
+ \vspace*{\fill}
+ \begin{center}
+ \begin{tabular}{|p{\widthfirstcol}*{3}{|p{2cm}}|}
+ \cline{2-4}
+ \multicolumn{1}{l|}{\textbf{\footnotesize black background}}&standard&dimmed&enhanced\\\hline
+ \code{textcolor}&\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{textcolor}\textcolor{textcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{emcolor}&\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{emcolor}\textcolor{emcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{altemcolor}&\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{altemcolor}\textcolor{altemcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{mathcolor}&\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{mathcolor}\textcolor{mathcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{codecolor}&\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{codecolor}\textcolor{codecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{underlcolor}&\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{underlcolor}\textcolor{underlcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{conceptcolor}&\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{conceptcolor}\textcolor{conceptcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{inactivecolor}&\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{inactivecolor}\textcolor{inactivecolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{presentcolor}&\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{presentcolor}\textcolor{presentcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \code{highlightcolor}&\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\dimcolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}&\enhancecolor{highlightcolor}\textcolor{highlightcolor}{\rule{2cm}{\heightof{l}}}\\\hline
+ \end{tabular}
+ \end{center}
+}{}
+
+ \newslide
+
+ \ifthenelse{\boolean{TPcolor}}{\lightbackground}{}
+
+ %-----------------------------------------------------------------------------
+ %
+ \section{Structured page backgrounds and panels}\label{Sec:PageBackPanel}
+ \subsection{Structured page backgrounds}
+
+ \present{\commandapp[\carg{options}]{backgroundstyle}{\carg{style}}}
+ \indexmacro{backgroundstyle}
+ is the central command for structured page backgrounds. It works like
+ \macroname{pagestyle} and other commands of this type. This means
+ \carg{style} is a symbolic name specifying the general method by which the
+ page background is constructed.
+
+ The detailed construction is influenced by parameters which can be set in
+ \carg{options}. If given, the optional parameter \carg{options} should
+ contain a list of settings in ``keyval'' manner. The keyval method
+ % (which is used by the \includegraphics command from the graphicx package,
+ %for instance)
+ is based on associating a symbolic name with every parameter. \carg{options}
+ is then a comma-separated list of parameter settings of the form
+ \carg{name}=\carg{value}, where \carg{name} is the symbolic name of the
+ parameter to be set and \carg{value} is the value it is to be set to.
+
+ Not every \carg{style} evaluates every parameter. In the following, a
+ description of all styles, together with lists of the parameters employed, is
+ given. It is followed by a list of all parameters. Note that some parameter
+ names internally access the same parameter. For instance, parameters
+ \code{startcolor} and \code{startcolordef} both set the start color of a color
+ gradient. In case of conflict, the last setting in the list \carg{options}
+ will prevail. It is noted in the list of parameters which other parameters
+ are overwritten.
+
+ \newslide
+
+ \carg{style} may have one of the following values:
+ \begin{description}
+ \item[\present{Style: \code{none}}]
+ \indexmacroopt{backgroundstyle}{none}%
+ No background. This means the page background is whatever it would be if
+ \macroname{backgroundstyle} wasn't used at all (for instance, a plain area
+ of color pagecolor if one of the color options has been given).
+
+ Parameters used: none.
+
+ \item[\present{Style: \code{plain}}]
+ \indexmacroopt{backgroundstyle}{plain}%
+ Plain background. This means the page background is whatever it would be if
+ \macroname{backgroundstyle} wasn't used at all (as for no background). In
+ addition to background style \code{none}, the background style \code{plain}
+ does produce panel backgrounds. The colors and dimensions of a \code{top
+ panel}, \code{bottom panel}, \code{left panel}, and \code{right panel} can
+ be specified.
+
+ \begin{flushleft}
+ Parameters used: \code{hpanels}, \code{autopanels}, \code{toppanelcolor},
+ \code{bottompanelcolor}, \code{leftpanelcolor}, \code{rightpanelcolor},
+ \code{toppanelcolordef}, \code{bottompanelcolordef}, \code{leftpanelcolordef},
+ \code{rightpanelcolordef}, \code{toppanelheight}, \code{bottompanelheight},
+ \code{leftpanelwidth}, \code{rightpanelwidth}.
+ \end{flushleft}
+
+ \item[\present{Style: \code{vgradient}}]
+ \indexmacroopt{backgroundstyle}{vgradient}%
+ Vertical gradient. The page background is constructed using the
+ \macroname{vgradrule}\indexmacro{vgradrule} command. In addition to the
+ usual parameters of gradient rules, the vgradient background style allows
+ to leave space for headers, footers, or panels. The colors and dimensions
+ of a \code{top panel}, \code{bottom panel}, \code{left panel}, and
+ \code{right panel} can be specified. The gradient rule fills the
+ rectangular space left between the specified panels.
+
+ \begin{flushleft}
+ Parameters used: \code{stripes}, \code{firstgradprogression},
+ \code{startcolor}, \code{startcolordef}, \code{endcolor}, \code{endcolordef}
+ in addition to the parameters used for style \code{plain}.
+ \end{flushleft}
+
+ \item[\present{Style: \code{hgradient}}]
+ \indexmacroopt{backgroundstyle}{hgradient}%
+ Horizontal gradient. The page background is constructed using the
+ \macroname{hgradrule}\indexmacro{hgradrule} command. See the description of
+ \macroname{vgradient} concerning panels.
+
+ Parameters used: See list for style \code{vgradient}.
+
+ \item[\present{Style: \code{doublevgradient}}]
+ \indexmacroopt{backgroundstyle}{doublevgradient}%
+ Double vertical gradient. The page background is constructed using the
+ \macroname{dblvgradrule}\indexmacro{dblvgradrule} command. See the
+ description of \macroname{vgradient} concerning panels.
+
+ \begin{flushleft}
+ Parameters used: \code{gradmidpoint}, \code{secondgradprogression},
+ \code{midcolor}, \code{midcolordef} in addition to the parameters used for
+ style \code{vgradient} (and \code{plain}).
+ \end{flushleft}
+
+ \item[\present{Style: \code{doublehgradient}}]
+ \indexmacroopt{backgroundstyle}{doublehgradient}%
+ Double horizontal gradient. The page background is constructed using the
+ \macroname{dblhgradrule}\indexmacro{dblhgradrule} command. See the description of
+ \macroname{vgradient} concerning panels.
+
+ Parameters used: See list for \code{doublevgradient}.
+
+ \end{description}
+ Now, a list of all parameters and their meaning. In the following,
+ \begin{itemize}\setlength{\itemsep}{0cm}
+ \item[\carg{n}] denotes a (calc expression for a) nonnegative integer
+ \item[\carg{i}] denotes a (calc expression for an) integer
+ \item[\carg{r}] denotes a fixed-point number
+ \item[\carg{l}] denotes a (calc expression for a) length
+ \item[\carg{c}] denotes the name of a defined color
+ \item[\carg{cm}] denotes a valid color model name (in the sense of the color
+ package)
+ \item[\carg{cd}] denotes a valid color definition (in the sense of the color
+ package) wrt a given \carg{cm} parameter
+ \item[\carg{t}] denotes a `truth value' in the sense of the ifthen package:
+ either true or false. As usual for keyval, if =\carg{t} is omitted, the
+ default true is assumed.
+ \end{itemize}
+ \begin{description}
+ \item[\present{Option: \code{stripes=}\carg{n}}] Set the \carg{stripes}
+ parameter of gradient rules to \carg{n}.\\
+ Default: \macroname{bgndstripes}. \\
+ Used by: \code{vgradient}, \code{hgradient}, \code{doublevgradient},
+ \code{doublehgradient}.
+
+ \item[\present{Option: \code{gradmidpoint=}\carg{r}}] Set the \carg{midpoint}
+ parameter of double gradient rules to \carg{r}.\\
+ Default: \macroname{bgndgradmidpoint}\\
+ Used by: doublevgradient, doublehgradient
+
+ \item[\present{Option: \code{firstgradprogression=}\carg{i}}]
+ Set the first gradient progression of gradient rules to \carg{i}.\\
+ Default: \macroname{bgndfirstgradprogression}\\
+ Used by: vgradient, hgradient, doublevgradient, doublehgradient
+
+ \item[\present{Option: \code{secondgradprogression=}\carg{i}}]
+ Set the second gradient progression of double gradient rules to \carg{i}.\\
+ Default: \macroname{bgndsecondgradprogression}\\
+ Used by: doublevgradient, doublehgradient
+
+ \item[\present{Option: \code{startcolor=}\carg{c}}]
+ Set the \carg{startcolor} parameter of gradient rules to \carg{c}.\\
+ Default: If neither startcolor nor startcolordef is given, the color
+ bgndstartcolor is used as startcolor.\\
+ Used by: vgradient, hgradient, doublevgradient, doublehgradient\\
+ Overwrites: startcolordef
+
+ \item[\present{Option: \code{startcolordef=\{\carg{cm}\}\{\carg{cd}\}}}]
+ Set the \carg{startcolor} parameter of gradient rules to color foo, which
+ is obtained by \macroname{definecolor\{foo\}\{\carg{cm}\}\{\carg{cd}\}}.
+ Note that the two pairs of curly braces are mandatory.\\
+ Default: If neither startcolor nor startcolordef is given, the color
+ bgndstartcolor is used as startcolor.\\
+ Used by: vgradient, hgradient, doublevgradient, doublehgradient\\
+ Overwrites: startcolor
+
+ \item[\present{Option: \code{endcolor=}\carg{c}}]
+ Set the \carg{endcolor} parameter of gradient rules to \carg{c}.\\
+ Default: If neither endcolor nor endcolordef is given, the color
+ bgndendcolor is used as endcolor.\\
+ Used by: vgradient, hgradient, doublevgradient, doublehgradient\\
+ Overwrites: endcolordef
+
+ \item[\present{Option: \code{endcolordef=\{\carg{cm}\}\{\carg{cd}\}}}]
+ Set the \carg{endcolor} parameter of gradient rules to color foo, which
+ is obtained by \macroname{definecolor\{foo\}\{\carg{cm}\}\{\carg{cd}\}}.
+ Note that the two pairs of curly braces are mandatory.\\
+ Default: If neither endcolor nor endcolordef is given, the color
+ bgndendcolor is used as endcolor.\\
+ Used by: vgradient, hgradient, doublevgradient, doublehgradient\\
+ Overwrites: endcolor
+
+ \item[\present{Option: \code{midcolor=}\carg{c}}]
+ Set the \carg{midcolor} parameter of double gradient rules to \carg{c}.\\
+ Default: If neither midcolor nor midcolordef is given, the color
+ bgndmidcolor is used as midcolor.\\
+ Used by: doublevgradient, doublehgradient\\
+ Overwrites: midcolordef
+
+ \item[\present{Option: \code{midcolordef=\{\carg{cm}\}\{\carg{cd}\}}}]
+ Set the \carg{midcolor} parameter of double gradient rules to color foo,
+ which is obtained by \macroname{definecolor\{foo\}\{\carg{cm}\}\{\carg{cd}\}}.
+ Note that the two pairs of curly braces are mandatory.\\
+ Default: If neither midcolor nor midcolordef is given, the color
+ bgndmidcolor is used as midcolor.\\
+ Used by: doublevgradient, doublehgradient\\
+ Overwrites: midcolor
+
+ \item[\present{Option: \code{hpanels=}\carg{t}}]
+ Specifies the `direction' of panels produced. hpanels=true means the top
+ and bottom panel span the full width of the screen. In the space left in
+ the middle, the left panel, the background itself, and the right panel are
+ displayed. hpanels=false means the left and right panel span the full
+ height of the screen. In the space left in the middle, the top panel,
+ the background itself, and the bottom panel are
+ displayed.\\
+ Default: hpanels=true is the default for plain, hgradient and
+ doublehgradient. hpanels=false is the default for vgradient and
+ doublevgradient.\\
+ Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient
+
+ \item[\present{Option: \code{autopanels=}\carg{t}}]
+ Specifies whether the default values of the parameters toppanelheight,
+ bottompanelheight, leftpanelwidth, rightpanelwidth should be calculated
+ automatically from the contents of declared panels. The automatism used
+ is analogous to that of \macroname{DeclarePanel*}. Note that for panel
+ arrangement, both the width and the height of all declared panels are
+ overwritten. If you don't want this, calculate the panel parameters
+ yourself and set autopanels=false. In this case, the current panel
+ dimensions of declared panels are used as defaults for toppanelheight,
+ bottompanelheight, leftpanelwidth, rightpanelwidth.\\
+ Default: true.\\
+ Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient
+
+ \item[\present{Option: \code{\carg{pos}panelheight=}\carg{l}}]
+ Set the height/width of the space left for the top / bottom / left / right
+ panel to \carg{l}. Note that the remaining dimensions of panels, for
+ instance the width of the top panel, are always calculated automatically,
+ depending on the setting of the hpanels parameter.\\
+ Default: If a respective panel has been defined using
+ \macroname{DeclarePanel}, the default used depends on the setting of the
+ autopanels parameter. If autopanels=true, the correct dimension is
+ calculated from the contents of the panel. The respective one of
+ \macroname{toppanelheight}, \macroname{bottompanelheight},
+ \macroname{leftpanelwidth}, \macroname{rightpanelwidth} is overwritten
+ with the result. If autopanels=false, then the respective setting of
+ \macroname{toppanelheight}, \macroname{bottompanelheight},
+ \macroname{leftpanelwidth}, \macroname{rightpanelwidth} is taken as the
+ default. If a panel has not been declared, the appropriate one of
+ \macroname{bgndtoppanelheight}, \macroname{bgndbottompanelheight},
+ \macroname{bgndleftpanelwidth}, \macroname{bgndrightpanelwidth} is used
+ as default. \\
+ Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient
+
+ \item[\present{Option: \code{\carg{pos}panelcolor=}\carg{c}}]
+ Set the color of the space left for the top / bottom / left / right panel
+ to \carg{c}.\\
+ Default: The standard colors toppanelcolor, bottompanelcolor, leftpanelcolor,
+ rightpanelcolor are used as defaults.\\
+ Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient\\
+ Overwrites: toppanelcolordef bottompanelcolordef leftpanelcolordef
+ rightpanelcolordef
+
+ \item[\present{Option: \code{\carg{pos}panelcolordef=\{\carg{cm}\}\{\carg{cd}\}}}]
+ Set the color of the space left for the top / bottom / left / right panel
+ to color foo, which is obtained by
+ \macroname{definecolor\{foo\}\{\carg{cm}\}\{\carg{cd}\}}.
+ Note that the two pairs of curly braces are mandatory. \\
+ Default: See the description of top/bottom/left/rightpanelcolor.\\
+ Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient\\
+ Overwrites: toppanelcolor bottompanelcolor leftpanelcolor rightpanelcolor
+
+ \end{description}
+
+ \newslide
+
+ \subsection{Panel-specific user level commands}
+ If you're using a package that has it own panel (as
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfscreen.html}%
+ {\code{pdfscreen}}) don't even consider using the following.
+
+ \present{\commandapp[\carg{name}]{DeclarePanel}{\carg{pos}\}\{\carg{contents}}}
+ \indexmacro{DeclarePanel}
+ declares the contents \carg{contents} of the panel at position \carg{pos}.
+ Afterwards, on every page the panel contents are set in a parbox of
+ dimensions and position specified by \carg{pos}panelwidth,
+ \carg{pos}panelheight, \macroname{panelmargin} and \carg{pos}panelshift for
+ top and bottom panels and \carg{pos}panelraise for left and right panels. The
+ parbox is constructed anew on every page, so all changes influencing panel
+ contents or parameters (like a \macroname{thepage} in the panel contents) are
+ respected.
+
+ The panel contents are set in color \carg{pos}paneltextcolor. There is
+ another standard color \carg{pos}panelcolor, which is however not activated by
+ \macroname{DeclarePanel} but by selecting an appropriate background style.
+
+ Note that \macroname{backgroundstyle} must be called after the panel
+ declaration.
+
+ \newslide
+
+ Pages are constructed as follows: first the page background, then
+ the panels, and then the page contents. \emph{Hence, panels overwrite the background
+ and the page contents overwrite the panels.} The user is supposed to make sure
+ themselves that there is enough space left on the page for the panels
+ (document class specific settings). The panel declaration is global. A panel
+ can be `undeclared' by using \macroname{DeclarePanel\{\carg{pos}\}\{\}}.
+
+ If the optional argument \carg{name} is given, the panel contents and
+ (calculated) size will also be stored under the given name, to be restored
+ later with \macroname{restorepanels}. This is nice for switching between
+ different sets of panels.
+
+ \newslide
+
+ For an example look at the files \code{simplepanel.tex} and \code{panelexample.tex}.
+ A very simple example follows:
+
+ \begin{verbatim}
+\DeclarePanel{left}{%
+ \textsf{Your Name}
+
+ \vfill
+
+ \button{\Acrobatmenu{PrevPage}}{Back}
+ \button{\Acrobatmenu{NextPage}}{Next} }
+\end{verbatim}
+
+ \newslide
+
+ There is a starred version which will (try to) automatically calculate the
+ \indexmacro{DeclarePanel*} `flexible' dimension of each panel. For top and
+ bottom panels this is the height, for left and right panels this is the width.
+ Make sure the panel contents are `valid' at the time \macroname{DeclarePanel*}
+ is called so the calculation can be carried out in a meaningful way.
+
+ While the automatic calculation of the height of top and bottom panels is
+ trivial (using \macroname{settoheight}), there is a sophisticated procedure
+ for calculating a `good' width for the parbox containing the panel. Owing to
+ limitations set by TeX, there are certain limits to the sophistication of the
+ procedure.
+
+ \newslide
+
+ For instance, any `whatsits' (specials (like color changes), file
+ accesses (like \macroname{label}), or hyper anchors)
+ or rules which are inserted directly in the vertical list of the parbox
+ `block' the analysis, so the procedure can't `see' past them (starting at the
+ bottom of the box) when analysing the contents of the parbox.
+
+ The user should make sure such items are set in horizontal mode (by using
+ \macroname{leavevmode} or enclosing stuff in boxes). Furthermore, only
+ overfull and underfull hboxes which occur while setting the parbox are
+ considered when judging which width is `best'. This will reliably make the
+ width large enough to contain `wide' objects like tabulars, logos and buttons,
+ but might not give optimal results for justified text. vboxes occurring
+ directly in the vbox are ignored.
+
+ \newslide
+
+ Note further that hboxes with fixed width
+ (made by \macroname{hbox} to...) which occur directly in the vbox may disturb
+ the procedure, because the fixed width cannot be recovered. These hboxes will
+ be reformatted with the width of the vbox, generating an extremely large
+ badness, unsettling the calculation of maximum badness. To avoid this such
+ hboxes should be either contained in a vbox or set in horizontal mode with
+ appropriate glue at the end.
+
+ \newslide
+
+ \subsection{Navigation buttons}
+ The following provides only the very basics for navigation buttons. If you're
+ using a package that has it's own naviagtion buttons (as
+ \href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfscreen.html}%
+ {\code{pdfscreen}}) don't even consider using the following.
+
+ \present{\macroname{button\{\carg{navcommand}\}\{\carg{text}\}}}
+ \indexmacro{button}
+ creates a button labelled \carg{text} which executes \carg{navcommand} when
+ pressed. The command takes four optional arguments (left out above):
+ \carg{width}, \carg{height}, \carg{depth} and \carg{alignment} in that order.
+ \carg{navcommand} can be for instance \commandapp{Acrobatmenu}{\carg{command}} or
+ \commandapp{hyperlink}{\carg{target}} (note that \carg{navcommand} should take
+ one (more) argument specifying the sensitive area which is provided by
+ \macroname{button}). If given, the optional parameters \carg{width}, \carg{height}, and
+ \carg{depth} give the width, height and depth, respectively, of the framed
+ area comprising the button (excluding the shadow, but including the
+ frame). Default are the `real' width, height and depth, respectively, of
+ \carg{text}, plus allowance for the frame. If given, the optional parameter
+ \carg{alignment} (one of l,c,r) gives the alignment of \carg{text} inside the
+ button box (makes sense only if \carg{width} is given).
+
+ The button appearence is defined by some configurable button parameters:
+ \begin{description}
+ \item[\present{\macroname{buttonsep}}]
+ \indexmacro{buttonsep}
+ Space between button label and border. (Default: \macroname{fboxsep})
+
+ \item[\present{\macroname{buttonrule}}]
+ \indexmacro{buttonrule}
+ Width of button frame. (Default: \code{0pt})
+
+ \item[\present{\macroname{buttonshadowhshift}}]
+ \indexmacro{buttonshadowhshift}
+ Horizontal displacement of button shadow. (Default: 0.3\macroname{fboxsep})
+
+ \item[\present{\macroname{buttonshadowvshift}}]
+ \indexmacro{buttonshadowvshift}
+ Vertical displacement of button shadow. (Default: 0.3\macroname{fboxsep})
+ \end{description}
+
+ A list of predefined buttons follows:
+ \begin{description}
+
+ \item[\present{\macroname{backpagebutton[\carg{width}]}}]
+ \indexmacro{backpagebutton}
+ Last subpage of previous page.
+
+ \item[\present{\macroname{backstepbutton[\carg{width}]}}]
+ \indexmacro{backstepbutton}
+ Previous step.
+
+ \item[\present{\macroname{gobackbutton[\carg{width}]}}]
+ \indexmacro{gobackbutton}
+ `Undo action' (go back to whatever was before last action).
+
+ \item[\present{\macroname{nextstepbutton[\carg{width}]}}]
+ \indexmacro{nextstepbutton}
+ Next step.
+
+ \item[\present{\macroname{nextpagebutton[\carg{width}]}}]
+ \indexmacro{nextpagebutton}
+ First subpage of next page.
+
+ \item[\present{\macroname{nextfullpagebutton[\carg{width}]}}]
+ \indexmacro{nextfullpagebutton}
+ Last subpage of next page.
+
+ \item[\present{\macroname{fullscreenbutton[\carg{width}]}}]
+ \indexmacro{fullscreenbutton}
+ Toggle fullscreen mode.
+
+ \end{description}
+
+\clearpage
+\printindex
+%KEEPCOMMENTS
+%</docu>
+%=================================================================================================================
+%<*bckwrdexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: bckwrdexample.tex
+%
+% Backwards writing example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 bckwrdexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill bckwrdexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 26, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+% v0.0.3 May 18, 2000: New file name to avoid confusion with ``background''.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Set background color to black and use slifonts.
+
+\PassOptionsToPackage{blackbackground}{texpower}
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower backwards writing example}}
+
+% Define \includegraphics for including an mps (metapost postscript) image.
+\usepackage{graphicx}
+% The mps extension isn't supported out-of-the-box for latex+dvips
+\ifthenelse{\boolean{psspecialsallowed}}{%
+\DeclareGraphicsExtensions{.mps}}{}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</bckwrdexample>
+%<*bckwrdexample-src>
+%<<KEEPCOMMENTS
+
+ %-----------------------------------------------------------------------------------------------------------------
+ %
+ \makeslidetitle{\macroname{stepwise} Example: Writing Backwards}\label{Sec:ExBackwards}
+ %
+ % The following example doesn't really demonstrate a useful application. Its purpose is twofold:
+ % a) Show how the functionality of \stepwise can be extended by the user by referring to the macros provided by the
+ % package.
+ % b) Show that \steps can appear in any order, and can be made to appear simultaneously in several places (and mention
+ % the problems this raises).
+
+ % We define a new macro \backstep which will call \step, but the steps will be executed in _reverse_ order.
+ % This is achieved as follows:
+ % * We refer to the counter totalsteps, which gives the total number of steps occurring in this argument of
+ % \stepwise.
+ % * From this, we subtract the value of the counter stepcommand, which gives the number of this \step command (in the
+ % order of appearance).
+ % * The result is compared with the counter step, which gives the number of the current step.
+ % (the default for `triggering' a \step is the condition \value{step}=\value{stepcommand})
+ %
+ % Note that if the ifthen Package would support this syntax, we could use the bracketed optional argument of \step (as
+ % in the previous example), defining \backstep like this:
+ %
+ % \newcommand{\backstep}{\step[\value{totalsteps}-\value{stepcommand}+1=\value{step}]}
+ %
+ % As \ifthenelse doesn't offer this syntax, we have to calculate \value{totalsteps}-\value{stepcommand}+1 in a separate
+ % counter. This doesn't fit the intended use of \step's optional argument. But hey, there is another syntax ;-)
+ % If the optional argument is specified with braces (...), then it can contain an arbitrary test which takes two
+ % arguments and selects the first if it succeeds and the second if it fails. We use this variant here.
+ %
+ \newcounter{reversestepno}%
+ \newcommand{\backstep}{\step(\setcounter{reversestepno}{\value{totalsteps}-\value{stepcommand}+1}\ifthenelse{\value{step}=\value{reversestepno}})}%
+ %
+ % We use the custom command \parstepwise which not only wraps the whole argument of \stepwise into a minipage (because
+ % otherwise vertical spacing goes haywire, don't ask me why), but also gives substance to steps.
+ %
+ % If the following \stepwise command would only contain the calls to \backstep, everything would be fine.
+ % But we _had_ to add something else....
+ % In the second part of this application of \stepwise, several steps are executed simultaneously with those executed
+ % backwards in the first part. This means the value of the counter totalsteps is 14, i.e. the calls to \backstep
+ % correspond to steps 8...14. To remedy this, we decree that the first step performed shall be number 7, by setting
+ % the counter firststep accordingly in the optional argument of \stepwise.
+ %
+ \parstepwise[\setcounter{firststep}{\value{totalsteps}/2+\value{firststep}}]
+ {%
+ \begin{quote}
+ \Huge
+ \backstep{Is} \backstep{now} \backstep{it}
+ \backstep{backwards} \backstep{write} \backstep{to}
+ \backstep{possible\,!}
+
+ \bigskip
+
+ % By determining explicitly the times at which the following steps are executed, we make them appear
+ % simultaneously with the preceding flock of \backsteps. As we have set the counter firststep to 7, we start
+ % counting with 8.
+ %
+ \step[\value{step}=8]{\includegraphics[width=2cm]{fig-1}}
+ \step[\value{step}=9]{\includegraphics[width=2cm]{fig-1}}
+ \step[\value{step}=10]{\includegraphics[width=2cm]{fig-1}}
+ \step[\value{step}=11]{\includegraphics[width=2cm]{fig-1}}
+ \step[\value{step}=12]{\includegraphics[width=2cm]{fig-1}}
+ \step[\value{step}=13]{\includegraphics[width=2cm]{fig-1}}
+ \step[\value{step}=14]{\includegraphics[width=2cm]{fig-1}}%
+ \end{quote}
+ }%
+ \newslide
+%KEEPCOMMENTS
+%</bckwrdexample-src>
+%=================================================================================================================
+%<*bgndexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: bgndexample.tex
+%
+% Background style example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be converted to pdf afterwards (using dvips+distill/ps2pdf or dvipdf, for instance).
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Aug 10, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 29, 2003: Adapted to TeXPower v0.0.9c.
+%
+%COMMENT
+%-----------------------------------------------------------------------------------------------------------------
+% Use slifonts and a dark background.
+
+\PassOptionsToPackage{darkbackground,colorhighlight,verbose}{texpower}
+
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower background style example}}
+
+\newcommand{\skipTo}[1]{\hyperlink{#1}{\present{\textsf{\textbf{Skip animation}}}}}
+
+\makeatletter
+\newcommand{\histogram}[1]
+{{%
+ \renewcommand{\vstripe@TP}[4]
+ {\rule{##2-2pt}{(##3)*\real{##1}}\hspace*{2pt}##4}%
+ #1%
+ }}
+\makeatother
+
+\newcommand{\totalbarwidth}{2cm}
+
+\newcommand{\mkbar}[2][100]
+{%
+ \ifthenelse{#1<#2}{\def\percentval{#1}}{\def\percentval{#2}}%
+ \mkfactor{\intensity}{\percentval/100}%
+ \colorbetween[\intensity]{ecolor}{green}{red}%
+ \hgradrule[\percentval]{red}{ecolor}{\totalbarwidth*\real{\intensity}}{1ex}
+ \textbf{\boldmath$\mathsf{\ifthenelse{\percentval<10}{\phantom{0}}{}\percentval\%}$}%
+ }
+
+\renewcommand{\bgndstripes}{100}
+
+\setlength{\fboxrule}{1pt}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</bgndexample>
+%<*bgndexample-src>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Aug 12, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 29, 2003: Adapted to TeXPower v0.0.9c.
+%
+%-----------------------------------------------------------------------------------------------------------------
+%
+
+
+\centerslidestrue
+\title{The \TeX Power bundle\\[2ex]{\normalfont Structured
+ rules, box and page backgrounds}}
+\author{Stephan Lehmke\\\url{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+\begin{small}
+ This example demonstrates \TeX Power's support for structured rules,
+ box and page backgrounds. The usage and parameterization of the
+ corresponding commands is documented in the manual. Here, we only
+ demonstrate the effects achievable with the parameters.
+\end{small}
+
+\pageDuration{0.01}
+
+\parstepwise*%
+{%
+ \multistep
+ {50}
+ {%
+ \mkfactor{\intensity}{(\value{substep}-1)/49}%
+ \colorbetween[\intensity]{stcolor}{pagecolor}{white}%
+ \backgroundstyle[startcolor=stcolor,endcolor=white]{vgradient}%
+ }%
+ \multistep
+ {3}
+ {%
+ \afterstep{\pageDuration{1}}%
+ \backgroundstyle[startcolor=pagecolor,endcolor=white,firstgradprogression=\value{substep}]{vgradient}%
+ }%
+ \multistep
+ {10}
+ {%
+ \afterstep{\pageDuration{0.01}}%
+ \mkfactor{\intensity}{(\value{substep}-1)/40}%
+ \colorbetween[\intensity]{ecolor}{pagecolor}{white}%
+ \backgroundstyle[startcolor=pagecolor,endcolor=ecolor,firstgradprogression=3]{vgradient}%
+ }%
+ \skipTo{eotitle}
+}
+
+\hypertarget{eotitle}{}
+
+\stopAdvancing
+
+\newslide
+
+\renewcommand{\rulestripes}{100}
+
+\newcounter{mstep}
+
+\section{Color Gradients}
+\liststepwise[\let\hidestepcontents=\hidesmartignore]
+{%
+ \concept{Horizontal} \step{or \concept{vertical}; \concept{single}} \step{or \concept{double}.}
+
+ \step
+ {%
+ Parameters:
+ \begin{itemize}
+ \item Gradient \concept{start} {\bstep[\value{step}=13]{(and
+ \concept{middle})}} and \concept{end} color.
+
+ \step[\value{step}=23]{\item Number of \concept{stripes}.}
+
+ \step[\value{step}=33]{\item \concept{Midpoint} of a double
+ gradient.}
+
+ \step[\value{step}=43]{\item Gradient \concept{Progression}}
+ \step[\value{step}=56]{\par(independent for double gradients).}
+ \end{itemize}
+ }
+ \vfill
+ \steponce[\value{step}=0]{\hgradrule{red}{green}{\linewidth}{5ex}}%
+ \steponce[\value{step}=1]{\vgradrule{red}{green}{\linewidth}{5ex}}%
+ \steponce[\value{step}=2]{\dblvgradrule{red}{yellow}{green}{\linewidth}{5ex}}%
+ \steponce[\value{step}>2\and\value{step}<13]
+ {%
+ \skipTo{eostartend}\\
+ \multistep(\setcounter{mstep}{\value{substep}+2}\ifthenelse{\value{step}=\value{mstep}}){10}
+ {%
+ \mkfactor{\intensity}{(\value{substep}-1)/9}%
+ \colorbetween[\intensity]{scolor}{blue}{red}%
+ \colorbetween[\intensity]{ecolor}{yellow}{green}%
+ \hgradrule{scolor}{ecolor}{\linewidth}{5ex}%
+ \ifthenelse{\value{substep}=10}
+ {\hypertarget{eostartend}{}\afterstep{\stopAdvancing}}
+ {\afterstep{\pageDuration{0.01}}}%
+ }%
+ }%
+ \steponce[\value{step}>12\and\value{step}<23]
+ {%
+ \skipTo{eomidcolor}\\
+ \multistep(\setcounter{mstep}{\value{substep}+12}\ifthenelse{\value{step}=\value{mstep}}){10}
+ {%
+ \colorbetween{scolor}{blue}{yellow}%
+ \mkfactor{\intensity}{(\value{substep}-1)/9}%
+ \colorbetween[\intensity]{ecolor}{red}{scolor}%
+ \dblhgradrule{blue}{ecolor}{yellow}{\linewidth}{5ex}%
+ \ifthenelse{\value{substep}=10}
+ {\hypertarget{eomidcolor}{}\afterstep{\stopAdvancing}}
+ {\afterstep{\pageDuration{0.01}}}%
+ }%
+ }%
+ \steponce[\value{step}>22\and\value{step}<33]
+ {%
+ \skipTo{eostripes}\\
+ \multistep(\setcounter{mstep}{\value{substep}+22}\ifthenelse{\value{step}=\value{mstep}}){10}
+ {%
+ \histogram{\dblhgradrule[][10*\value{substep}]{red}{yellow}{green}{\linewidth}{2.5ex}}\\%
+ \dblhgradrule[][10*\value{substep}]{red}{yellow}{green}{\linewidth}{2.5ex}%
+ \ifthenelse{\value{substep}=10}
+ {\hypertarget{eostripes}{}\afterstep{\stopAdvancing}}
+ {\afterstep{\pageDuration{0.5}}}%
+ }%
+ }%
+ \steponce[\value{step}>32\and\value{step}<43]
+ {%
+ \skipTo{eomidpoint}\\
+ \multistep(\setcounter{mstep}{\value{substep}+32}\ifthenelse{\value{step}=\value{mstep}}){10}
+ {%
+ \mkfactor{\midpoint}{(\value{substep}-1)/9}%
+ \histogram{\dblhgradrule[\midpoint]{blue}{red}{yellow}{\linewidth}{2.5ex}}\\%
+ \dblhgradrule[\midpoint]{red}{yellow}{green}{\linewidth}{2.5ex}%
+ \ifthenelse{\value{substep}=10}
+ {\hypertarget{eomidpoint}{}\afterstep{\stopAdvancing}}
+ {\afterstep{\pageDuration{0.5}}}%
+ }%
+ }%
+ \steponce[\value{step}>42\and\value{step}<56]
+ {%
+ \skipTo{eofirstprog}\\
+ \multistep(\setcounter{mstep}{\value{substep}+42}\ifthenelse{\value{step}=\value{mstep}}){13}
+ {%
+ \renewcommand{\rulefirstgradprogression}{\value{substep}-7}%
+ \histogram{\hgradrule{red}{green}{\linewidth}{2.5ex}}\\%
+ \hgradrule{red}{green}{\linewidth}{2.5ex}%
+ \ifthenelse{\value{substep}=13}
+ {\hypertarget{eofirstprog}{}\afterstep{\stopAdvancing}}
+ {\afterstep{\pageDuration{0.5}}}%
+ }%
+ }%
+ \steponce[\value{step}>55\and\value{step}<69]
+ {%
+ \skipTo{eosecondprog}\\
+ \multistep(\setcounter{mstep}{\value{substep}+55}\ifthenelse{\value{step}=\value{mstep}}){13}
+ {%
+ \renewcommand{\rulefirstgradprogression}{\value{substep}-7}%
+ \renewcommand{\rulesecondgradprogression}{7-\value{substep}}%
+ \histogram{\dblhgradrule{red}{green}{red}{\linewidth}{2.5ex}}\\%
+ \dblhgradrule{red}{green}{red}{\linewidth}{2.5ex}%
+ \ifthenelse{\value{substep}=13}
+ {\hypertarget{eosecondprog}{}\afterstep{\stopAdvancing}}
+ {\afterstep{\pageDuration{0.5}}}%
+ }%
+ }%
+}
+
+\newslide
+
+Applications of gradients:
+\centerslidesfalse
+\liststepwise*
+{%
+ \begin{itemize}
+ \item
+ \begin{tabular}[t]{@{}l@{}}
+ As rules:\\
+ \skipTo{eoruledemo}
+ \end{tabular}
+ \multistep{72}
+ {%
+ \present
+ {%
+ \small\renewcommand{\arraystretch}{.9}%
+ \begin{tabular}{rp{\totalbarwidth+2em}}
+ \multicolumn{2}{c}{\textbf{Compression rates}}\\[2ex]
+ \code{compress} & \mkbar[\thesubstep]{51}\\
+ \code{gzip -1} & \mkbar[\thesubstep]{62}\\
+ \code{gzip -9} & \mkbar[\thesubstep]{66}\\
+ \code{bzip2 -1} & \mkbar[\thesubstep]{65}\\
+ \code{bzip2 -9} & \mkbar[\thesubstep]{73}
+ \end{tabular}%
+ }%
+ \afterstep{\pageDuration{0.01}}%
+ }%
+ \step
+ {%
+ \present
+ {%
+ \small\renewcommand{\arraystretch}{.9}%
+ \begin{tabular}{rp{\totalbarwidth+2em}}
+ \multicolumn{2}{c}{\textbf{Compression rates}}\\[2ex]
+ \code{compress} & \mkbar{51}\\
+ \code{gzip -1} & \mkbar{62}\\
+ \code{gzip -9} & \mkbar{66}\\
+ \code{bzip2 -1} & \mkbar{65}\\
+ \code{bzip2 -9} & \mkbar{73}
+ \end{tabular}%
+ }%
+ \ifthenelse{\boolean{firstactivation}}{\AtShipout{\hypertarget{eoruledemo}{}}\afterstep{\stopAdvancing}}{}%
+ }%
+
+ \step
+ {%
+ \item
+ \begin{tabular}[t]{@{}l@{}}
+ As box backgrounds:\\
+ \skipTo{eoboxdemo}
+ \end{tabular}
+ \afterstep{\pageDuration{0.01}}%
+ \multistep{10}
+ {%
+ \mkfactor{\intensity}{(\value{substep}-1)/9}%
+ \colorbetween[\intensity]{ecolor}{green}{blue}%
+ \colorbetween[\intensity]{scolor}{yellow}{green}%
+ \colorbetween{mcolor}{scolor}{ecolor}%
+ \complementcolor{tcolor}{mcolor}%
+ \raisebox{-.5\height}{\hgradbox{scolor}{ecolor}{\Huge\textsf{\textbf{\mbox{{\textcolor{tcolor}{Groovy!}}}}}}}%
+ }%
+ \multistep{10}
+ {%
+ \mkfactor{\intensity}{(\value{substep}-1)/9}%
+ \colorbetween[\intensity]{ecolor}{yellow}{green}%
+ \colorbetween[\intensity]{scolor}{red}{yellow}%
+ \colorbetween{mcolor}{scolor}{ecolor}%
+ \complementcolor{tcolor}{mcolor}%
+ \raisebox{-.5\height}{\hgradbox{scolor}{ecolor}{\Huge\textsf{\textbf{\textcolor{tcolor}{Groovy!}}}}}%
+ }%
+ \multistep{10}
+ {%
+ \mkfactor{\intensity}{(\value{substep}-1)/9}%
+ \colorbetween[\intensity]{ecolor}{red}{yellow}%
+ \colorbetween[\intensity]{scolor}{blue}{red}%
+ \colorbetween{mcolor}{scolor}{ecolor}%
+ \complementcolor{tcolor}{mcolor}%
+ \raisebox{-.5\height}{\hgradbox{scolor}{ecolor}{\Huge\textsf{\textbf{\textcolor{tcolor}{Groovy!}}}}}%
+ }%
+ \multistep{10}
+ {%
+ \mkfactor{\intensity}{(\value{substep}-1)/9}%
+ \colorbetween[\intensity]{ecolor}{blue}{red}%
+ \colorbetween[\intensity]{scolor}{green}{blue}%
+ \colorbetween{mcolor}{scolor}{ecolor}%
+ \complementcolor{tcolor}{mcolor}%
+ \raisebox{-.5\height}{\hgradbox{scolor}{ecolor}{\Huge\textsf{\textbf{\textcolor{tcolor}{Groovy!}}}}}%
+ }%
+ \step
+ {%
+ \colorbetween{mcolor}{green}{blue}%
+ \complementcolor{tcolor}{mcolor}%
+ \raisebox{-.5\height}{\hgradbox{green}{blue}{\Huge\textsf{\textbf{\textcolor{tcolor}{Groovy!}}}}}%
+ \ifthenelse{\boolean{firstactivation}}{\AtShipout{\hypertarget{eoboxdemo}{}}\afterstep{\stopAdvancing}}{}%
+ }%
+ }
+
+ \step
+ {%
+ \item As page backgrounds. \skipTo{eobgnddemo}
+ \colorbetween[.22]{ecolor}{pagecolor}{white}%
+ \afterstep{\pageDuration{0.01}}%
+ \multistep{20}
+ {%
+ \backgroundstyle
+ [%
+ startcolor=pagecolor,endcolor=ecolor,firstgradprogression=3,
+ rightpanelwidth=\TPpagewidth*\real{.025}*\value{substep},rightpanelcolor=pagecolor,
+ leftpanelwidth=\TPpagewidth*\real{.025}*\value{substep},leftpanelcolor=pagecolor,
+ toppanelheight=\TPpageheight*\real{.025}*\value{substep},toppanelcolor=pagecolor,
+ bottompanelheight=\TPpageheight*\real{.025}*\value{substep},bottompanelcolor=pagecolor%
+ ]{vgradient}%
+ }%
+ \multistep{20}
+ {%
+ \backgroundstyle
+ [%
+ startcolordef={rgb}{0.4,0,0},endcolordef={rgb}{0,0.4,0},firstgradprogression=3,
+ rightpanelwidth=\TPpagewidth*\real{.025}*(20-\value{substep}),rightpanelcolor=pagecolor,
+ leftpanelwidth=\TPpagewidth*\real{.025}*(20-\value{substep}),leftpanelcolor=pagecolor,
+ toppanelheight=\TPpageheight*\real{.025}*(20-\value{substep}),toppanelcolor=pagecolor,
+ bottompanelheight=\TPpageheight*\real{.025}*(20-\value{substep}),bottompanelcolor=pagecolor%
+ ]{vgradient}%
+ }%
+ }
+ \end{itemize}
+ }
+\hypertarget{eobgnddemo}{}
+\end{slide}
+
+
+
+\begin{slide}[\slidewidth-40mm,\slideheight-40mm]
+\renewcommand{\sliderightmargin}{45mm}%
+\renewcommand{\slidetopmargin}{25mm}%
+\renewcommand{\slidebottommargin}{25mm}%
+\colorbetween[.22]{ecolor}{pagecolor}{white}%
+\backgroundstyle[startcolor=pagecolor,endcolor=ecolor,firstgradprogression=3]{vgradient}%
+
+\liststepwise
+{%
+ Special parameters for page backgrounds:
+ \begin{itemize}
+ \item Leave space for panels, headers and footers.\\
+ \skipTo{eopaneldemo}
+ \afterstep{\pageDuration{0.01}}%
+ \multistep{20}
+ {%
+ \backgroundstyle
+ [%
+ startcolor=pagecolor,endcolor=ecolor,firstgradprogression=3,
+ toppanelheight=.1\semcm*\value{substep},toppanelcolor=black,
+ bottompanelheight=.1\semcm*\value{substep}%
+ ]{vgradient}%
+ }%
+ \multistep{20}
+ {%
+ \backgroundstyle
+ [%
+ startcolor=pagecolor,endcolor=ecolor,firstgradprogression=3,
+ rightpanelwidth=.2\semcm*\value{substep},rightpanelcolordef={rgb}{0,0.4,0.6},
+ toppanelheight=2\semcm,toppanelcolor=black,
+ bottompanelheight=2\semcm%
+ ]{vgradient}%
+ }%
+ \end{itemize}
+}
+
+\hypertarget{eopaneldemo}{}
+%KEEPCOMMENTS
+%</bgndexample-src>
+%=================================================================================================================
+%<*divexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: divexample.tex
+%
+% Divisibility example (demonstrating \step's optional arguments) for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 divexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill divexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 26, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+% v0.0.3 May 18, 2000: New file name.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+% We input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower divisibility example}}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+ % As the sectioning in the example files starts with \subsection, we `grade down' the sectioning commands.
+ \let\subsubsection\subsection
+ \let\subsection\section
+%KEEPCOMMENTS
+%</divexample>
+%<*divexample-src>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle{\macroname{stepwise} Example: Fooling Around}\label{Sec:ExFooling}
+% The following example is just to show that a lot of fancy things are possible by appropriately defining the diverse
+% `hooks' offererd by \stepwise.
+`Tweaking' the hooks a little allows some truly bizarre applications\dots
+
+% In the following \stepwise command, \activatestep will be set to \textbf. This means the `first' occurrence of a number
+% is wider (because bf is an extended font) than all other occurrences of it. To avoid glitches in line breaks, all
+% other occurrences of numbers (visible and invisible) need to be of the same width. Hence we define new versions of
+% \displaystepcontents and \hidestepcontents.
+\def\mydisplay#1{\makebox[\widthof{\textbf{#1}}]{#1}}
+\def\myhide#1{\phantom{\makebox[\widthof{\textbf{#1}}]{#1}}}
+
+\newcounter{modulo}
+\newcounter{i}
+
+% Finally, we define a custom \step command which sets the optional arguments of \step.
+% We already have introduced the first optional argument, which determines when a \step is activated for the first
+% time. Here, this one is left at its default value (\value{step}=\value{stepcommand}).
+% Here, we also use the second optional argument, which has the same syntax as the first one (i.e. it can be surrounded
+% either by square brackets or braces), but determines when a \step is active _at all_ (i.e. whether
+% \displaystepcontents or \hidestepcontents is used). The default is the internal check \if@first@TP@true, which determines
+% whether step number \value{stepcommand} has already been activated for the first time (this is saved internally for
+% every step). Now, we redefine this condition to be fulfilled whenever the value of the counter step is divisible by
+% the value of the counter stepcommand.
+\def\mystep{\step[](\setcounter{modulo}{\value{step}/\value{stepcommand}*\value{stepcommand}}\ifthenelse{\value{step}=\value{modulo}})}%
+
+
+% By setting the page duration to 0.5 seconds, we make the following sequence of slides appear automatically one by one,
+% one every half second.
+
+\pageDuration{0.5}
+
+%
+% We use the custom command \parstepwise which not only wraps the whole argument of \stepwise into a minipage (because
+% otherwise vertical spacing goes haywire, don't ask me why), but also gives substance to steps. We use the starred
+% version of this command so that the number 1 appears on the first slide generated by \parstepwise.
+%
+% \activatestep is set to \textbf to emphasize the number the divisors of which are displayed.
+\parstepwise*[\let\activatestep=\textbf\let\displaystepcontents=\mydisplay\let\hidestepcontents=\myhide]
+{%
+ \huge
+ \setcounter{i}{0}%
+ Divisibility demo:
+
+ % We just have to generate the appropriate number of \mystep commands which display `their' numbers.
+ \whiledo{\value{i}<40}{\stepcounter{i}\mystep{\arabic{i}} }%
+
+ }
+
+% Stop automatic advancing of pages.
+
+\stopAdvancing
+%KEEPCOMMENTS
+%</divexample-src>
+%=================================================================================================================
+%<*fancyexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: fancyexample.tex
+%
+\documentclass[KOMA,letterpaper,landscape,display,calcdimensions]{powersem}
+
+\usepackage{graphicx}
+
+\usepackage{soul}
+
+\usepackage{palatino}
+
+\usepackage[pdfpagemode={FullScreen}]{hyperref}
+\usepackage{fixseminar}
+\usepackage[whitebackground]{texpower}
+
+\slidesmag{5}
+
+\slideframe{none}
+\pagestyle{empty}
+
+\renewcommand{\slideleftmargin}{2cm}
+\renewcommand{\sliderightmargin}{2cm}
+\renewcommand{\slidetopmargin}{2cm}
+\renewcommand{\slidebottommargin}{2cm}
+
+\newcounter{nosteps}
+\setcounter{nosteps}{100}
+\newcounter{mycount}
+
+\makeatletter
+\DeclareRobustCommand*\appearI[1]
+{%
+ \SOUL@setup
+ \def\SOUL@everytoken{\makebox[\widthof{\the\SOUL@token\SOUL@setkern\SOUL@charkern}]{\scalebox{#1}{\the\SOUL@token\SOUL@setkern\SOUL@charkern}}}%
+ \SOUL@%
+ }%
+\DeclareRobustCommand*\appearII[1]
+{%
+ \SOUL@setup
+ \def\SOUL@everytoken{\makebox[\widthof{\the\SOUL@token\SOUL@setkern\SOUL@charkern}*\real{#1}]{\the\SOUL@token\SOUL@setkern\SOUL@charkern}}%
+ \SOUL@%
+ }%
+\DeclareRobustCommand*\appearIII[1]
+{%
+ \SOUL@setup
+ \def\SOUL@everyspace{\rule{.3em}{\fboxrule}}%
+ \def\SOUL@everysyllable{\the\SOUL@syllable\SOUL@setkern\SOUL@charkern\rule{#1}{\fboxrule}}%
+ \SOUL@%
+ }%
+\DeclareRobustCommand*\appearIV[1]
+{%
+ \SOUL@setup
+ \def\SOUL@everytoken{\makebox[\widthof{\the\SOUL@token\SOUL@setkern\SOUL@charkern}+2em-2em*\real{#1}]{\scalebox{#1}{\setcounter{mycount}{\value{nosteps}*4-\value{nosteps}*4*\real{#1}}\rotatebox[origin=c]{\value{mycount}}{\the\SOUL@token\SOUL@setkern\SOUL@charkern}}}}%
+ \SOUL@%
+ }%
+\makeatother
+
+\begin{document}
+\begin{slide}
+ \pageDuration{1}%
+ \stepwise
+ {%
+ \begin{center}
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \makebox[0pt]
+ {\rule{2\textwidth-2\textwidth/\value{nosteps}*\value{substep}}{0pt}`Twas brillig, and the slithy toves}%
+ }
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{\value{substep}/\value{nosteps}}%
+ \scalebox{\mag}{Did gyre and gimble in the wabe:}%
+ }
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{5*(\value{nosteps}-\value{substep})/\value{nosteps}+1pt}%
+ \makebox[0pt]{\scalebox{\mag}[1]{All mimsy were the borogoves,}}%
+ }
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{\value{substep}/\value{nosteps}}%
+ \colorbetween[\mag]{mycolor}{textcolor}{pagecolor}
+ \textcolor{mycolor}{And the mome raths outgrabe.}%
+ }
+
+ \medskip
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{\value{substep}/\value{nosteps}}%
+ \appearI{\mag}{"Beware the Jabberwock, my son!}%
+ }
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{\value{substep}/\value{nosteps}}%
+ \appearII{\mag}{The jaws that bite, the claws that catch!}%
+ }
+
+ \movie{\value{nosteps}}{0.01}[\pageDuration{0.01}]
+ {%
+ \makebox[0pt]{\appearIII{(\thenosteps pt-\thesubstep pt)*\real{1.5}}{Beware the Jubjub bird, and shun}}%
+ }%
+ %
+ \step{\afterstep{\pageDuration{1}}Beware the Jubjub bird, and shun}
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{\value{substep}/\value{nosteps}}%
+ \setcounter{mycount}{2*(\value{nosteps}-\value{substep})}%
+ \strut\rotatebox[origin=c]{\value{mycount}}{\makebox[0pt]{\smash{\scalebox{\mag}{The frumious Bandersnatch!"}}}}%
+ }
+
+ \medskip
+
+ \movie*{\value{nosteps}}{0.01}[\pageDuration{1}]
+ {%
+ \mkfactor{\mag}{\value{substep}/\value{nosteps}}%
+ \hspace*{\fill}%
+ \emph
+ {%
+ \rlap
+ {%
+ \makebox[\widthof{Lewis Carroll}]
+ {\rule{5cm-5cm/\value{nosteps}*\value{substep}}{0pt}\strut\raisebox{1cm-1cm/\value{nosteps}*\value{substep}}[0pt][0pt]{\appearIV{\mag}{Lewis Carroll}}}%
+ }%
+ \rlap
+ {%
+ \makebox[\widthof{Lewis Carroll}]
+ {\strut\raisebox{1.5cm-1.5cm/\value{nosteps}*\value{substep}}[0pt][0pt]{\appearIV{\mag}{Lewis Carroll}}\rule{4cm-4cm/\value{nosteps}*\value{substep}}{0pt}}%
+ }%
+ \rlap
+ {%
+ \makebox[\widthof{Lewis Carroll}]
+ {\rule{3cm-3cm/\value{nosteps}*\value{substep}}{0pt}\strut\raisebox{-.5cm+.5cm/\value{nosteps}*\value{substep}}[0pt][0pt]{\appearIV{\mag}{Lewis Carroll}}}%
+ }%
+ \makebox[\widthof{Lewis Carroll}]
+ {\strut\raisebox{-1cm+1cm/\value{nosteps}*\value{substep}}[0pt][0pt]{\appearIV{\mag}{Lewis Carroll}}\rule{6cm-6cm/\value{nosteps}*\value{substep}}{0pt}}%
+ }%
+ }
+ \end{center}
+ }
+\end{slide}
+\end{document}
+%KEEPCOMMENTS
+%</fancyexample>
+%=================================================================================================================
+%<*foilsdemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: foilsdemo.tex
+%
+% Simple examples the for combining the foils class with the dynamic features provided by the package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 25, 2000: First version for the pre-alpha release of TeXPower.
+%
+
+\documentclass[landscape]{foils}
+
+% foils understands the landscape option, but to get it through to pdflatex, we need to set \pdfpageheight etc. The
+% package fixseminar does this.
+
+\usepackage{fixseminar}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+%
+\usepackage[display]{texpower}
+
+
+\begin{document}
+
+\title{The \code{texpower} Package\\{\normalfont \texttt{foils} Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+
+\foilhead{A list environment}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+
+
+\foilhead{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+
+
+
+\foilhead{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+
+
+
+\foilhead{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.6cm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{document}
+%KEEPCOMMENTS
+%</foilsdemo>
+%=================================================================================================================
+%<*hilitexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: hilitexample.tex
+%
+% Highlighting example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 hilitexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill hilitexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 27, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+% Added demo for \highlighttext.
+% Itemize demo now checks whether color is activated.
+%
+% v0.0.3 May 26, 2000: Added an example for how to make the text in a paragraph `stand out' from the background.
+%
+% v0.0.4 Jun 07, 2000: Now using \hidedimmed and \highlightenhanced.
+%
+% v0.0.5 Jul 19, 2000: stepitemize example rewritten for TeXPower v0.0.8g.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+% Use slifonts.
+
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower highlighting example}}
+
+% The package soul is needed for \highlighttext to work.
+
+\usepackage{soul}
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</hilitexample>
+%<*hilitexample-src>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle{\macroname{stepwise} Example: Highlighting Text}\label{Sec:Exhl}
+% The default for \step's which are not yet `active' is to be `invisible'. In preceding examples, we have redefined
+% internal macros like \hidestepcontents or \activatestep to achieve special `highlighting' effects.
+% Here, we demonstrate how make text `stand out' from the background incrementally without having it appear from thin
+% air.
+
+% The first example demonstrates how to make \step its argument `stand out' instead of making it appear `out of
+% nowhere'.
+
+\makeatletter
+\ifthenelse{\boolean{TPcolor}}% Can we use colors?
+{% Yes. In this case \step should change colors from `dimmed' to `active'.
+
+ % The command \hidedimmed switches colors to `dimmed', the command \highlightenhanced switches colors to `enhanced'.
+ \liststepwise[\let\hidestepcontents=\hidedimmed\let\activatestep=\highlightenhanced]
+ {%
+ \vspace*{\fill}
+ \begin{quote}
+ \Large%
+ \step{Instead of making things appear out of `thin air',} \step{we can also make them appear `out of the
+ background'} \step{by incrementally changing color from \concept{inactive}} \step{to \concept{active}.}
+ \step{This also works with \emph{color emphasis}} \step{and \concept{math coloring}: $a=b^2$.}
+ \end{quote}
+ \vspace*{\fill}\vspace*{\fill}
+ }%
+ }
+{% No. In this case we have to `handwave' using the soul package.
+ % Instead of hiding its argument, the new command \myhide just changes the font size (maintaining the overall text
+ % length though).
+ \def\myhide
+ {%
+ \leavevmode%
+ \SOUL@setup
+ \def\SOUL@everytoken{\makebox[\widthof{\the\SOUL@token}][s]{\rule[\depthof{\the\SOUL@token}*-1]{0pt}{\depthof{\the\SOUL@token}+\heightof{\the\SOUL@token}}\hrulefill\tiny\the\SOUL@token\hrulefill}\SOUL@setkern\SOUL@charkern}%
+ \SOUL@%
+ }
+
+ \liststepwise[\let\hidestepcontents=\myhide\setcounter{firststep}{0}]
+ {%
+ \vspace*{\fill}
+ \begin{quote}
+ \LARGE%
+ \step{Instead of making things appear out of `thin air',} \step{we can also make them appear `out of the
+ background'} \step{incrementally.}
+ \end{quote}
+ \vspace*{\fill}\vspace*{\fill}
+ }%
+ }
+\makeatother
+
+\newslide
+
+% Next, it is demonstrated how we can `flip through' an itemize environment by just highlighting the items in turn
+% instead of making them appear one by one.
+%
+% Define a macro \mystep which implements the highlighting effect.
+\ifthenelse{\boolean{TPcolor}}% Can we use colors?
+{% Yes. In this case highlighting is implemented by switching color.
+ \def\mystep% Note that \mystep takes no argument. It just changes the way the next item is displayed.
+ {%
+ \usecolorset{stwcolors}% Restore the undimmed colors valid at the beginning of \stepwise.
+ \dstep[][\boolean{firstactivation}]% \dstep switches colors. The optional argument makes it appear only once.
+ }%
+}
+{% No. In this case highlighting is implemented by redefining \labelitemi.
+ \def\mystep
+ {%
+ \switch[][\boolean{firstactivation}]% The optional arguments make \switch act only once.
+ {\def\labelitemi{\origmath{\gg}}}{\def\labelitemi{\origmath{\cdot}}}%
+ }%
+ }
+
+% We define a custom itemize environment which automatically adds calls to \mystep:
+\newenvironment{stepitemize}
+{%
+ \huge
+ \begin{itemize}
+ \let\origitem=\item
+ % Here, the \mystep command is hidden inside \item
+ \renewcommand{\item}{\mystep\origitem}%
+ }
+ {%
+ \end{itemize}
+ }
+
+Instead of displaying incrementally, we can just `flip through' some items by highlighting them:
+
+% Note that we use the starred version of \liststepwise so that the first item is highlighted on the first slide
+% produced by \liststepwise.
+%
+\liststepwise*
+{%
+ \begin{stepitemize}
+ \item Item 1
+ \item Item 2
+ \item Item 3
+ \end{stepitemize}
+ }
+
+\pause
+
+% The following example demonstrates highlighting inside a paragraph using \highlighttext. By redefining \activatestep
+% to \highlighttext, the argument of every \step will be highlighted when the \step is activated for the first
+% time. Note that highlighting doesn't influence line breaks because \highlighttext is implemented using the soul
+% package.
+%
+% Again, we define \hidestepcontents to display its argument, so that the complete text is visible from the outset.
+
+\stepwise[\let\activatestep=\highlighttext\let\hidestepcontents=\displayidentical]
+{%
+ \vspace*{\fill}
+ \begin{minipage}{\linewidth}
+ \LARGE
+ \step{Inside} a paragraph, we can \step{highlight} text \step{without influencing} \step{line breaks}.
+ \end{minipage}
+ \vspace*{\fill}
+ }
+\newslide
+%KEEPCOMMENTS
+%</hilitexample-src>
+%=================================================================================================================
+%<*ifmslidemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: ifmslidemo.tex
+%
+% Simple examples the for combining the ifmslide package with the dynamic features provided by the package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 25, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Jul 31, 2000: Slightly updated for ifmslide v0.43.
+%
+
+\documentclass[KOMA,landscape,display]{powersem}
+
+\usepackage[stmo,button]{ifmslide}
+
+\slidepagestyle{sidebar}
+\centerslidesfalse
+
+\hypersetup{linkcolor=red}
+
+\pagestyle{plain}
+
+\panellogo{fig-2}
+
+\renewcommand{\currentpagevalue}{\value{slide}}
+
+\begin{document}
+
+
+\begin{slide}
+\title{The \code{texpower} Package\\{\normalfont \texttt{ifmslide} Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+\tableofcontents
+\end{slide}
+
+\begin{slide}
+\section{A list environment}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+
+
+\section{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+
+
+
+\section{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+
+
+
+\section{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.5\semcm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{slide}
+\end{document}
+%KEEPCOMMENTS
+%</ifmslidemo>
+%=================================================================================================================
+%<*mathexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: mathexample.tex
+%
+% Math example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 mathexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill mathexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 19, 2000: Using \bstep instead of \boxedsteps.
+%
+% v0.0.3 Apr 27, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+% v0.0.4 May 24, 2000: texpower 0.0.8 now supports equation numbers in the argument of \stepwise, so align* was
+% changed to align.
+%
+
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Enable all color emphasis and highlighting options. Use white background and slifonts.
+
+\PassOptionsToPackage{coloremph,colormath,colorhighlight,whitebackground}{texpower}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+
+\usepackage{tpslifonts}
+
+\hypersetup{pdftitle={texpower math example}}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Packages and Preamble settings individual for this example.
+
+% We write some aligned equations.
+
+\usepackage{amsmath}
+% Make nested braces grow.
+\delimitershortfall-1sp
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</mathexample>
+%<*mathexample-src>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle{\macroname{stepwise} Example: An Aligned Equation}\label{Sec:ExEq}
+% In the following, an aligned system of equations is built incrementally. We use the custom command \liststepwise to
+% avoid glitches in vertical spacing.
+%
+\liststepwise%
+{%
+ %
+ % This is just for compressing the equations so they can be squeezed on one slide.
+ %
+ \fontsize{7.8pt}{9pt}\selectfont
+ \renewcommand{\arraystretch}{0}%
+ \setlength{\arraycolsep}{0pt}%
+ \setlength{\abovedisplayskip}{0pt}%
+ \setlength{\belowdisplayskip}{0pt}%
+ %
+ % \highlightboxed will be used for underlaying some formulas with color. To minimize overlap, the width of the outer
+ % frame is reduced.
+ \setlength{\highlightboxsep}{1pt}%
+ %
+ \begin{align}
+ \lefteqn
+ {%
+ \min
+ \left(
+ % The nested braces are filled `from outer to inner'. This means nesting a lot of steps inside each other...
+ % The outermost brace is displayed from the outset.
+ % The first step (which follows right here) displays the next inner brace (the first argument of \min), filled
+ % with an almost `empty' array (apart from one comma and some dots).
+ % \bstep is used to get appropriate white space when the step is not yet active.
+ \bstep
+ {\max
+ \left(
+ \begin{array}{l}
+ % The next two steps fill in the lines of the array.
+ \bstep{\min\left(F'(x),\min\left(F_1(x),G_1(y)\right)\right)},\\[-2ex]
+ \vdots\\
+ \bstep{\min\left(F'(x),\min\left(F_n(x),G_n(y)\right)\right)}
+ \end{array}
+ \right)
+ },
+ % After the first brace is filled, the next step provides the second argument of \min.
+ \bstep{\min\left(G_i(y),H_i(z)\right)}
+ \right)
+ }
+ &
+ % The next couple of steps will create the remaining lines of the aligned equations. These need to be
+ % insubstantial (as is the default for \liststepwise), because & can't go in a box.
+ % As a consequence, the horizontal alignment cannot kick in until the last step is performed. This would make the
+ % alignment `flicker' sidewise.
+ % So we have to bite the bullet and duplicate the widest entry here (invisibly), so that the horizontal alignment
+ % is constant during all steps. *sigh*
+ \phantom
+ {%
+ {}=
+ \min
+ \left(
+ F'(x),
+ \min
+ \left(
+ \max
+ \left(
+ \begin{array}{l}
+ \min\left(F_1(x),\min\left(G_1(y),G_i(y)\right)\right),\\[-1.5ex]
+ \vdots\\[-.5ex]
+ \min\left(F_n(x),\min\left(G_n(y),G_i(y)\right)\right)
+ \end{array}
+ \right),
+ H_i(z)
+ \right)
+ \right)
+ }
+ % The next step displays two lines at a time, but incompletely, i.e. some parts are missing (which are inside
+ % nested calls of \bstep).
+ % This way, it is demonstrated how the arguments of the nested \min's are reordered.
+ \step
+ {%
+ \\
+ &=
+ \max
+ \left(
+ % The macro \activatestep is used by \stepwise to `wrap' the argument of a \bstep command at the _first_ time
+ % it appears.
+ % Usually, it does nothing. Now, we redefine it to highlight its background, so it is easier to spot the
+ % places where the additional arguments were inserted.
+ \let\activatestep\highlightboxed
+ \begin{array}{l}
+ \min
+ \left(
+ % The inner \bstep's display the missing arguments, which are completely identical in both lines.
+ % It is intended that all the missing arguments appear at the same time, so \rebstep is used for the
+ % remaining arguments which have been left out.
+ \min\left(\bstep{F'(x)},\min\left(\rebstep{F_1(x),G_1(y)}\right)\right),\min\left(G_i(y),H_i(z)\right)
+ \right),\\[-2ex]
+ \vdots\\[-1ex]
+ \min
+ \left(
+ \min\left(\rebstep{F'(x)},\min\left(\rebstep{F_n(x),G_n(y)}\right)\right),\min\left(G_i(y),H_i(z)\right)
+ \right)
+ \end{array}
+ \right)
+ \\
+ &=
+ \max
+ \left(
+ \let\activatestep\highlightboxed
+ \begin{array}{l}
+ \min
+ \left(
+ \min\left(
+ % Here are the remaining arguments of \min which are all to be displayed in one step (together with
+ % those from the previous line).
+ \rebstep{F'(x)},\min\left(\rebstep{F_1(x)},\min\left(\rebstep{G_1(y)},G_i(y)\right)\right)
+ \right),
+ H_i(z)
+ \right),\\[-2.5ex]
+ \vdots\\[-1.5ex]
+ \min
+ \left(
+ \min\left(
+ \rebstep{F'(x)},\min\left(\rebstep{F_n(x)},\min\left(\rebstep{G_n(y)},G_i(y)\right)\right)
+ \right),
+ H_i(z)
+ \right)
+ \end{array}
+ \right)
+ }
+ \step
+ {%
+ \\
+ &=
+ \min
+ \left(
+ F'(x),
+ \min
+ \left(
+ \max
+ \left(
+ \begin{array}{l}
+ \min\left(F_1(x),\min\left(G_1(y),G_i(y)\right)\right),\\[-1.5ex]
+ \vdots\\[-.5ex]
+ \min\left(F_n(x),\min\left(G_n(y),G_i(y)\right)\right)
+ \end{array}
+ \right),
+ H_i(z)
+ \right)
+ \right)
+ }
+ \end{align}
+ }%
+ \newslide
+%KEEPCOMMENTS
+%</mathexample-src>
+%=================================================================================================================
+%<*panelexample>
+%<<KEEPCOMMENTS
+%------------------------------------------------------------------------------
+% File: panelexample.tex
+%
+% Example for the panel facilities of TeXPower.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When
+% using standard LaTeX, the dvi file produced should
+% be converted to pdf afterwards (using dvips+distill/ps2pdf or
+% dvipdf, for instance).
+%
+% The resulting pdf file is meant for presenting `interactively' with
+% Adobe Acrobat Reader.
+%
+%------------------------------------------------------------------------------
+% Author: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.1 Nov 14, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.2 May 02, 2003: English version.
+%
+
+%------------------------------------------------------------------------------
+% Enable all color emphasis and highlighting options. Use white
+% background and slifonts.
+
+\PassOptionsToPackage{coloremph,colormath,colorhighlight,whitebackground}
+{texpower}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+
+\usepackage{tpslifonts}
+
+\hypersetup{pdftitle={texpower panel example}}
+
+%------------------------------------------------------------------------------
+% Settings individual for this example.
+
+\renewcommand{\buttonsep}{2pt}
+\renewcommand{\buttonshadowhshift}{1pt}
+\renewcommand{\buttonshadowvshift}{-1pt}
+
+\usepackage{graphicx}
+% The mps extension isn't supported out-of-the-box for latex+dvips
+\ifthenelse{\boolean{psspecialsallowed}}{%
+\DeclareGraphicsExtensions{.mps}}{}
+
+\newcounter{typed}
+
+\makeatletter
+\newcommand{\storehead}[3]
+{%
+ \global\let\@typed=\empty
+ \setcounter{typed}{0}%
+ \def\@typeto{#2}%
+ \let\type@next=\@typeit
+ \type@next#3\@nil
+ \global\let#1=\@typed
+}
+
+\newcommand{\@typeit}[1]
+{%
+ \ifx\@nil#1
+ \else
+ \stepcounter{typed}%
+ \ifthenelse{\value{typed}>\@typeto}
+ {\let\type@next=\@gobbletail}
+ {\g@addto@macro\@typed{#1}}%
+ \expandafter\type@next
+ \fi
+}
+
+\long\def\@gobbletail#1\@nil{}
+
+\newcounter{i}
+
+\newsavebox\logobox
+\newsavebox\hookbox
+
+\makeatother
+
+\mklength{\slidetopmargin}{\ht\logobox*\ratio{1cm}{\semcm}}
+
+\newlength{\buttonwidth}
+
+\newcommand{\mybutton}[2]
+{\raisebox{\depth}{\makebox[\buttonwidth][l]{\button[\buttonwidth]{#1}{#2}}}}
+
+\slidesonlyfalse\notestrue\noxcomment
+
+\begin{document}
+
+% Because the Context Support Macros are loaded at BeginDocument
+\savebox\hookbox{\includegraphics[width=1cm]{fig-2}}
+\makeatletter
+\savebox\logobox{\includegraphics[width=\strip@pt\paperwidth truept]{fig-3}}
+\makeatother
+\savebox\logobox{\raisebox{0cm}[\height-2ex][0pt]{\rlap{\usebox{\logobox}}}}
+
+\pageDuration{0.01}
+
+\begingroup
+\loop
+ \ifnum\value{i}<76
+ \stepcounter{i}%
+ \storehead{\partialtext}{\value{i}}
+ {%
+ Panels\space automatically\space adapt\space to\space the\space
+ size\space of\space their\space contents.\par
+ They\space can\space be\space placed
+ }%
+ \DeclarePanel{left}
+ {%
+ \leavevmode\scriptsize
+ \mbox{\usebox{\logobox}}
+
+ {\bfseries Stephan Lehmke
+
+ Lehr\-stuhl Informatik~I}
+
+ \vfill
+
+ \nointerlineskip
+ \rule{\linewidth}{\fboxrule}
+
+ \nointerlineskip\kern1ex
+ \partialtext
+
+ \nointerlineskip\kern1ex
+ \rule{\linewidth}{\fboxrule}
+
+ \vfill
+
+ \ifthenelse{\lengthtest{\linewidth>2cm}}
+ {\setlength{\buttonwidth}{.5\linewidth-.5ex}}
+ {\setlength{\buttonwidth}{\linewidth}}%
+ %
+ \lineskip1ex\relax
+ %
+ \mybutton{\Acrobatmenu{FirstPage}}{Start}\hfill
+ \mybutton{\Acrobatmenu{LastPage}}{End}\hfill
+ \mybutton{\Acrobatmenu{PrevPage}}{Prev}\hfill
+ \mybutton{\Acrobatmenu{NextPage}}{Next}
+
+ \mbox{\usebox{\hookbox}}
+ }%
+
+ \backgroundstyle{plain}
+
+ \mklength{\slideleftmargin}{\leftpanelwidth*\ratio{1cm}{\semcm}+.5cm}
+ \setlength{\slidewidth}{\paperwidth-\slideleftmargin-\sliderightmargin}
+
+ \begin{slide}
+ \makeslidetitle{\TeX Power Example: panels}
+ \end{slide}
+
+\repeat
+\endgroup
+
+\DeclarePanel*{left}{}
+\setcounter{i}{0}
+
+\setlength{\buttonwidth}{1.5cm}
+
+\DeclarePanel*{bottom}
+{%
+ \leavevmode\scriptsize\smash{\usebox{\hookbox}}\hfill%
+ \mybutton{\Acrobatmenu{FirstPage}}{Start}~%
+ \mybutton{\Acrobatmenu{LastPage}}{End}~%
+ \mybutton{\Acrobatmenu{PrevPage}}{Prev}~%
+ \mybutton{\Acrobatmenu{NextPage}}{Next}%
+}
+
+\mklength{\slidebottommargin}{\bottompanelheight*\ratio{1cm}{\semcm}+.5cm}
+
+\begingroup
+\loop
+ \ifnum\value{i}<24
+ \stepcounter{i}%
+ \storehead{\partialtext}{\value{i}}
+ {%
+ on\space any\space side\space of\space the\space page.
+ }%
+ \DeclarePanel{top}
+ {%
+ \leavevmode\scriptsize\parskip0pt\relax
+ \mbox{\usebox{\logobox}}
+
+ \medskip
+
+ \parbox[t]{\widthof{\bfseries Lehrstuhl Informatik~I}}
+ {\bfseries Stephan Lehmke\\ Lehrstuhl Informatik~I}\quad
+ \parbox[t]{\linewidth-\widthof{\bfseries Lehrstuhl Informatik~I}-3cm}
+ {%
+ Panels\space automatically\space adapt\space to\space the\space
+ size\space of\space their\space contents.\par
+ They\space can\space be\space placed
+ \partialtext
+ }
+ }%
+
+ \backgroundstyle{plain}
+
+ \mklength{\slidetopmargin}{\toppanelheight*\ratio{1cm}{\semcm}+.5cm}
+ \setlength{\slideheight}{\paperheight-\slidetopmargin-\slidebottommargin}
+
+ \begin{slide}
+ \small\makeslidetitle{\TeX Power Example: panels}
+ \end{slide}
+
+\repeat
+\endgroup
+
+\DeclarePanel*{top}{}
+\setlength{\slideheight}{\paperheight-\slidetopmargin-\slidebottommargin}
+
+\setcounter{i}{0}
+
+\makeatletter
+\savebox\logobox
+{%
+ \raisebox{0cm}[\height-1.5ex][0pt]
+ {\llap{\includegraphics[width=\strip@pt\paperwidth truept-1cm]{fig-3}}}%
+}
+\makeatother
+
+\mklength{\slidetopmargin}{\ht\logobox*\ratio{1cm}{\semcm}}
+
+\begingroup
+\loop
+ \ifnum\value{i}<146
+ \stepcounter{i}%
+ \storehead{\partialtext}{\value{i}}
+ {%
+ Normally,\space automatic\space line\space breaks\space are\space
+ not\space needed\space inside\space panels,\space but\space
+ it\space is\space nice\space that\space the\space size\space
+ automatically\space adapts\space to\space the\space size\space
+ of\space logos,\space buttons\space etc.
+ }%
+ \DeclarePanel{right}
+ {%
+ \leavevmode\scriptsize
+ \hspace*{\fill}\mbox{\usebox{\logobox}}\hspace*{-1.5ex}
+
+ \medskip
+
+ {\bfseries Stephan Lehmke
+
+ Lehr\-stuhl Informatik~I}
+
+ \vfill
+
+ \nointerlineskip
+ \rule{\linewidth}{\fboxrule}
+
+ \nointerlineskip\kern1ex
+ Panels\space automatically\space adapt\space to\space the\space
+ size\space of\space their\space contents.\par
+ They\space can\space be\space placed on\space any\space side\space
+ of\space the\space page.
+
+ \partialtext
+ }%
+
+ \backgroundstyle[hpanels=false]{plain}
+
+ \mklength{\sliderightmargin}{\rightpanelwidth*\ratio{1cm}{\semcm}+.5cm}
+ \setlength{\slidewidth}{\paperwidth-\slideleftmargin-\sliderightmargin}
+
+ \begin{slide}
+ \makeslidetitle{\TeX Power Example: panels}
+ \end{slide}
+
+\repeat
+\endgroup
+
+\hypersetup{pdfpageduration={}}
+
+
+\end{document}
+%KEEPCOMMENTS
+%</panelexample>
+%=================================================================================================================
+%<*parexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: parexample.tex
+%
+% Paragraph example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 parexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill parexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 27, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+% v0.0.3 May 26, 2000: Added an example for \hidetext.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+% Use slifonts.
+
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower paragraph example}}
+
+\usepackage{soul}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</parexample>
+%<*parexample-src>
+%<<KEEPCOMMENTS
+%
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle{\macroname{stepwise} Example: Inside A Paragraph}\label{Sec:ExPar}
+
+%
+% We show that \stepwise can be used for highlighting words within a paragraph.
+% Furthermore, it is demonstrated how the order in which \step's are executed can be changed.
+%
+% We define a `placeholder' which will mark the place of missing words (instead of \displayphantom).
+%
+\newcommand{\placeholder}[1]{\leavevmode\phantom{#1}\llap{\rule{\widthof{\phantom{#1}}}{\fboxrule}}}%
+ %
+ % We use the custom command \parstepwise which not only wraps the whole argument of \stepwise into a minipage (because
+ % otherwise vertical spacing goes haywire, don't ask me why), but also gives substance to steps.
+ %
+ % All variants of \stepwise take an optional argument the contents of which are executed inside a group before the
+ % inner loop of starts. It can be used to set parameters locally.
+ % Here, we redefine \activatestep (which has been explained in the equation example) to highlight the first
+ % appearance of any word.
+ % \hidestepcontents is used as a `wrapper' for those arguments of \step which should not appear yet. It either
+ % displays nothing (this is the default for \stepwise and \liststepwise) or puts its argument into a \phantom
+ % (the default for \parstepwise); this behaviour is also toggled by \boxedsteps and \nonboxedsteps.
+ % Here, we redefine it to use our selfdefined \placeholder to mark `missing' words.
+ %
+ \parstepwise[\let\hidestepcontents=\placeholder\let\activatestep=\highlightboxed]%
+ {%
+ \begin{quote}
+ \Huge We can \step{create} a \step{fill-in-the-blanks}
+ %
+ % \step takes an optional argument with which it can be specified _when_ its argument is to appear. This is
+ % expressed in \ifthenelse syntax (see the documentation of the ifthen package).
+ % Here, we refer to the counter step which is advanced by \stepwise and contains the number of the current step.
+ % This way, steps can be made to appear in any order.
+ \step[\value{step}=5]{text} which is then
+ \step[\value{step}=4]{filled} in in
+ \step[\value{step}=3]{\textbf{any}} order!
+ \end{quote}
+ }%
+
+ \newslide
+
+ % The \hidetext command hides its argument while respecting automatic line breaks and such. The command needs the soul
+ % package to work. Read the documentation of soul for restrictions as to what can go in the argument of \hidetext.
+
+ \stepwise[\let\hidestepcontents=\hidetext\let\activatestep=\highlighttext]
+ {%
+ \vspace*{\fill}
+ \begin{minipage}{\linewidth}
+ \begin{quote}
+ \Huge We can step through a \step{paragraph} of \step{free text}
+ \step{without disturbing} line breaks!
+ \end{quote}
+ \end{minipage}
+ \vspace*{\fill}\vspace*{\fill}
+ }
+ \newslide
+%KEEPCOMMENTS
+%</parexample-src>
+%=================================================================================================================
+%<*pdfscrdemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: pdfscrdemo.tex
+%
+% Simple examples the for combining the pdfscreen package with the dynamic features provided by the package
+% texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 25, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Jul 31, 2000: Slightly updated for PDFScreen v.1.5.
+%
+
+\documentclass[12pt]{article}
+
+\usepackage[screen,panelright,sectionbreak]{pdfscreen}
+
+\margins{2ex}{2ex}{2ex}{2ex}
+\screensize{6.25in}{8in}
+
+\emblema{fig-2}
+\urlid{http://texpower.sourceforge.net/}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+% We use the tpslifonts package for better readability.
+%
+\usepackage[display]{texpower}
+\usepackage{tpslifonts}
+
+
+\begin{document}
+
+\title{The \code{texpower} Package\\{\normalfont \texttt{pdfscreen} Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+\tableofcontents
+
+\section{A list environment}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+
+
+\section{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+
+
+
+\section{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+
+
+
+\section{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.1cm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{document}
+%KEEPCOMMENTS
+%</pdfscrdemo>
+%=================================================================================================================
+%<*pdfslidemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: pdfslidemo.tex
+%
+% Simple examples the for combining the pdfslide package with the dynamic features provided by the package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 25, 2000: First version for the pre-alpha release of TeXPower.
+%
+
+\documentclass{article}
+
+\usepackage{pdfslide}
+
+\hypersetup{linkcolor=red}
+
+\overlay{bg.jpg}
+
+\setcounter{secnumdepth}{2}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+% The overlay forces a black background, so we select the blackbackground option of texpower.
+%
+\usepackage[display,blackbackground]{texpower}
+
+
+\begin{document}
+
+\title{The \code{texpower} Package\\{\normalfont \texttt{pdfslide} Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+\tableofcontents
+
+\section{A list environment}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+
+
+\section{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+
+
+
+\section{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+
+
+
+\section{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.2cm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{document}
+%KEEPCOMMENTS
+%</pdfslidemo>
+%=================================================================================================================
+%<*picexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: picexample.tex
+%
+% Picture example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 picexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill picexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+% Note that different pictures are produced with pdflatex and latex, because pdflatex does not support PSTricks.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 27, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Use slifonts and a dark background.
+
+\PassOptionsToPackage{colormath,colorhighlight,darkbackground}{texpower}
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower picture example}}
+
+
+\ifthenelse{\boolean{psspecialsallowed}}% Can we use PSTricks?
+{% Yes.
+ % PsTricks (sic) is used for creating the picture example.
+
+ \usepackage{pstcol}
+ \usepackage{pst-node}
+
+ \psset{unit=\unitlength}
+ }
+{% No. We'll make do without.
+ }
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</picexample>
+%<*picexample-src>
+%<<KEEPCOMMENTS
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle{\macroname{stepwise} Example: A Picture}\label{Sec:ExPic}
+
+\ifthenelse{\boolean{psspecialsallowed}}% Can we use PSTricks?
+{\input{picpsexample}}{\input{picltxexample}}
+\newslide
+\pageTransitionReplace
+%KEEPCOMMENTS
+%</picexample-src>
+%=================================================================================================================
+%<*picltxexample>
+%<<KEEPCOMMENTS
+% Code for the LaTeX picture example for the package texpower.sty.
+%
+% This file is input by others. Don't compile it separately.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 21, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 19, 2000: Using \bstep instead of \boxedsteps.
+%
+% v0.0.3 Apr 28, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+
+ %
+ % This has nothing to do with \stepwise, just setting up the picture...
+ %
+ \newcommand{\leftm}{\left\{\!\!\left\{}
+ \newcommand{\rightm}{\right\}\!\!\right\}}
+ \newcommand{\cls}[3]{\left[#1,#2,#3\right]}
+ \newcommand{\WT}[2]{\fbox{${#1}#2$}}
+ \newcommand{\GEQ}[1]{\WT{\geq}{#1}}
+
+ %
+ % In the following picture, picture items are built incrementally.
+ %
+ % \stepwise generates a sequence of slides, all alike. The only difference ist that on every slide, one more of the
+ % \step commands occurring in the argument of \stepwise are `activated'. This way the stuff inside the argument of
+ % \stepwise is gone through `step by step'.
+ %
+ {%
+ \setlength{\unitlength}{1.35\semcm}%
+ \footnotesize%
+ \setlength{\fboxsep}{1.5pt}%
+ \stepwise
+ {%
+ \begin{center}
+ \begin{picture}(12,13)(-7,-16)
+ \put(-3,-3.5){\makebox(0,0){$\cls{\leftm p_1, p_2\rightm}{1}{\GEQ{0.2}}$}}
+ \put(3,-3.5){\makebox(0,0){$\cls{\leftm \neg p_2,p_1\rightm}{1}{\GEQ{0.1}}$}}
+ %
+ % In the following, we see the very first occurrence of the \step command. Its effect is to `hide' its
+ % argument on the first slide of the sequence generated by \stepwise and display it on all other slides of
+ % this sequence. The second \step command starts displaying on the third slide and so on...
+ %
+ \step{%
+ % We use \afterstep{\pageTransitionDissolve} to make this first step of the diagram appear with a fancy page
+ % transition. We have to use \afterstep because the page transition setting would be undone by the group
+ % closing contained in \end{picture}.
+ \afterstep{\pageTransitionDissolve}%
+ \put(-3,-4){\line(3,-1){3}}
+ \put(3,-4){\line(-3,-1){3}}
+ \put(0,-4.5){\makebox(0,0){(ass.)}}
+ \put(0,-5.5){%
+ \makebox(0,0){%
+ %
+ % Here, one use of \step is nested inside the other.
+ %
+ % Usually `hiding' means ignoring altogehter. For the following application however, the `hidden' objects
+ % are nested inside a brace. This means that instead of ignoring its argument, it's better if
+ % \step displays an appropriate amount of blank space. This behaviour (create blank space) is exhibited by
+ % the custom command \bstep (for `boxed' step).
+ %
+ % The command \rebstep allows both boxes to appear simultaneously.
+ %
+ % \afterstep is used again to reset the page transition to Replace for the building of the formula.
+ %
+ % Setting \activatestep to \highlightboxed makes the additional formulae `stick out' when they are filled
+ % in.
+ %
+ \let\activatestep=\highlightboxed
+ $
+ \cls
+ {\leftm p_1, \bstep{\afterstep{\pageTransitionReplace}p_1}, p_2,\rebstep{\neg p_2}\rightm}
+ {2.2}
+ {\rebstep{\GEQ{0.1}}}%
+ $%
+ }%
+ }
+ }
+ \step{%
+ \afterstep{\pageTransitionDissolve}%
+ \put(0,-6){\line(0,-1){1}}
+ \put(0.2,-6.5){\makebox(0,0)[l]{(removing)}}
+ \put(0,-7.5){\makebox(0,0){$\cls{\leftm p_1, p_1\rightm}{1.2}{\GEQ{0.1}}$}}
+ }
+ \step{%
+ \put(-8,-7.5){\makebox(0,0){$\left[\neg p_1,\GEQ{0.4}\right]$}}
+ \put(-8,-8){\line(5,-1){5}}
+ \put(0,-8){\line(-3,-1){3}}
+ \put(-3,-8.5){\makebox(0,0){(ass.)}}
+ \put(-3,-9.5){\makebox(0,0){$\cls{\leftm p_1, p_1,\neg p_1\rightm}{1.6}{\GEQ{0.1}}$}}
+ \put(-3,-10){\line(0,-1){1}}
+ \put(-2.8,-10.5){\makebox(0,0)[l]{(removing)}}
+ \put(-3,-11.5){\makebox(0,0){$\cls{\leftm p_1\rightm}{0.6}{\GEQ{0.1}}$}}
+ }
+ \step{%
+ \put(-8,-8){\line(0,-1){4}}
+ \put(-8,-12){\line(5,-1){5}}
+ \put(-3,-12){\line(0,-1){1}}
+ \put(-2.8,-12.5){\makebox(0,0)[l]{(assembling)}}
+ \put(-3,-13.5){\makebox(0,0){$\cls{\leftm p_1,\neg p_1\rightm}{1.0}{\GEQ{0.1}}$}}
+ \put(-3,-14){\line(0,-1){1}}
+ \put(-2.8,-14.5){\makebox(0,0)[l]{(removing)}}
+ \put(-3,-15.5){\makebox(0,0){$\left[\fbox{\phantom{x}},\GEQ{0.1}\right]$}}
+ }
+ \end{picture}%
+ \end{center}
+ }%
+ }
+
+ % The whole execution of \stepwise is encapsuled in a group to make all changes local. This affects also the setting
+ % of the page transition to dissolve in the last but one step. We set it again explicitly to make the last step appear
+ % with this page transition as well.
+
+ \pageTransitionDissolve
+%KEEPCOMMENTS
+%</picltxexample>
+%=================================================================================================================
+%<*picpsexample>
+%<<KEEPCOMMENTS
+%
+% Code for the PSTricks picture example for the package texpower.sty.
+%
+% This file is input by others. Don't compile it separately.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 21, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 19, 2000: Using \bstep instead of \boxedsteps.
+%
+% v0.0.3 Apr 28, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+% This has nothing to do with \stepwise, just setting up the picture...
+%
+\newcommand{\Block}[1]
+{%
+ \begin{pspicture}(-4,-2)(4,2)
+ \pspolygon(-4,0)(-2,2)(2,2)(4,0)(2,-2)(-2,-2)
+ \rput(0,0){#1}
+ \end{pspicture}%
+ }%
+\ifthenelse{\boolean{TPcolor}}
+{\psset{unit=3mm,fillstyle=solid,fillcolor=highlightcolor,linecolor=textcolor}}%
+{\psset{unit=3mm}}%
+%
+% In the following picture, picture items are built incrementally.
+%
+% \stepwise generates a sequence of slides, all alike. The only difference ist that on every slide, one more of the
+% \step commands occurring in the argument of \stepwise are `activated'. This way the stuff inside the argument of
+% \stepwise is gone through `step by step'.
+%
+\stepwise
+{%
+ \begin{center}
+ \large
+ \begin{pspicture}(-1,-13)(33,9)
+ \rput(0,0){\rnode{x}{\fboxrule0pt\fbox{$x[t]$}}}
+ \rput(32,0){\rnode{y}{\fboxrule0pt\fbox{$y(t)$}}}
+ {%
+ % The effect of the \step command is to `hide' its argument on the first slide of the sequence generated by
+ % \stepwise and display it on all other slides of this sequence. The second \step command starts displaying on
+ % the third slide and so on...
+ %
+ % Usually `hiding' means ignoring altogehter. For the following application however, the box displayed by
+ % \step is used as an node in the picture. This means that instead of ignoring its argument, it's better if
+ % \step displays an appropriate amount of blank space.
+ % This behaviour (create blank space) is exhibited by the command \bstep.
+ \rput(4,0){\rnode{V}{\bstep{\psframebox{\Large$V$}}}}
+ \ncline{->}{x}{V}
+ %
+ % The command \rebstep allows both boxes to appear simultaneously.
+ %
+ \rput(28,0){\rnode{plus}{\rebstep{\psframebox{\Large$+$}}}}
+ }%
+ \ncline{->}{plus}{y}
+ % By using \restep again, the two boxes defining the operators appear at the same time as the first block of the
+ % diagram, which is produced by the following commands.
+ \restep
+ {%
+ % We use \afterstep{\pageTransitionDissolve} to make this first step of the diagram appear with a fancy page
+ % transition. We have to use \afterstep because the page transition setting would be undone by the group
+ % closing contained in \end{pspicture}.
+ \afterstep{\pageTransitionDissolve}%
+ \rput(16,0){\rnode{IBlk}{\Block{I-Block}}}
+ \ncline{->}{V}{IBlk}
+ \Aput{$x[t]$}
+ \ncline{->}{IBlk}{plus}
+ \Aput
+ {%
+ %
+ % Here, one use of \step is nested inside the other.
+ $%
+ % Note how the math spacing is corrected manually by adding {} after \cdot. Otherwise, \cdot wouldn't be
+ % aware that something is following and act as a postfix (instead of infix) operator.
+ % \afterstep is used again to reset the page transition to Replace for the building of the formula.
+ \bstep{\afterstep{\pageTransitionReplace}{}b\cdot{}}%
+ \bstep{\int\limits^t_0 x(\tau)\,d\tau}%
+ $%
+ }%
+ }%
+ \step
+ {%
+ \afterstep{\pageTransitionDissolve}%
+ \rput(16,6){\rnode{PBlk}{\Block{P-Block}}}
+ \ncangle[angleA=90,angleB=180,fillstyle=none]{->}{V}{PBlk}
+ \Aput{$x(t)$}
+ \ncangle[angleB=90,fillstyle=none]{->}{PBlk}{plus}
+ \aput(.5){$a\cdot x(t)$}
+ }%
+ \step
+ {%
+ \rput(16,-6){\rnode{DBlk}{\Block{D-Block}}}
+ \ncangle[angleA=-90,angleB=180,fillstyle=none]{->}{V}{DBlk}
+ \Aput{$x(t)$}
+ \ncangle[angleB=-90,fillstyle=none]{->}{DBlk}{plus}
+ \aput(.5){$\displaystyle c\cdot \left(\frac{dx}{d\tau}\right)(t)$}
+ }
+ \end{pspicture}%
+ \end{center}
+ }%
+
+% The whole execution of \stepwise is encapsuled in a group to make all changes local. This affects also the setting
+% of the page transition to dissolve in the last but one step. We set it again explicitly to make the last step appear
+% with this page transition as well.
+
+\pageTransitionDissolve
+
+%KEEPCOMMENTS
+%</picpsexample>
+%<*pp4sldemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: pp4sldemo.tex
+%
+% Simple examples the for combining the foils class with the pp4slide package and the dynamic features provided by the
+% package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 25, 2000: First version for the pre-alpha release of TeXPower.
+%
+
+\documentclass[landscape]{foils}
+
+\usepackage{pp4slide}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+% As pp4slide sets some colors designed for dark backgrounds, we give the darkbackground option, and colormath to make
+% formulae colored.
+%
+\usepackage[display,darkbackground,colormath]{texpower}
+
+
+\begin{document}
+
+\title{The \code{texpower} Package\\{\normalfont \texttt{pp4slide} Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+
+\foilhead{A list environment}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+
+
+\foilhead{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+
+
+
+\foilhead{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+
+
+
+\foilhead{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.6cm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{document}
+%KEEPCOMMENTS
+%</pp4sldemo>
+%=================================================================================================================
+%<*prosperdemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: prosperdemo.tex
+%
+\documentclass[pdf,colorBG,slideColor,whitecross]{prosper}
+\usepackage[display]{texpower}
+\begin{document}
+\ifpdf
+ No way to compile a prosper document with pdftex!
+ \else
+\stepwise[\boxedsteps]
+{%
+\begin{slide}{An aligned equation}
+ \begin{eqnarray}
+ \step{\sum_{i=1}^{n} i} & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {%
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+\end{slide}
+}
+\fi
+
+
+\end{document}
+%KEEPCOMMENTS
+%</prosperdemo>
+%=================================================================================================================
+%<*seminardemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: seminardemo.tex
+%
+% Simple examples the for combining the seminar class with the dynamic features provided by the package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Jun 02, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 May 26, 2003: Slightly adapted to new version of fixseminar.
+%
+
+\documentclass[portrait,semrot]{seminar}
+
+% We need fixseminar for setting the page size correctly.
+
+\usepackage{fixseminar}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+%
+\usepackage[display]{texpower}
+
+\rotateheaderstrue
+
+\begin{document}
+\begin{slide}
+
+\title{The \code{texpower} Package\\{\normalfont \texttt{seminar} Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+\newslide
+
+\tableofcontents
+\end{slide}
+
+\begin{slide}
+\centerslidesfalse
+\section{A list environment}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+
+
+\end{slide}
+
+\begin{slide}
+\centerslidesfalse
+\section{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+
+
+
+\end{slide}
+
+\begin{slide}
+\centerslidesfalse
+\section{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+
+
+
+\end{slide}
+
+\begin{slide}
+\centerslidesfalse
+\section{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.5\semcm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\footnotesize $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{slide}
+\end{document}
+%KEEPCOMMENTS
+%</seminardemo>
+%=================================================================================================================
+%<*simpledemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: simpledemo.tex
+%
+% Simple examples the for the dynamic features provided by the package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Apr 17, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 May 24, 2000: texpower 0.0.8 now supports equation numbers in the argument of \stepwise, so eqnarray* was
+% changed to eqnarray.
+%
+
+\documentclass[12pt]{article}
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+%
+\usepackage[display]{texpower}
+
+\begin{document}
+
+\title{The \code{texpower} Package\\{\normalfont Simple Demo}}
+\author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+\maketitle
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+\tableofcontents
+
+\pause
+
+\section{A list environment}
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+\newpage
+
+\section{An aligned equation}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is displayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+
+\pause
+
+\section{An array}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step{ n & \log n & n\log n & n^2 & 2^n \\\hline}%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+
+\pause
+
+\section{A picture}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{.95cm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{document}
+%KEEPCOMMENTS
+%</simpledemo>
+%=================================================================================================================
+%<*slidesdemo>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: slidesdemo.tex
+%
+% Simple examples the for combining the slides class with the dynamic features provided by the package texpower.sty.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 May 25, 2000: First version for the pre-alpha release of TeXPower.
+%
+
+\documentclass[landscape]{slides}
+
+% slides understands the landscape option, but to get it through to pdflatex, we need to set \pdfpageheight etc. The
+% package fixseminar does this.
+
+\usepackage{fixseminar}
+
+% We need to set this page style globally so all dynamically built slides have the right headers.
+
+\pagestyle{slide}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% The texpower package is loaded.
+% We give the display option so dynamic features are enabled.
+%
+\usepackage[display]{texpower}
+
+
+\begin{document}
+
+\begin{slide}
+ \title{The \code{texpower} Package\\{\normalfont \texttt{slides} Demo}}
+ \author{Stephan Lehmke\\\code{mailto:Stephan.Lehmke@cs.uni-dortmund.de}}
+ \maketitle
+\end{slide}
+
+\begin{slide}
+ \begin{center}
+ \textbf{A list environment}
+ \end{center}
+
+% The \pause command `splits' the current page at the place it appears, producing two pages, one with everything which
+% came before the \pause command, one containing this and additionally the stuff coming after \pause. When these pages
+% are presented with acrobar reader in full screen mode (or any other viewer with this capability), the presentation
+% will appear to `stop' at the point the \pause command was issued and `resume' in the moment the presenter switches to
+% the next page.
+
+\pause
+
+% As \pause forces a paragraph break, it can not be used to separate a description label from the associated text. For
+% this, we use the (very flexible) \stepwise command. Inside the argument of \stepwise, an arbitrary number of \step
+% commands may occur. \stepwise will produce as many pages as there are \step commands, making the arguments of the
+% \step commands appear ``one by one''.
+
+\stepwise
+{%
+ \begin{description}
+ \item[foo.] \step{bar.}
+ \step{\item[baz.]} \step{qux.}
+ \end{description}
+ }
+
+\end{slide}
+
+
+\begin{slide}
+ \begin{center}
+ \textbf{An aligned equation}
+ \end{center}
+
+\pause
+
+% Normally for \stepwise, if a \step is not yet active, its argument is ignored completely. This would disturb
+% alignments, because the width changes with every new activated \step.
+% \parstepwise is a variant of \stepwise where the argument of an inactive \step is put into a \phantom, leaving the
+% proper amount of white space.
+
+\parstepwise
+{%
+ % Using eqnarray with equation numbers here means all equation numbers will be visible from the outset, because only
+ % the contents of the lines are `filled in'. See the full demo for an example of aligned equations where equation
+ % numbers `appear'.
+ \begin{eqnarray}
+ %
+ % When the argument of \step is put into a box (as it happens with \parstepwise), tabulators can not go in there. As
+ % we want the equals sign to appear at the same time as the right side of the equation, we use \restep for the
+ % latter. \restep is like \step, but it appears at the same time as the previous \step command.
+ %
+ \sum_{i=1}^{n} i & \step{=} & \restep{1 + 2 + \cdots + (n-1) + n}\\
+ %
+ & \step{=} & \restep{1 + n + 2 + (n-1) + \cdots}\\
+ %
+ & \step{=} & \restep
+ {% We can nest \step commands inside each other. The order of execution is just the
+ % order of appearance, independent of nesting.
+ % \switch is a variant of \step which takes two arguments and toggles between them on
+ % activation. This way, we can make the \underbrace `appear'.
+ % We insert a \vphantom in the first argument so that the equation numbers will be
+ % placed correctly whether or not the underbrace is didplayed.
+ \switch
+ {%
+ \vphantom{\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ (1 + n) + \cdots + (1 + n)%
+ }
+ {\underbrace{(1 + n) + \cdots + (1 + n)}_{\times\frac{n}{2}}}%
+ }
+ \\
+ %
+ % This is another nested application of \step. Note that the spacing of \cdot has to be corrected manually by
+ % inserting {} left of it, because otherwise it would behave like a prefix operator.
+ %
+ & \step{=} & \restep{\frac{(1 + n)\step{{}\cdot n}}{\restep{2}}}
+ \end{eqnarray}
+}
+\end{slide}
+
+\begin{slide}
+ \begin{center}
+ \textbf{An array}
+ \end{center}
+
+\stepwise
+{% With arrays, beware of problems with automatic calculation of cell widths.
+ %
+ % If you want all widths to be calculated automatically, you need to use \parstepwise, with the consequence that
+ % a) tabulators or newlines can not go into the argument of \step,
+ % b) the array `structure' (rules) will be completely visible right from the beginning.
+ %
+ % If you want to use \stepwise for being able to build the `structure' (like \hilne's) dynamically (as done in the
+ % following), you have to make sure that the cell widths are correct from the very first line, because otherwise the
+ % array will expand horizontally, destroying the dynamic effect. This can be assured by
+ % a) using only p cells,
+ % b) making sure all the cells in the first line are at least as wide as the widest cell which will appear later. If
+ % you are using the calc package, this is easiest by putting \makebox[\widthof{widest entry}]{first entry} into
+ % the first cell. Otherwise, you can use \settowidth.
+ %
+ \begin{displaymath}
+ \begin{array}{rrrrr}
+ \step
+ {%
+ n & \log n & n\log n & \lefteqn{n^2}\phantom{25} & \lefteqn{2^n}\phantom{32} \\
+ \hline%
+ }%
+ \step{0 &} \step{\textrm{---} &} \step{\textrm{---} &} \step{0 &} \step{1 \\}%
+ \step{1 &} \step{0\phantom{.6} &} \step{0\phantom{.8} &} \step{1 &} \step{2 \\}%
+ \step{2 &} \step{1\phantom{.6} &} \step{2\phantom{.8} &} \step{4 &} \step{4 \\}%
+ \step{3 &} \step{1.6 &} \step{4.8 &} \step{9 &} \step{8 \\}%
+ \step{4 &} \step{2\phantom{.6} &} \step{8\phantom{.8} &} \step{16 &} \step{16 \\}%
+ \step{5 &} \step{2.3 &} \step{11.6 &} \step{25 &} \step{32 }%
+ \end{array}
+ \end{displaymath}
+}
+\end{slide}
+
+\begin{slide}
+ \begin{center}
+ \textbf{A picture}
+ \end{center}
+
+\pause
+
+\begin{center}%
+ \stepwise
+ {%
+ \setlength{\unitlength}{1.6cm}%
+ \delimitershortfall-1sp% Just for the nested braces
+ \begin{picture}(14,2)
+ \put(0,1){\vector(1,0){1}}
+ \put(0.5,0.5){\makebox(0,0){\small $x(t)$}}
+ \put(13,1){\vector(1,0){1}}
+ \put(13.5,0.5){\makebox(0,0){\small $y(t)$}}
+ \step
+ {
+ \put(1,1){\line(3,2){1.5}}
+ \put(1,1){\line(3,-2){1.5}}
+ \put(2.5,0){\line(0,1){2}}
+ \put(2,1){\makebox(0,0){\large $\varphi$}}
+ }
+ \step
+ {
+ \put(2.5,1){\vector(1,0){3.5}}
+ \put(4.25,0.5){\makebox(0,0){\small $F_t = \varphi\left(x(t)\right)$}}
+ }
+ \step
+ {
+ \put(6,0){\framebox(2,2){\large $\Phi$}}
+ }
+ \step
+ {
+ \put(8,1){\vector(1,0){3.5}}
+ %
+ % Here, we find another nested use of \step inside \step.
+ % \bstep is a variant of \step which _always_ puts its argument into a box for leaving the correct amount of
+ % white space. We cannot use \parstepwise here because \put can't go into a box. Hence, just using \step for
+ % building the nested formula on the next line would give the wrong size for the nested braces.
+ %
+ \put(9.75,0.5){\makebox(0,0){\small $G_t = \Phi\left(\bstep{\varphi\left(\bstep{x(t)}\right)}\right)$}}
+ }
+ \step
+ {
+ \put(13,1){\line(-3,2){1.5}}
+ \put(13,1){\line(-3,-2){1.5}}
+ \put(11.5,0){\line(0,1){2}}
+ \put(12,1){\makebox(0,0){\large $\delta$}}
+ }
+ \end{picture}%
+ }%
+\end{center}%
+\end{slide}
+\end{document}
+%KEEPCOMMENTS
+%</slidesdemo>
+%=================================================================================================================
+%<*spanelexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: spanelexample.tex
+%
+% Very simple panel example - compare with panelexample.tex
+
+\documentclass[calcdimensions,landscape,letterpaper,KOMA]{powersem}
+
+\usepackage[colorlinks,pdfpagemode=FullScreen,plainpages=false]{hyperref}
+
+\usepackage[lightbackground,display]{texpower}
+\renewcommand{\currentpagevalue}{\value{slide}}
+\usepackage{tpslifonts}
+
+\newlength{\buttonwidth}
+\renewcommand{\buttonsep}{0.2\fboxsep}
+\renewcommand{\buttonshadowhshift}{0.1\fboxsep}
+\renewcommand{\buttonshadowvshift}{-0.1\fboxsep}
+
+\DeclarePanel{left}
+{%
+ \textsf{\textbf{\footnotesize
+ \begin{tabular}[b]{@{}l@{}}
+ Your Logo\\
+ Your Name\\
+ Your Company\\
+ \end{tabular}%
+ }}%
+ \vfill
+
+ \setlength{\buttonwidth}{.5\linewidth-.5ex}
+ \button[\buttonwidth]{\Acrobatmenu{FirstPage}}{Start}
+ \button[\buttonwidth]{\Acrobatmenu{LastPage}}{End}
+ \button[\buttonwidth]{\Acrobatmenu{PrevPage}}{Back}
+ \button[\buttonwidth]{\Acrobatmenu{NextPage}}{Next}
+}%
+
+\newcommand{\MyHeader}{}
+
+\newcommand{\myheader}[1]{\renewcommand{\MyHeader}{#1}}
+
+\DeclarePanel{top}{\Large\strut\MyHeader}
+
+\backgroundstyle{vgradient}
+
+\slideframe{none}
+\centerslidesfalse
+\pagestyle{empty}
+
+\mklength{\slideleftmargin}{\leftpanelwidth*\ratio{1cm}{\semcm}+.5cm}
+\renewcommand{\sliderightmargin}{.5cm}
+\mklength{\slidetopmargin}{\toppanelheight*\ratio{1cm}{\semcm}+.5cm}
+\renewcommand{\slidebottommargin}{.5cm}
+
+\begin{document}
+
+\begin{slide}
+
+\myheader{Just some info about panels}
+
+If you're using a package that has it's own panel and/or naviagtion buttons (as
+\href{ftp://ftp.dante.de/tex-archive/help/Catalogue/entries/pdfscreen.html}%
+{\code{pdfscreen}}) don't even consider using the preliminary support for this
+in \concept{\TeX Power}.
+
+Using it for \code{seminar} / \code{powersem} as we are doing here is OK \dots
+
+Things to remember:
+\begin{itemize}
+\item If you want to declare your own panels, you have to call
+\macroname{backgroundstyle} after the panel declaration.
+\item The font color used in the panels are controlled by \code{\carg{pos}paneltextcolor}.
+\end{itemize}
+
+\newslide
+
+\myheader{Some examples for \macroname{pause}}
+
+\pageTransitionDissolve
+With dissolve page transition
+\begin{itemize}
+\item foo\pause
+\item bar\pause
+\end{itemize}
+\pageTransitionReplace
+and with plain replace page transition
+\begin{itemize}
+\item foo\pause
+\item bar\pause
+\end{itemize}
+
+\end{slide}
+
+\end{document}
+%KEEPCOMMENTS
+%</spanelexample>
+%=================================================================================================================
+%<*tabexample>
+%<<KEEPCOMMENTS
+%-----------------------------------------------------------------------------------------------------------------
+% File: tabexample.tex
+%
+% Tabular example for the package texpower.sty.
+%
+% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
+% be processed with
+%
+% dvips -Ppdf -j0 tabexample
+%
+% afterwards processing the resulting ps file with
+%
+% distill tabexample.ps
+%
+% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
+%
+% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
+%
+%-----------------------------------------------------------------------------------------------------------------
+% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
+%
+% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
+%
+% v0.0.2 Apr 27, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
+%
+
+%-----------------------------------------------------------------------------------------------------------------
+% Use slifonts.
+
+\RequirePackage{tpslifonts}
+
+% Input the generic preamble.
+
+\input{__TPpreamble}
+\hypersetup{pdftitle={texpower tabular example}}
+
+
+%-----------------------------------------------------------------------------------------------------------------
+% Finally, everything is set up. Here we go...
+%
+\begin{document}
+\begin{slide}
+%KEEPCOMMENTS
+%</tabexample>
+%<*tabexample-src>
+%<<KEEPCOMMENTS
+
+
+%-----------------------------------------------------------------------------------------------------------------
+%
+\makeslidetitle{\macroname{stepwise} Example: A Tabular}
+
+% In the following, a tabular object is built incrementally.
+% Observe how & and \\ are placed inside the following step to avoid `opening' empty cells.
+% The macro \tabend is redefined to `replace' the final \hline by \cline's when a line is not yet complete.
+%
+ \newcommand{\tabend}{\\\hline}%
+
+ \stepwise
+ {%
+ \hrule height 0pt\relax% This is neccessary to avoid a glitch in vertical spacing. Don't ask me why. I'll try to get
+ % this right until the first alpha version.
+ \begin{center}
+ \step
+ {%
+ \begin{tabular}{|l|l|l|}
+ \hline
+ They can & be built & line by line%
+ \step{\\\hline or cell\renewcommand{\tabend}{\\\cline{1-1}}}%
+ \step{& by\renewcommand{\tabend}{\\\cline{1-2}}}%
+ \step{& cell\renewcommand{\tabend}{\\\hline}}%
+ \step
+ {%
+ \\\hline
+ %
+ % Again, \step's are nested inside each other...
+ %
+ \step{or}&\step{like}&\step{this.}%
+ }%
+ \step{\\\hline But\renewcommand{\tabend}{\\\cline{1-1}}}%
+ \step{& beware\renewcommand{\tabend}{\\\cline{1-2}}}%
+ \step{& of cells growing horizontally!\renewcommand{\tabend}{\\\hline}}%
+ \tabend
+ \end{tabular}%
+ }%
+ \end{center}%
+ }%
+ \newslide
+%KEEPCOMMENTS
+%</tabexample-src>
+%=================================================================================================================
+%<*end>
+\end{slide}
+\end{document}
+%</end>
+%<*enddoc>
+\end{document}
+%</enddoc>
+%=================================================================================================================
+%<*figure-mpsrc>
+prologues:=0;
+
+beginfig(1);
+path p;
+p = (-1cm,0)..(0,-1cm)..(1cm,0);
+fill p{up}..(0,0){-1,-2}..{up}cycle withcolor red;
+draw p..(0,1cm)..cycle withcolor red;
+currentpicture := currentpicture shifted -llcorner currentpicture;
+endfig;
+
+beginfig(2);
+color myblue;
+myblue = (0,0.1,1);
+path p, q, r;
+z1 = (10cm,0cm);
+z2 = z1 + 1cm * dir -60;
+z3 = z2 + 1cm * dir 0;
+z4 = z3 + 1cm * dir 120;
+z5 = (1.2cm,0);
+z6 = -3 * z5 + 1.2cm * dir -60;
+p = z1--z2--z3--z4;
+fill p--cycle withcolor myblue;
+p := p shifted z5;
+fill p--cycle withcolor red;
+p := p shifted z5;
+fill p--cycle withcolor myblue;
+p := p shifted z5;
+fill p--cycle withcolor myblue;
+for j=1 upto 3:
+ p := p shifted z6;
+ for i=1 upto 3:
+ fill p--cycle withcolor myblue;
+ p := p shifted z5;
+ endfor
+ fill p--cycle withcolor myblue;
+endfor
+
+z7 = z1 + 4*z5 - (0.2cm,0) + 0.2cm * dir 60;
+z8 = z7 + 3.5cm*dir 60;
+z9 = z8 + (0.35cm,0cm);
+z7 = z10 + whatever*dir 120;
+z9 = z10 + whatever*dir 60;
+q = z8--z7;
+r = z10--z9;
+z11 = 1.2cm * dir -60;
+z12 = z10-z7;
+p := q--r;
+fill p--cycle withcolor (0,0.7,1);
+q := q shifted z11;
+r := r shifted (z11 + 0.5*z12);
+z13 = urcorner q + whatever*dir 60;
+y13 = y8;
+z14 = urcorner r + whatever*dir 60;
+y14 = y8;
+p := z13--q--r--z14;
+fill p--cycle withcolor (0,0.5,1);
+q := q shifted z11;
+r := r shifted (z11 + 0.5*z12);
+z15 = urcorner q + whatever*dir 60;
+y15 = y8;
+z16 = urcorner r + whatever*dir 60;
+y16 = y8;
+p := z15--q--r--z16;
+fill p--cycle withcolor (0,0.3,1);
+q := q shifted z11;
+r := r shifted (z11 + 0.5*z12);
+z17 = urcorner q + whatever*dir 60;
+y17 = y8;
+z18 = urcorner r + whatever*dir 60;
+y18 = y8;
+z19 = llcorner q + 1.0cm * dir -60;
+p := z17--q--z19--z18;
+fill p--cycle withcolor myblue;
+
+currentpicture := currentpicture shifted -llcorner currentpicture;
+endfig;
+
+beginfig(3);
+color myblue;
+myblue = (0.4,0.7,1);
+path p, q, r;
+z1 = (0cm,0cm);
+z2 = (10cm,0cm);
+z3 = z2 + 1cm * dir 65;
+z4 = z1 + 1cm * dir 65;
+z5 = (1.2cm,0);
+z6 = -3 * z5 + 1.2cm * dir -60;
+p = z1--z2--z3--z4;
+fill p--cycle withcolor myblue;
+defaultfont:="rphvr";
+label.rt(btex \font\sans=lcmssb8 at 0.3cm \sans UNIVERSIT\"AT DORTMUND etex,0.5*(z1+z4)+(0.5cm,0)) withcolor white;
+
+currentpicture := currentpicture shifted -llcorner currentpicture;
+endfig;
+
+end
+%</figure-mpsrc>
+%<*fig-1>
+%<<KEEPCOMMENTS
+%!PS
+%%BoundingBox: 0 0 58 58
+%%Creator: MetaPost
+%%CreationDate: 2004.03.23:0921
+%%Pages: 1
+%%EndProlog
+%%Page: 1 1
+ 1 0 0 setrgbcolor
+newpath 0.25 28.59645 moveto
+0.25 12.94115 12.94115 0.25 28.59645 0.25 curveto
+44.25175 0.25 56.9429 12.94115 56.9429 28.59645 curveto
+56.9429 40.7281 36.86218 45.12794 28.59645 28.59645 curveto
+20.33072 12.06496 0.25 16.4648 0.25 28.59645 curveto closepath fill
+ 0 0.5 dtransform truncate idtransform setlinewidth pop [] 0 setdash
+ 1 setlinejoin 10 setmiterlimit
+newpath 0.25 28.59645 moveto
+0.25 12.94115 12.94115 0.25 28.59645 0.25 curveto
+44.25175 0.25 56.9429 12.94115 56.9429 28.59645 curveto
+56.9429 44.25175 44.25175 56.9429 28.59645 56.9429 curveto
+12.94115 56.9429 0.25 44.25175 0.25 28.59645 curveto closepath stroke
+showpage
+%%EOF
+%KEEPCOMMENTS
+%</fig-1>
+%<*fig-2>
+%<<KEEPCOMMENTS
+%!PS
+%%BoundingBox: 0 0 310 204
+%%Creator: MetaPost
+%%CreationDate: 2004.03.24:1259
+%%Pages: 1
+%%EndProlog
+%%Page: 1 1
+ 0 0.1 1 setrgbcolor
+newpath 0 112.92435 moveto
+14.17323 88.37553 lineto
+42.51968 88.37553 lineto
+28.34645 112.92435 lineto
+ closepath fill
+ 1 0 0 setrgbcolor
+newpath 34.01566 112.92435 moveto
+48.18889 88.37553 lineto
+76.53534 88.37553 lineto
+62.3621 112.92435 lineto
+ closepath fill
+ 0 0.1 1 setrgbcolor
+newpath 68.03131 112.92435 moveto
+82.20454 88.37553 lineto
+110.551 88.37553 lineto
+96.37776 112.92435 lineto
+ closepath fill
+newpath 102.04697 112.92435 moveto
+116.2202 88.37553 lineto
+144.56665 88.37553 lineto
+130.39342 112.92435 lineto
+ closepath fill
+newpath 17.00783 83.46584 moveto
+31.18106 58.91702 lineto
+59.52751 58.91702 lineto
+45.35428 83.46584 lineto
+ closepath fill
+newpath 51.02348 83.46584 moveto
+65.19672 58.91702 lineto
+93.54317 58.91702 lineto
+79.36993 83.46584 lineto
+ closepath fill
+newpath 85.03914 83.46584 moveto
+99.21237 58.91702 lineto
+127.55882 58.91702 lineto
+113.38559 83.46584 lineto
+ closepath fill
+newpath 119.0548 83.46584 moveto
+133.22803 58.91702 lineto
+161.57448 58.91702 lineto
+147.40125 83.46584 lineto
+ closepath fill
+newpath 34.01566 54.00732 moveto
+48.18889 29.45851 lineto
+76.53534 29.45851 lineto
+62.3621 54.00732 lineto
+ closepath fill
+newpath 68.03131 54.00732 moveto
+82.20454 29.45851 lineto
+110.551 29.45851 lineto
+96.37776 54.00732 lineto
+ closepath fill
+newpath 102.04697 54.00732 moveto
+116.2202 29.45851 lineto
+144.56665 29.45851 lineto
+130.39342 54.00732 lineto
+ closepath fill
+newpath 136.06262 54.00732 moveto
+150.23586 29.45851 lineto
+178.5823 29.45851 lineto
+164.40907 54.00732 lineto
+ closepath fill
+newpath 51.02348 24.54881 moveto
+65.19672 0 lineto
+93.54317 0 lineto
+79.36993 24.54881 lineto
+ closepath fill
+newpath 85.03914 24.54881 moveto
+99.21237 0 lineto
+127.55882 0 lineto
+113.38559 24.54881 lineto
+ closepath fill
+newpath 119.0548 24.54881 moveto
+133.22803 0 lineto
+161.57448 0 lineto
+147.40125 24.54881 lineto
+ closepath fill
+newpath 153.07045 24.54881 moveto
+167.24368 0 lineto
+195.59013 0 lineto
+181.4169 24.54881 lineto
+ closepath fill
+ 0 0.7 1 setrgbcolor
+newpath 182.83432 203.75488 moveto
+133.22803 117.83403 lineto
+138.18874 109.24179 lineto
+192.75575 203.75488 lineto
+ closepath fill
+ 0 0.5 1 setrgbcolor
+newpath 216.84998 203.75488 moveto
+199.84215 174.29637 lineto
+150.23586 88.37552 lineto
+157.67693 75.48715 lineto
+212.24394 170.00024 lineto
+231.73213 203.75488 lineto
+ closepath fill
+ 0 0.3 1 setrgbcolor
+newpath 250.86565 203.75488 moveto
+216.84998 144.83786 lineto
+167.24368 58.917 lineto
+177.16512 41.73251 lineto
+231.73213 136.2456 lineto
+270.70853 203.75488 lineto
+ closepath fill
+ 0 0.1 1 setrgbcolor
+newpath 284.8813 203.75488 moveto
+233.8578 115.37935 lineto
+184.25151 29.4585 lineto
+198.42474 4.90968 lineto
+309.6849 203.75488 lineto
+ closepath fill
+showpage
+%%EOF
+%KEEPCOMMENTS
+%</fig-2>
+%<*fig-3>
+%<<KEEPCOMMENTS
+%!PS
+%%BoundingBox: 0 0 296 26
+%%Creator: MetaPost
+%%CreationDate: 2004.03.24:1531
+%%Pages: 1
+%*Font: lcmssb8 8.504 7.97011 41:988e7c0000000002
+%%EndProlog
+%%Page: 1 1
+ 0.4 0.7 1 setrgbcolor
+newpath 0 0 moveto
+283.46451 0 lineto
+295.44437 25.6907 lineto
+11.97986 25.6907 lineto
+ closepath fill
+ 1 setgray
+23.16316 9.27249 moveto
+(UNIVERSIT) lcmssb8 8.504 fshow
+82.72096 10.5127 moveto
+(\177) lcmssb8 8.504 fshow
+81.86467 9.27249 moveto
+(AT) lcmssb8 8.504 fshow
+101.67796 9.27249 moveto
+(DORTMUND) lcmssb8 8.504 fshow
+showpage
+%%EOF
+%KEEPCOMMENTS
+%</fig-3>
+%=================================================================================================================
+%
+% Local Variables:
+% fill-column: 120
+% TeX-master: t
+% End:
diff --git a/Master/texmf-dist/source/latex/texpower/texpower.dtx b/Master/texmf-dist/source/latex/texpower/texpower.dtx
new file mode 100644
index 00000000000..71fc0b0fd57
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/texpower.dtx
@@ -0,0 +1,5350 @@
+% \iffalse meta-comment
+% --------------------------------------------------------------
+% TeXPower bundle - dynamic online presentations with LaTeX
+% Copyright (C) 1999-2004 Stephan Lehmke
+%
+% 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.
+% --------------------------------------------------------------
+%
+% texpower.dtx,v 1.2 2004/07/27 12:04:20 hansfn Exp
+%
+% \fi
+%
+% \iffalse
+%
+%<*driver>
+\ProvidesFile{texpower.dtx}
+%</driver>
+%<texpower>\NeedsTeXFormat{LaTeX2e}
+%<texpower>\ProvidesPackage{texpower}
+%<*texpower>
+ [2004/07/27 v0.1b Create Dynamic Presentations with LaTeX.]
+%</texpower>
+%
+%<*driver>
+\documentclass{ltxdoc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\usepackage{longtable}
+\usepackage[bookmarksopen,colorlinks]{hyperref}
+\begin{document}
+ \DocInput{texpower.dtx}
+\end{document}
+%</driver>
+%
+% \fi
+%
+% \CheckSum{5679}
+%
+% \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{texpower.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment}
+%
+% \title{The \textsf{texpower} package\thanks{This document
+% corresponds to \textsf{texpower}~\fileversion, dated \filedate.}}
+% \author{ Stephan Lehmke \\ \texttt{Stephan.Lehmke@cs.uni-dortmund.de}}
+%
+% \maketitle
+%
+% \tableofcontents
+%
+% \section{Introduction}
+
+% LaTeX Package for creating `dynamic' presentations.
+%
+% The user documentation is found in \texttt{manual.tex} and the FAQ.
+% Only the implementation documentation is covered in this document.
+%
+% The TeXPower Bundle can be found at |http://texpower.sourceforge.net/|
+%
+% \section{Disclaimer}
+%
+% This is a alpha release of the texpower package.
+%
+% During the subsequent error correction and extension of the
+% functionality, the syntax and implementation of the macros are
+% liable to change.
+%
+% The transformation to the dtx format is also not completed.
+%
+% \StopEventually{\PrintChanges\PrintIndex}
+%
+% \section{Implementation}
+%
+% \changes{v0.0.1}{1999/10/26}{First pre-alpha version.}
+%
+% \changes{v0.0.2}{2000/02/15}{Squashing a bug...}
+%
+% \changes{v0.0.3}{2000/03/13}{Tidying up command syntax; adding some in-line documentation.}
+%
+% \changes{v0.0.4}{2000/03/17}{In-line documentation for the first pre-alpha version completed.}
+%
+% \changes{v0.0.5}{2000/03/17}{Fixed some problems with incompatible versions of hyperref (spotted
+% by Marc van Dongen). (Apr 14: this code no longer exists)}
+%
+% \changes{v0.0.6}{2000/03/20}{Added papersize settings. (Mar 28: these are now in fixseminar.sty)}
+%
+% \changes{v0.0.7}{2000/04/07}{Removed dependency on hyperref; added support for color emphasis;
+% respect the display option; now loading tpsettings.cfg and tpoptions.cfg; added \cs{bstep},
+% \cs{switch}, \cs{rebstep}, \cs{reswitch}.}
+%
+% \changes{v0.0.7a}{2000/04/28}{\cs{pause} and \cs{stepwise} now use \cs{leaders} for inserting duplicated
+% parts of pages. This way, processing of whatsits is turned off in the duplicates so that table of
+% contents entries are no longer duplicated when a section occurs on a page where \cs{pause} or
+% \cs{stepwise} is used (spotted by heiner richter). Thanks to Heiko Oberdiek for his suggestion how
+% \cs{leaders} can be successfully applied for this purpose. \cs{stepwise} now does the right thing if
+% no \cs{step} command occurs in contents. There was a bug in \cs{save@TP} which would become
+% apparent if \cs{stepwise} was the first thing on a page. Spotted and fixed by Ross Moore (thanks!).}
+%
+% \changes{v0.0.7b}{2000/05/04}{Changed hyperref version check from 2000/03/22 to 2000/03/23.
+% Spotted by Ross Moore.}
+%
+% \changes{v0.0.7c}{2000/05/06}{\cs{eject} changed to \cs{newpage} in \cs{stepwise} to cure some problems
+% with the foils package. Spotted by Ross Moore.}
+%
+% \changes{v0.0.7d}{2000/05/18}{\cs{everydisplay} finally removed from colormath option because it
+% only causes trouble. Maybe I should look for a less fragile solution for the whole thing. Fixed a
+% bug in texpower's definition of \cs{set@page@color} (used only if pdftex.def doesn't define it)
+% which would cause a fatal error if two \cs{pagecolor} commands occur. Added command
+% \cs{replacecolor}.}
+%
+% \changes{v0.0.8}{2000/05/24}{Now providing two methods for creating duplicates of page contents
+% (used by \cs{pause} and \cs{stepwise}). The former default method using \cs{leaders}, which leads to
+% problems with footnotes (spotted by Heiner Richter), is now activated by the newly introduced
+% option robustduplicates. The new default method uses \cs{unvbox} as the \cs{pause} command from
+% texpause.sty, but redefines \cs{write} for suppressing duplicate toc and bookmark entries due to
+% duplicated whatsits. Changed the way \cs{liststepwise} and \cs{parstepwise} are implemented. Instead
+% of wrapping the whole contents in a minipage (which caused a lot of problems), an invisible
+% \cs{hrule} is inserted in front of contents, which seems to do the job as well. With option
+% robustduplicates, this seems to be unneccessary for \cs{parstepwise}. Now all counters are saved
+% before \cs{stepwise} starts and restored for every \cs{step}. This remedies problems with equation
+% numbers etc. Added a modification for the slides class so that slides are not centered if the
+% display option is given. Option slifonts now also handles math fonts. Added a \cs{hidetext}
+% command which respects line breaks (needs soul package).}
+%
+% \changes{v0.0.8a}{2000/06/02}{Fixed a bug in the code which disables \cs{pageDuration} if the
+% pdfpageduration key doesn't exist (spotted by Friedrich Eisenbrand).}
+%
+% \changes{v0.0.8b}{2000/06/09}{Added additional `dimmed' and `enhanced' color sets for all standard
+% colors, with corresponding commands \cs{dimcolors} and \cs{enhancecolors}. Added a `color stack
+% correction' option fixcolorstack, which should avoid that the duplication of ``color push'' and
+% ``color pop'' specials confuses the driver's color stack (spotted by Ross Moore). Added new
+% display commands \cs{hidedimmed}, \cs{hidevanish}, \cs{highlightenhanced}. Added \cs{step} variants
+% \cs{dstep} and \cs{vstep}. Added patches for \cs{[}, equation, eqnarray, and eqnarray* when the
+% colormath option is used. Now also saving and restoring footnotes at \cs{pause} and \cs{stepwise}.
+% Added a command \cs{releasecounter} to keep a counter from `freezing' during the execution of
+% \cs{stepwise}.}
+%
+% \changes{v0.0.8c}{2000/06/13}{The default duplication method will now (only) attack
+% \cs{protected@write}. There's a new option hackwrite which restores the former default method (of
+% attacking \cs{write}). Corrected a bug newly introduced into \cs{switch} with version 0.0.8b.
+% Corrected a bug in the color correction code (spotted by Ross Moore).}
+%
+% \changes{v0.0.8d}{2000/06/15}{Corrected a minor quirk in \cs{hidetext}. Added a command
+% \cs{addTPcolor} for defining new `standard' colors. In printout versions, the last step will no
+% longer think it's `first activated'.}
+%
+% \changes{v0.0.8e}{2000/06/21}{Yet another rewrite of the page duplication code. I hope it's
+% perfect this time :) The options robustduplicates and hackwrite are obsolete now. Thanks to
+% Martin Schroeder for permission to use his everyshi code. Fixed a small quirk in \cs{dstep} and
+% \cs{vstep}. \cs{darkbackground} and relatives now set both page and text color.}
+%
+% \changes{v0.0.8f}{2000/06/27}{A small change in the definition of \cs{liststepwise} to enhance
+% vertical spacing.}
+%
+% \changes{v0.0.8g}{2000/07/19}{Color management extended and largely rewritten. A small change to
+% make page transition and page duration settings local to groups. \cs{dstep} and \cs{vstep} now
+% understand the usual optional arguments.}
+%
+% \changes{v0.0.9}{2000/10/17}{Added support for structured backgrounds (command
+% \cs{backgroundstyle}). New commands for gradient rules and boxes. Added a hack to keep hyperref
+% from producing duplicate page anchors (suggested by Thomas Emmel). Some slight changes in the
+% mode of accounting in \cs{step} to hopefully give better results for `complicated' orders of
+% activating steps using \cs{step}'s optional arguments. Added (experimental) commands \cs{multistep}
+% and \cs{movie} for aiding in (simple) animations. \cs{pagecolor} hack removed, as pdftex.def on CTAN
+% now supports \cs{pagecolor}. \cs{set@color} hack for seminar removed (made unneccessary by
+% enhancements to powersem). Added rudimentary support for panels. Added rudimentary support for
+% navigation elements. Now put a hyper anchor ``firstpage.n'' on the first element of the sequence
+% for page n.}
+%
+% \changes{v0.0.9a}{2002/02/01}{Tidying up the inline documentation. When the color package is
+% loaded before texpower, texpower's color management is no longer activated automatically.
+% Definitions of standard colors moved to file tpcolors.cfg. Option `slifonts' is obsolete now. The
+% code is now part of the much more sophisticated package ``tpslifonts''. Now the `colormath'
+% option cooperates with array.sty (and thus colortbl.sty). New option ``nineminutes'' to
+% circumvent a strange behaviour of acrobat/acroread v4.05 and later wrt. page duration. Option
+% `fixcolorstack' now checks also for VTeX. \cs{hidedimmed}, \cs{highlightenhanced} and \cs{dstep} now
+% check for math mode. Now using ifpdf package if available.}
+%
+% \changes{v0.0.9b}{2002/11/13}{colormath adapted to different handling of `equation' by amsmath
+% 2.x. Adapted for new version of soul package. Added another patch to colormath for handling
+% array package's ``m'' columns without color change. `Turn on' seminar parameters in panel boxes
+% even before \cs{begin\{document\}}. Added a command \cs{overlays}, sibling of \cs{multistep}, which
+% prints all steps over each other. Added a command \cs{steponce}, sibling of \cs{step}, which is
+% active only for one step. Removed a bug in color correction code introduced in v0.0.8g.}
+%
+% \changes{v0.0.9c}{2003/04/29}{A small fix to give \cs{overlays} a width. \cs{mklength} is now a user
+% command. The \cs{@nobreak} switch and \cs{everypar} are now saved and restored by \cs{stepwise},
+% hopefully enhancing cooperation with section headings and list environments. Changed
+% \cs{newcommand} to \cs{providecommand} to allow background.sty to be loaded in parallel (thanks to
+% Hans Fr. Nordhaug for the original patch).}
+%
+% \changes{v0.0.9d}{2003/05/15}{Release.}
+%
+% \changes{v0.1}{2003/06/03}{Removed font stuff (now resides in tpslifonts). A small fix to avoid
+% warnings about extremely overfull hboxes when measuring steps. Our dabbling with \cs{shipout}
+% created display errors with some packages like pdfscreen. Thanks to Maarten Fokkinga for spotting
+% it. Fixed.}
+%
+% \changes{v0.1a}{2003/06/04}{Color management extended a little to integrate better with LaTeX.
+% Made \cs{step}-like commands give better error messages when outside \cs{stepwise}.}
+%
+% \changes{v0.1b}{2004/07/27}{Moved to dtx format. No other code changes.}
+%
+% We need the programming tools provided by these packages.
+% \begin{macrocode}
+\RequirePackage{ifthen}
+\RequirePackage{calc}
+\RequirePackage{keyval}
+% \end{macrocode}
+%
+% \subsection{Options and general setup}
+%
+% \subsubsection{General options}
+%
+% The option verbose turns on some automatic messages.
+% \begin{macrocode}
+\newboolean{verbose@TP}
+\DeclareOption{verbose}{\setboolean{verbose@TP}{true}}
+% \end{macrocode}
+% The (global) option display is respected and turns on the `dynamic' features.
+% \begin{macrocode}
+\provideboolean{display}
+\DeclareOption{display}{\setboolean{display}{true}}
+% \end{macrocode}
+% The option printout turns off the `dynamic' features. Can be used to undo a default setting of display.
+% \begin{macrocode}
+\DeclareOption{printout}{\setboolean{display}{false}}
+% \end{macrocode}
+% The option fixcolorstack switches on a `color stack correction' method which undoes damage to the driver's color stack
+% when ``color push'' and ``color pop'' specials are duplicated.
+% \begin{macrocode}
+\newboolean{fixcolorstack@TP}
+\DeclareOption{fixcolorstack}{\setboolean{fixcolorstack@TP}{true}}
+% \end{macrocode}
+% The option nineminutes sets the page duration of every single page to a high value (of about nine minutes; this seems
+% to be a hardcoded upper limit in acrobat 5; see below). This way, a setting in acrobat reader's fullscreen dialogue
+% is masked. Otherwise, pages without an explicit page duration setting don't get any page duration setting at all, so
+% they will follow the dialogue setting.
+% \begin{macrocode}
+\newboolean{nineminutes@TP}
+\DeclareOption{nineminutes}{\setboolean{nineminutes@TP}{true}}
+% \end{macrocode}
+%
+% \subsubsection{Color options}
+%
+% The following switch indicates whether color management should be turned on at all.
+% \begin{macrocode}
+\newboolean{TPcolor}
+% \end{macrocode}
+% The option coloremph makes |\em| and |\emph| switch the text color instead of the font shape.
+% \begin{macrocode}
+\newboolean{coloremph@TP}
+\DeclareOption{coloremph}
+{\setboolean{TPcolor}{true}\setboolean{coloremph@TP}{true}}
+% \end{macrocode}
+% The option colormath makes math formulae be color highlighted.
+% \begin{macrocode}
+\newboolean{colormath@TP}
+\DeclareOption{colormath}
+{\setboolean{TPcolor}{true}\setboolean{colormath@TP}{true}}
+% \end{macrocode}
+% The option colorhighlight makes highlighting commands use colors.
+% \begin{macrocode}
+\newboolean{colorhighlight@TP}
+\DeclareOption{colorhighlight}
+{\setboolean{TPcolor}{true}\setboolean{colorhighlight@TP}{true}}
+% \end{macrocode}
+% The option whitebackground selects standard colors for white backgrounds.
+% \begin{macrocode}
+\newboolean{whitebackground@TP}
+\setboolean{whitebackground@TP}{true}% This is the default.
+\DeclareOption{whitebackground}
+{\setboolean{TPcolor}{true}\setboolean{whitebackground@TP}{true}}
+% \end{macrocode}
+% The option lightbackground selects standard colors for light (but not white) backgrounds.
+% \begin{macrocode}
+\newboolean{lightbackground@TP}
+\DeclareOption{lightbackground}
+{\setboolean{TPcolor}{true}\setboolean{lightbackground@TP}{true}}
+% \end{macrocode}
+% The option blackbackground selects standard colors for black backgrounds.
+% \begin{macrocode}
+\newboolean{blackbackground@TP}
+\DeclareOption{blackbackground}
+{\setboolean{TPcolor}{true}\setboolean{blackbackground@TP}{true}}
+% \end{macrocode}
+% The option darkbackground selects standard colors for dark (but not black) backgrounds.
+% \begin{macrocode}
+\newboolean{darkbackground@TP}
+\DeclareOption{darkbackground}
+{\setboolean{TPcolor}{true}\setboolean{darkbackground@TP}{true}}
+% \end{macrocode}
+%
+% Load the config file with default options if file exists.
+% \begin{macrocode}
+\InputIfFileExists{tpoptions.cfg}{}{}
+% \end{macrocode}
+%
+% Process options.
+% \begin{macrocode}
+\ProcessOptions
+
+\ifthenelse{\boolean{display}}
+{\PackageInfo{texpower}{Producing display version. Dynamic features activated.}}
+{\PackageInfo{texpower}{Producing printout version. Dynamic features inactive.}}
+% \end{macrocode}
+%
+% General option-driven initialization.
+%
+% If the verbose option is set, we give a lot of context information when an error is raised.
+% \begin{macrocode}
+\ifthenelse{\boolean{verbose@TP}}{\setcounter{errorcontextlines}{10000}}{}
+% \end{macrocode}
+%
+% Driver-specific defaults.
+%
+% We provide a switch which (hopefully) allows to distinguish whether postscript specials (as used by PSTricks) can be
+% used safely or not.
+% \begin{macrocode}
+\newboolean{psspecialsallowed}
+\setboolean{psspecialsallowed}{true} % optimistic default
+% \end{macrocode}
+% The switch |\ifpdf| is to determine whether pdfLaTeX is being run and outputting pdf, using Heiko Oberdiek's faultproof
+% pdf detector:
+% \begin{macrocode}
+\IfFileExists{ifpdf.sty}
+{%
+ \RequirePackage{ifpdf}%
+ }
+{%
+ \@ifundefined{pdftrue}
+ {%
+ \expandafter\newif\csname ifpdf\endcsname
+ \ifx\pdfoutput\undefined
+ \else
+ \ifx\pdfoutput\relax
+ \else
+ \ifcase\pdfoutput
+ \else
+ \pdftrue
+ \fi
+ \fi
+ \fi
+ }{}%
+ }
+
+\ifpdf\setboolean{psspecialsallowed}{false}\fi
+% \end{macrocode}
+%
+% Class-specific defaults.
+%
+% The following switches centering of slides off for the slides document class because this would disturb dynamic
+% building of slides.
+% \begin{macrocode}
+\@ifclassloaded{slides}%
+{%
+ \ifthenelse{\boolean{display}}%
+ {\let\@topfil\relax}%
+ {}%
+ }
+{}
+% \end{macrocode}
+%
+% Some registers and macros for general use throughout texpower.sty.
+% \begin{macrocode}
+\newcounter{tmpcnta@TP}
+\newcounter{tmpcntb@TP}
+
+\newlength{\tempdima@TP}
+\newlength{\tempdimb@TP}
+
+\newbox\tempbox@TP
+
+\newboolean{carryon@TP}
+% \end{macrocode}
+% These are needed for calculating the size of the page background box.
+% \begin{macrocode}
+\newcommand{\TPpagewidth}{\strip@pt\paperwidth truept}
+\newcommand{\TPpageheight}{\strip@pt\paperheight truept}
+% \AtBeginDocument
+% {%
+% \edef\TPpagewidth{\strip@pt\paperwidth truept}%
+% \edef\TPpageheight{\strip@pt\paperheight truept}%
+% }
+% \end{macrocode}
+% \begin{macro}{\mkfactor}
+% |\mkfactor{<cs>}{<exp>}| is a helper command for automatically generating the fixed point numbers between 0 and 1
+% which are employed by the color calculation commands. |<exp>| can be anything which can stand behind * in calc
+% (for instance: |\value{counter}/\value{maxcounter}| or |\ratio| or whatever). |<cs>| should be a valid macro name. |<exp>|
+% is converted into a fixed-point representation which is then assigned to |<cs>|.
+% \begin{macrocode}
+\newcommand{\mkfactor}[2]%
+{\setlength{\tempdima@TP}{1pt*#2}\edef#1{\strip@pt\tempdima@TP}}
+% \end{macrocode}
+% \end{macro}
+% Make a string representation of a length expression.
+% \begin{macrocode}
+\newcommand{\mklength@TP}[2]
+{\setlength{\tempdima@TP}{#2}\edef#1{\the\tempdima@TP}}
+
+\newcommand{\mklength}{}
+\let\mklength\mklength@TP
+% \end{macrocode}
+%
+% \subsection{Color management, color emphasis and highlighting}
+%
+% Initialization.
+%
+% If we are to use colors, we need the color package.
+% \begin{macrocode}
+\ifthenelse{\boolean{TPcolor}}{\RequirePackage{color}}{}%
+% \end{macrocode}
+%
+% \subsubsection{Color management kernel}
+%
+% Only load the kernel if TeXPower's color management is active.
+% \begin{macrocode}
+\ifthenelse{\boolean{TPcolor}}{% Yes.
+% \end{macrocode}
+% We need a hook which can be defined otherwise to turn off colors.
+% \begin{macrocode}
+ \let\setcolor@TP=\color%
+% \end{macrocode}
+% Overload |\definecolor| to store a `driver-independent' copy of the color definition for later use by |\colorbetween|
+% and relatives.
+% \begin{macrocode}
+ \let\o@definecolor@TP=\definecolor%
+ \def\definecolor#1#2#3%
+ {%
+ \o@definecolor@TP{#1}{#2}{#3}%
+ \expandafter\edef\csname colordef@TP@#1\endcsname%
+ {\csname processcolor@TP@#2\endcsname{#3}}%
+ }%
+% \end{macrocode}
+% Repeat color.sty's standard color definitions to make the original definitions available to TeXPower.
+% Begin excerpt from color.sty:
+% \begin{macrocode}
+ \@ifundefined{c@lor@namefile}{}{\input{\c@lor@namefile}}
+
+ \ifx\color@gray\@undefined
+ \ifx\color@rgb\@undefined
+ \else
+ \definecolor{black}{rgb}{0,0,0}
+ \definecolor{white}{rgb}{1,1,1}
+ \fi
+ \else
+ \definecolor{black}{gray}{0}
+ \definecolor{white}{gray}{1}
+ \fi
+ \ifx\color@rgb\@undefined\else
+ \definecolor{red}{rgb}{1,0,0}
+ \definecolor{green}{rgb}{0,1,0}
+ \definecolor{blue}{rgb}{0,0,1}
+ \fi
+ \ifx\color@cmyk\@undefined\else
+ \definecolor{cyan}{cmyk}{1,0,0,0}
+ \definecolor{magenta}{cmyk}{0,1,0,0}
+ \definecolor{yellow}{cmyk}{0,0,1,0}
+ \fi
+% \end{macrocode}
+% End excerpt from color.sty.
+%
+% \subsubsection{Commands for calculating new colors}
+%
+% \begin{macro}{\interpolate@TP} Calculates the weighted average between two fixed point values.
+% \begin{macrocode}
+ \newcommand{\interpolate@TP}[3]%
+ {%
+ \setlength{\tempdima@TP}{1pt-#1pt}% Calculate the second factor for the weighted average.
+ \edef\secondfactor@TP{\strip@pt\tempdima@TP}%
+ \setlength{\tempdima@TP}{#2pt*\real{#1}+#3pt*\real{\secondfactor@TP}}% Calculate the weighted average.
+ \ifthenelse{\lengthtest{\tempdima@TP<0pt}}% Bound the result to the interval [0,1] (just in case the first
+ {\setlength{\tempdima@TP}{0pt}}% factor was not from [0,1]).
+ {\ifthenelse{\lengthtest{\tempdima@TP>1pt}}{\setlength{\tempdima@TP}{1pt}}{}}%
+ \edef\result@TP{\strip@pt\tempdima@TP}%
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\interpolate@three@TP} Interpolates a three-piece color value.
+% \begin{macrocode}
+ \def\interpolate@three@TP#1,#2,#3;#4,#5,#6;#7%
+ {%
+ \interpolate@TP{#7}{#1}{#4}% First intermediary value.
+ \edef\newcolordef@TP{\result@TP,}% Store first value.
+ \interpolate@TP{#7}{#2}{#5}% Second intermediary value.
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
+ \interpolate@TP{#7}{#3}{#6}% Third intermediary value.
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store third value.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\interpolate@four@TP} Interpolates a four-piece color value.
+% \begin{macrocode}
+ \def\interpolate@four@TP#1,#2,#3,#4;#5,#6,#7,#8;#9%
+ {%
+ \interpolate@TP{#9}{#1}{#5}% First intermediary value.
+ \edef\newcolordef@TP{\result@TP,}% Store first value.
+ \interpolate@TP{#9}{#2}{#6}% Second intermediary value.
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
+ \interpolate@TP{#9}{#3}{#7}% Third intermediary value.
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store third value.
+ \interpolate@TP{#9}{#4}{#8}% Fourth intermediary value.
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store fourth value.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\convert@cmykvalue@rgbvalue@TP} Converts one color value from CMYK to rgb.
+% \begin{macrocode}
+ \def\convert@cmykvalue@rgbvalue@TP#1#2%
+ {%
+ \setlength{\tempdima@TP}{1pt-#1pt-#2pt}%
+ \ifthenelse{\lengthtest{\tempdima@TP<0pt}}{\setlength{\tempdima@TP}{0pt}}{}%
+ \edef\result@TP{\strip@pt\tempdima@TP}%
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\convert@cmyk@rgb@TP} Converts CMYK color to rgb.
+% \begin{macrocode}
+ \def\convert@cmyk@rgb@TP#1,#2,#3,#4;%
+ {%
+ \convert@cmykvalue@rgbvalue@TP{#1}{#4}%
+ \edef\newcolordef@TP{\result@TP,}% Store first value.
+ \convert@cmykvalue@rgbvalue@TP{#2}{#4}%
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
+ \convert@cmykvalue@rgbvalue@TP{#3}{#4}%
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store third value.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\convert@RGBvalue@rgbvalue@TP} Converts one color value from RGB to rgb.
+% \begin{macrocode}
+ \def\convert@RGBvalue@rgbvalue@TP#1%
+ {%
+ \setlength{\tempdima@TP}{#1pt/255}%
+ \edef\result@TP{\strip@pt\tempdima@TP}%
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\convert@RGB@rgb@TP} Converts RGB color to rgb.
+% \begin{macrocode}
+ \def\convert@RGB@rgb@TP#1,#2,#3;%
+ {%
+ \convert@RGBvalue@rgbvalue@TP{#1}%
+ \edef\newcolordef@TP{\result@TP,}% Store first value.
+ \convert@RGBvalue@rgbvalue@TP{#2}%
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
+ \convert@RGBvalue@rgbvalue@TP{#3}%
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store third value.
+ }
+% \end{macrocode}
+% \end{macro}
+% |\colorbetween[<factor>]{<target>}{<source1>}{<source2>}| calculates a `weighted average' between
+% two colors. |<source1>| and |<source2>| are the names of the two colors. |<factor>| (default: 0.5)
+% is a fixed-point number between 0 and 1 giving the `weight' for the interpolation between
+% |<source1>| and |<source2>|. |<target>| is the name to be given to the resulting mixed color. If
+% |<factor>| is 1, then |<target>| will be identical to |<source1>| (up to color model conversions,
+% see below), if |<factor>| is 0, then |<target>| will be identical to |<source2>|, if |<factor>| is
+% 0.5, then |<target>| will be exactly in the middle between |<source1>| and |<source2>|.
+%
+% |\colorbetween| supports the following color models: rgb, RGB, gray, cmyk, hsb. If both colors are
+% of the same model, the resulting color is also of the respective model. If |<source1>| and
+% |<source2>| are from \texttt{different} models, then |<target>| will \texttt{always} be an rgb
+% color. The only exception is the hsb color model: As I don't know how to convert hsb to rgb,
+% mixing hsb with another color model will always raise an error.
+% \begin{macrocode}
+ \newcommand{\colorbetween}[4][.5]%
+ {%
+ \begingroup% Make the definition of \processcolor... local.
+ \newcommand{\processcolor@TP@rgb}[3]% What if the first color is an rgb color?
+ {%
+ \ifx##2\processcolor@TP@rgb% Are both colors rgb colors?
+ \interpolate@three@TP##1;##3;{#1}% Calculate interpolated values.
+ \else
+ \ifx##2\processcolor@TP@gray% Is the second color from the gray model?
+ \interpolate@three@TP##1;##3,##3,##3;{#1}% Calculate interpolated values.
+ \else
+ \ifx##2\processcolor@TP@cmyk% Is the second color from the cmyk model?
+ \convert@cmyk@rgb@TP##3;% Convert to rgb.
+ \edef\newcolordef@TP{\noexpand\interpolate@three@TP##1;\newcolordef@TP;{#1}}%
+ \newcolordef@TP
+ \else
+ \ifx##2\processcolor@TP@RGB% Is the second color from the RGB model?
+ \convert@RGB@rgb@TP##3;% Convert to rgb.
+ \edef\newcolordef@TP{\noexpand\interpolate@three@TP##1;\newcolordef@TP;{#1}}%
+ \newcolordef@TP
+ \else
+ \ifx##2\processcolor@TP@hsb% Is the second color from the hsb model?
+ \PackageError{texpower}{Don't know how to convert an hsb color!}
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \edef\newcolordef@TP{{rgb}{\newcolordef@TP}}% Store the result
+ }%
+ \newcommand{\processcolor@TP@gray}[3]% What if the first color is a gray color?
+ {%
+ \ifx##2\processcolor@TP@gray% Are both colors gray colors?
+ \interpolate@TP{#1}{##1}{##3}% Calculate interpolated value.
+ \edef\newcolordef@TP{{gray}{\result@TP}}% Store the result
+ \else
+ \processcolor@TP@rgb{##1,##1,##1}{##2}{##3}% Otherwise, convert first color to rgb and continue.
+ \fi
+ }%
+ \newcommand{\processcolor@TP@cmyk}[3]% What if the first color is a cmyk color?
+ {%
+ \ifx##2\processcolor@TP@cmyk% Are both colors cmyk colors?
+ \interpolate@four@TP##1;##3;{#1}% Calculate interpolated values.
+ \edef\newcolordef@TP{{cmyk}{\newcolordef@TP}}% Store the result
+ \else
+ \convert@cmyk@rgb@TP##1;% Otherwise, convert first color to rgb ...
+ \expandafter\processcolor@TP@rgb\expandafter{\newcolordef@TP}{##2}{##3}% ... and continue.
+ \fi
+ }%
+ \newcommand{\processcolor@TP@RGB}[3]% What if the first color is an RGB color?
+ {%
+ \convert@RGB@rgb@TP##1;% Convert to rgb ...
+ \expandafter\processcolor@TP@rgb\expandafter{\newcolordef@TP}{##2}{##3}% ... and continue.
+ }%
+ \newcommand{\processcolor@TP@hsb}[3]% What if the first color is an hsb color?
+ {%
+ \ifx##2\processcolor@TP@hsb% Are both colors hsb colors?
+ \interpolate@three@TP##1;##3;{#1}% Calculate interpolated values.
+ \edef\newcolordef@TP{{hsb}{\newcolordef@TP}}% Store the result
+ \else
+ \PackageError{texpower}{Don't know how to convert an hsb color!}
+ \fi
+ }%
+ \expandafter\let\expandafter
+ \firstcol@TP\csname colordef@TP@#3\endcsname % Retrieve definition of color <source1>...
+ \expandafter\expandafter\expandafter\firstcol@TP% and apply (remember \processcolor... is part of the definition)
+ \csname colordef@TP@#4\endcsname% to definition of color <source2>.
+ \edef\end@TP% Define color <target> (outside the enclosing group).
+ {\endgroup\noexpand\definecolor{#2}\newcolordef@TP}%
+ \end@TP
+ }% matches \newcommand{\colorbetween}
+% \end{macrocode}
+% \begin{macro}{\complement@TP} Calculates the complement of a fixed point value.
+% \begin{macrocode}
+ \newcommand{\complement@TP}[1]%
+ {%
+ \setlength{\tempdima@TP}{1pt-#1pt}%
+ \edef\result@TP{\strip@pt\tempdima@TP}%
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\complement@three@TP} Complements a three-piece color value.
+% \begin{macrocode}
+ \def\complement@three@TP#1,#2,#3;%
+ {%
+ \complement@TP{#1}%
+ \edef\newcolordef@TP{\result@TP,}% Store first value.
+ \complement@TP{#2}%
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
+ \complement@TP{#3}%
+ \edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store third value.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\grabfourth@TP} Separates the fourth element of a four-piece color value from the rest.
+% \begin{macrocode}
+ \def\grabfourth@TP#1,#2,#3,#4;%
+ {%
+ \def\mem@TP{#4}% Store fourth element.
+ \def\result@TP{#1,#2,#3;}% Store first three elements.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\complementcolor}
+% |\complementcolor{<target>}{<source>}| calculates the numerical complement of a color. |<source>| is the name of the
+% color to be complemented. |<target>| is the name to be given to the resulting color.
+% |\complementcolor| supports the following color models: rgb, RGB, gray, cmyk, hsb.
+% \begin{macrocode}
+ \newcommand{\complementcolor}[2]%
+ {%
+ \begingroup% Make the definition of \processcolor... local.
+ \newcommand{\processcolor@TP@rgb}[1]% What if the color is an rgb color?
+ {%
+ \complement@three@TP##1;% Calculate complemented values.
+ \edef\newcolordef@TP{{rgb}{\newcolordef@TP}}% Store the result
+ }%
+ \newcommand{\processcolor@TP@gray}[1]% What if the color is a gray color?
+ {%
+ \complement@TP{##1}% Calculate complemented value.
+ \edef\newcolordef@TP{{gray}{\result@TP}}% Store the result
+ }%
+ \newcommand{\processcolor@TP@cmyk}[1]% What if the color is a cmyk color?
+ {%
+ \grabfourth@TP##1;% Remember fourth element.
+ \expandafter\complement@three@TP\result@TP% Calculate complemented values of first three elements.
+ \edef\newcolordef@TP{{cmyk}{\newcolordef@TP,\mem@TP}}% Store the result, putting back the fourth element.
+ }%
+ \newcommand{\processcolor@TP@RGB}[1]% What if the color is an RGB color?
+ {%
+ \convert@RGB@rgb@TP##1;% Convert to rgb ...
+ \expandafter\processcolor@TP@rgb\expandafter{\newcolordef@TP}% ... and continue.
+ }%
+ \newcommand{\processcolor@TP@hsb}[1]% What if the color is an hsb color?
+ {%
+ \complement@three@TP##1;% Calculate complemented values.
+ \edef\newcolordef@TP{{hsb}{\newcolordef@TP}}% Store the result
+ }%
+ \csname colordef@TP@#2\endcsname% Execute definition of color <source> (which contains \processcolor...)
+ \edef\end@TP% Define color <target> (outside the enclosing group).
+ {\endgroup\noexpand\definecolor{#1}\newcolordef@TP}%
+ \end@TP
+ }% matches \newcommand{\complementcolor}
+ }% matches \ifthenelse{\boolean{TPcolor}}{% Yes.
+{% No. Do nothing.
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \subsection{Color name and color set management}
+%
+% \begin{macro}{\replacecolor}
+% |\replacecolor[<tset>]{<tcol>}[<sset>]{<scol>}| will make |<tcol>| have the same definition as |<scol>| (if |<scol>| is
+% defined at all), where <tcol> and <scol> are color names as given in the first argument of |\definecolor|. If (one
+% of) |<tset>| and |<sset>| are given, the colors will be taken from the respective color sets.
+% \begin{macrocode}
+\newcommand{\replacecolor}
+{%
+ \let\replacecolor@hook@TP=\@gobble% This hook can be used for variant checking (see below).
+ \replacecolor@TP% Pick up arguments.
+ }
+
+\newcommand{\replacecolor@TP}[2][]% Pick up the first two arguments of \replacecolor.
+{%
+ \ifthenelse{\equal{#1}{}}{\edef\tcolname@TP{#2}}{\edef\tcolname@TP{#2@#1}}% Construct `real' target color name.
+ \@replacecolor@TP% Read second argument.
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macrocode}
+\ifthenelse{\boolean{TPcolor}}% Only if TeXPower's color management is active.
+{% Yes.
+ \newcommand{\undefinecolor@TP}[1]% Make a color undefined.
+ {\expandafter\let\csname\string\color @#1\endcsname=\@undefined}%
+
+
+ \newcommand{\ifcolorexists@TP}[3]% Conditional for testing whether a color is defined.
+ {\@ifundefined{\string\color @#1}{#3}{#2}}% Test whether a given color is defined.
+
+
+ \newcommand{\@replacecolor@TP}[2][]% Second part of \replacecolor.
+ {%
+ \ifthenelse{\equal{#1}{}}{\edef\scolname@TP{#2}}{\edef\scolname@TP{#2@#1}}% Construct `real' source color name.
+ \ifcolorexists@TP{\scolname@TP}% Does the source color exist at all?
+ {% Yes.
+ \replacecolor@hook@TP{\tcolname@TP}% Execute hook.
+ \expandafter\let\csname\string\color @\tcolname@TP\expandafter\endcsname% Make value of target color
+ \csname\string\color @\scolname@TP\endcsname% identical with source color.
+ \expandafter\let\csname colordef@TP@\tcolname@TP\expandafter\endcsname% Make definition of target color
+ \csname colordef@TP@\scolname@TP\endcsname% identical with source color.
+ }%
+ {% No. Do nothing.
+ }%
+ }%
+% \end{macrocode}
+%
+% The set of TeXPower's `standard colors' and some commands to manipulate them.
+%
+% \begin{macro}{\colors@TP} |\colors@TP| is the list of all standard colors defined by texpower.
+% The list is empty initially.
+% \begin{macrocode}
+ \newcommand{\colors@TP}{}
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\removecolor@TP} Removes a color name from the list.
+% \begin{macrocode}
+ \newcommand{\removecolor@TP}[1]%
+ {%
+ \def\processme@TP##1% This macro does the real work.
+ {%
+ \ifthenelse{\equal{#1}{##1}}% Is this the color to be removed?
+ {% Yes. Do nothing, so it vanishes.
+ }
+ {% No. Re-insert.
+ \expandafter\def\expandafter\colors@TP\expandafter{\colors@TP\processme@TP{##1}}%
+ }%
+ }%
+ \expandafter\let\expandafter\colors@TP\expandafter\empty% Initialize \colors@TP.
+ \colors@TP% Execute \processme@TP for every color on the list.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\addTPcolor}
+% |\addTPcolor{<color>}| adds the color named |<color>| to TeXPower's list of standard colors.
+% \begin{macrocode}
+ \newcommand{\addTPcolor}[1]%
+ {%
+ \removecolor@TP{#1}% Remove this color from the list (to avoid duplicates).
+ \expandafter\def\expandafter\colors@TP\expandafter{\colors@TP\processme@TP{#1}}% ... and insert.
+ \register@normalvariant@TP{#1}% Register the normal variant for this color.
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\defineTPcolor}
+% |\defineTPcolor[<set>]{<name>}{<model>}{<def>}| acts like\\ |\definecolor{<name>}{<model>}{<def>}|, but
+% \begin{enumerate}
+% \item color |<name>| is automatically added to the list of standard colors and
+% \item if the optional parameter is given, the color is defined in the color set |<set>| instead of
+% the current color set.
+% \end{enumerate}
+% \begin{macrocode}
+ \newcommand{\defineTPcolor}[4][]
+ {%
+ \addTPcolor{#2}% Add color to the list.
+ \ifthenelse{\equal{#1}{}}% Color from the current color set?
+ {\definecolor{#2}{#3}{#4}}% Yep. Just define the color.
+ {\definecolor{#2@#1}{#3}{#4}}% No. Add color set identifyer.
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% Some commands for manipluating whole color sets.
+%
+% \begin{macro}{\replacecolors@TP} Low level command for replacing a complete color set.
+% \begin{macrocode}
+ \newcommand{\replacecolors@TP}%
+ {%
+ \@ifstar% The starred version will put the color set into normal variant.
+ {\let\replacecolor@hook@TP=\register@normalvariant@TP\@replacecolors@TP}
+ {\let\replacecolor@hook@TP=\@gobble\@replacecolors@TP}%
+ }
+
+ \newcommand{\@replacecolors@TP}[4]% This part does the real work.
+ {%
+ \def\processme@TP##1{\replacecolor@TP[#1]{#2##1}[#3]{#4##1}}%
+ \colors@TP
+ }
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\usecolorset}
+% |\usecolorset{<set>}| switches to color set |<set>|.
+% \begin{macrocode}
+ \newcommand{\usecolorset}[1]%
+ {%
+ \replacecolors@TP*{}{}{#1}{}% Replace normal variant (registering variants).
+ \replacecolors@TP{}{d}{#1}{d}% Replace dimmed variant.
+ \replacecolors@TP{}{e}{#1}{e}% Replace enhanced variant.
+ \color{textcolor}% Activate textcolor.
+ \pagecolor{pagecolor}% Activate pagecolor.
+ }%
+% \end{macrocode}
+% \end{macro}
+% \begin{macro}{\dumpcolorset}
+% |\dumpcolorset{<set>}| saves all standard colors from the current color set to the color set |<set>|.
+% \begin{macrocode}
+ \newcommand{\dumpcolorset}[1]%
+ {%
+ \nonnormalwarnings@TP{Dumping color set #1}% Output a warning for every color not in the normal variant.
+ \replacecolors@TP{#1}{}{}{}% Dump normal variant (hopefully).
+ \replacecolors@TP{#1}{d}{}{d}% Dump dimmed variant.
+ \replacecolors@TP{#1}{e}{}{e}% Dump enhanced variant.
+ }%
+% \end{macrocode}
+% \end{macro}
+% Commands for color variants.
+% \begin{macrocode}
+ \newcommand{\registervariant@TP}[2]% Remember which variant a color is currently in.
+ {\expandafter\def\csname cvar@#1@TP\endcsname{#2}}
+
+ \newcommand{\register@normalvariant@TP}[1]% Register that a color is now in the normal variant.
+ {\registervariant@TP{#1}{}}
+
+ \newcommand{\currentvariant@TP}[1]% Return the current variant of a color.
+ {\csname cvar@#1@TP\endcsname}
+
+ \newcommand{\ifnormalvariant@TP}[3]% Conditional for checking whether a color is in the normal variant.
+ {\ifthenelse{\equal{\currentvariant@TP{#1}}{}}{#2}{#3}}
+
+ \newcommand{\nonnormalwarnings@TP}[1]% Checks the current variant for every standard color and gives a warning
+ {% if it's not the normal one.
+ \def\processme@TP##1%
+ {%
+ \ifnormalvariant@TP{##1}{}
+ {%
+ \PackageWarning{texpower}
+ {#1\MessageBreak when color ##1 is in \currentvariant@TP{##1} variant}%
+ }%
+ }%
+ \colors@TP
+ }
+% \end{macrocode}
+% Default dim level for automatic color dimming.
+% \begin{macrocode}
+ \newcommand{\dimlevel}{.7}
+% \end{macrocode}
+% |\dimcolor[<level>]{<color>}| dims the color named |<color>|. It checks whether an explicit `dimmed' variant d<color>
+% exists. If yes, |<color>| is replaced by |d<color>|. Otherwise, the dimmed color is calculated by interpolating between
+% pagecolor and |<color>|. The parameter for |\colorbetween| is given by the optional argument |<level>| (default:
+% |\dimlevel|).
+% \begin{macrocode}
+ \newcommand{\dimcolor}[2][\dimlevel]
+ {%
+ \ifnormalvariant@TP{#2}% Color in the normal variant?
+ {% Yes.
+ \registervariant@TP{#2}{d}% Register dimmed variant.
+ \ifcolorexists@TP{d#2}% Dedicated dimmed color found?
+ {\replacecolor{#2}{d#2}}% Yes. use that one.
+ {\colorbetween[#1]{#2}{pagecolor}{#2}}% No. Dim numerically using \colorbetween.
+ }%
+ {}% No. Do nothing.
+ }
+% \end{macrocode}
+% |\dimcolors[<level>]| dims all standard colors using |\dimcolor|. See the description of |\dimcolor| for details.
+% \begin{macrocode}
+ \newcommand{\dimcolors}[1][\dimlevel]
+ {%
+ \def\processme@TP##1{\dimcolor[#1]{##1}}%
+ \colors@TP
+ }%
+% \end{macrocode}
+% Default enhance level for automatic color enhancing.
+% \begin{macrocode}
+ \newcommand{\enhancelevel}{.5}
+% \end{macrocode}
+% |\enhancecolor[<level>]{<color>}| enhances the color named |<color>|. It checks whether an explicit `enhanced' variant
+% |e<color>| exists. If yes, |<color>| is replaced by |e<color>|. Otherwise, the enhanced color is calculated by
+% `extrapolating' from pagecolor and |<color>|. The parameter for |\colorbetween| is given by the optional argument
+% |<level>| (default: |\enhancelevel|).
+% \begin{macrocode}
+ \newcommand{\enhancecolor}[2][\enhancelevel]
+ {%
+ \ifnormalvariant@TP{#2}% Color in the normal variant?
+ {%
+ \registervariant@TP{#2}{e}% Register enhanced variant.
+ \ifcolorexists@TP{e#2}% Dedicated enhanced color found?
+ {\replacecolor{#2}{e#2}}% Yes. use that one.
+ {\colorbetween[-#1]{#2}{pagecolor}{#2}}% No. Enhance numerically using \colorbetween.
+ }%
+ {}%
+ }%
+% \end{macrocode}
+% |\enhancecolors[<level>]| enhances all standard colors using |\enhancecolor|. See the description of |\enhancecolor| for
+% details.
+% \begin{macrocode}
+ \newcommand{\enhancecolors}[1][\enhancelevel]
+ {%
+ \def\processme@TP##1{\enhancecolor[#1]{##1}}%
+ \colors@TP
+ }%
+% \end{macrocode}
+% Replace all colors from the current color set by a single color.
+% \begin{macrocode}
+ \newcommand{\replacecolorsbyone@TP}[2]%
+ {%
+ \def\processme@TP##1{\replacecolor{#1##1}{#2}}%
+ \colors@TP
+ }
+% \end{macrocode}
+% The color used to make things `vanish'.
+% \begin{macrocode}
+ \newcommand{\vanishcolor}{pagecolor}
+% \end{macrocode}
+% |\vanishcolors| replaces all standard colors by |\vanishcolor|.
+% \begin{macrocode}
+ \newcommand{\vanishcolors}[1][\vanishcolor]{\replacecolorsbyone@TP{}{#1}}
+% \end{macrocode}
+% TeXPower's predefined color sets and commands to activate them. Redefine in tpcolors.cfg as convenient.
+% \begin{macrocode}
+ \input{tpcolors.cfg}
+% \end{macrocode}
+% |\whitebackground| sets the standard colors up for white background.
+% \begin{macrocode}
+ \newcommand{\whitebackground}%
+ {%
+ \usecolorset{whitebg}%
+ }
+% \end{macrocode}
+% When the whitebackground option (or no background option, but some other color-activating option like colormath) is
+% given, |\whitebackground| is executed automatically (at the end of the package to ensure that texpower.cfg was read).
+% \begin{macrocode}
+ \ifthenelse{\boolean{whitebackground@TP}}
+ {\AtEndOfPackage{\whitebackground}}
+ {}
+% \end{macrocode}
+% |\lightbackground| sets the standard colors up for `light' background.
+% \begin{macrocode}
+ \newcommand{\lightbackground}%
+ {%
+ \usecolorset{lightbg}%
+ }
+% \end{macrocode}
+% When the lightbackground option is given, |\lightbackground| is executed automatically.
+% \begin{macrocode}
+ \ifthenelse{\boolean{lightbackground@TP}}{\AtEndOfPackage{\lightbackground}}{}
+% \end{macrocode}
+% |\darkbackground| sets the standard colors up for `dark' background.
+% \begin{macrocode}
+ \newcommand{\darkbackground}%
+ {%
+ \usecolorset{darkbg}%
+ }
+% \end{macrocode}
+% Execute |\darkbackground| automatically if the darkbackground option was given.
+% \begin{macrocode}
+ \ifthenelse{\boolean{darkbackground@TP}}{\AtEndOfPackage{\darkbackground}}{}
+% \end{macrocode}
+% |\blackbackground| sets the standard colors up for black background.
+% \begin{macrocode}
+ \newcommand{\blackbackground}%
+ {%
+ \usecolorset{blackbg}%
+ }
+% \end{macrocode}
+% Execute |\blackbackground| automatically if the blackbackground option was given.
+% \begin{macrocode}
+ \ifthenelse{\boolean{blackbackground@TP}}{\AtEndOfPackage{\blackbackground}}{}
+% \end{macrocode}
+% If TeXPower's color management is active, setup LaTeX color management to use the dedicated colors.
+% \begin{macrocode}
+ \ifthenelse{\boolean{TPcolor}}
+ {%
+ \renewcommand{\normalcolor}{\color{textcolor}}% \normalcolor should produce textcolor.
+
+ \let\o@textnormal@TP=\textnormal% \textnormal should also set text color.
+ \def\textnormal#1{\o@textnormal@TP{\normalcolor#1}}
+% \end{macrocode}
+% Make sure current color is correct for the rest of the preamble.
+% \begin{macrocode}
+ \AtEndOfPackage{\color{textcolor}\let\default@color\current@color}
+% \end{macrocode}
+% The following is deferred to the beginning of the document to allow redefinitions of colors and loading of
+% packages. We set page and text color and make amsmath's |\text| command switch to text color.
+% \begin{macrocode}
+ \AtBeginDocument%
+ {%
+ \pagecolor{pagecolor}\color{textcolor}%
+ \@ifpackageloaded{amstext}%
+ {%
+ \let\o@text@TP=\text%
+ \def\text#1{\o@text@TP{\normalcolor\expandafter\everymath\expandafter{\the\everymath\color{mathcolor}}#1}}%
+ }%
+ {}%
+ }%
+ }
+ {}
+% \end{macrocode}
+% If TeXPower's color management is active, set page and text color at the beginning of the document.
+% \begin{macrocode}
+ \ifthenelse{\boolean{TPcolor}}{\AtBeginDocument{\pagecolor{pagecolor}\color{textcolor}}}{}
+ }% matches \ifthenelse{\boolean{TPcolor}}{% Yes.
+{% No; provide dummies.
+ \let\setcolor@TP=\@gobble%
+ \newcommand{\@replacecolor@TP}[2][]{}%
+ \let\addTPcolor=\@gobble
+ \newcommand{\defineTPcolor}[4][]{}%
+ \let\usecolorset=\@gobble
+ \let\dumpcolorset=\@gobble
+ \newcommand{\dimcolor}[2][]{}
+ \newcommand{\dimcolors}[1][]{}
+ \newcommand{\enhancecolor}[2][]{}
+ \newcommand{\enhancecolors}[1][]{}
+ \newcommand{\vanishcolors}[1][]{}
+ }
+% \end{macrocode}
+%
+% \subsubsection{Implementation of the coloremph option}
+% \begin{macrocode}
+\ifthenelse{\boolean{coloremph@TP}}% Should \emph use color?
+{% Yes;
+ \DeclareRobustCommand{\em}% Redefine \em.
+ {%
+ \@nomath\em \color{emcolor}% Change color.
+ \replacecolor{tmp@TP}{emcolor}% Exchange emcolor and altemcolor.
+ \replacecolor{emcolor}{altemcolor}%
+ \replacecolor{altemcolor}{tmp@TP}%
+ }%
+ }%
+{}% No; keep original definition.
+% \end{macrocode}
+%
+% \subsubsection{Implementation of the colormath option}
+%
+% Note that the following code is quite fragile and contains some modifications of LaTeX internals. Thus it is likely to
+% cause trouble, especially in conjunction with other packages modifying the LaTeX kernel. The array package is
+% supported, but no explicit support of other packages exists. If you experience strange and inexplicable errors while
+% the colormath option is active, first of all try switching it off to see whether anything changes.
+% The implementation of colormath is likely to change several times before the first beta release, so expect backward
+% incompatible changes in behaviour.
+% \begin{macrocode}
+\ifthenelse{\boolean{colormath@TP}}% Should we color math?
+{% Yes.
+ \AtBeginDocument
+ {%
+% \end{macrocode}
+% The most basic magical incantation: Color inline math using |\everymath|. Beware of side effects of this hack.
+% \begin{macrocode}
+ \expandafter\everymath\expandafter{\the\everymath\color{mathcolor}}%
+% \end{macrocode}
+% Color displayed math by overloading LaTeX's own math environments. Note that this doesn't work for the TeX
+% notation \$\$, which is deprecated in LaTeX anyway.
+% Note further that for the eqnarray and eqnarray* environments, the current implementation places the color change
+% command \textbf{outside} the math environment (for technical reasons; maybe this can be remedied by a more sophisticated
+% implementation), which will almost invariably lead to unwanted extra vertical space before and after equation
+% arrays. Currently there is no clean remedy, apart from using amsmath's align environment.
+% \begin{macrocode}
+ \let\o@dm@TP=\[% Save the original definitions of begin and end macros for
+ \let\o@enddm@TP=\]% LaTeX's displayed math environments.
+ \let\o@eqa@TP=\eqnarray%
+ \let\o@endeqa@TP=\endeqnarray%
+ \expandafter\let\expandafter\o@eqastar@TP\csname eqnarray*\endcsname%
+ \expandafter\let\expandafter\o@endeqastar@TP\csname endeqnarray*\endcsname%
+ \def\[{\o@dm@TP\begingroup\color{mathcolor}}% Redefine the begin and end macros for LaTeX's displayed math
+ \def\]{\endgroup\o@enddm@TP}% environments, adding the color change commands and an extra
+ \def\eqnarray{\begingroup\color{mathcolor}\o@eqa@TP}% level of grouping.
+ \def\endeqnarray{\o@endeqa@TP\endgroup\@ignoretrue}%
+ \@namedef{eqnarray*}{\begingroup\color{mathcolor}\o@eqastar@TP}
+ \@namedef{endeqnarray*}{\o@endeqastar@TP\endgroup\@ignoretrue}
+ \@ifpackageloaded{amsmath}% Amsmath's displayed math environments are covered by the
+ {% \everymath hack because they are `fake' displayed equations.
+ \@ifpackagelater{amsmath}{2000/01/15}% As amsmath 1.x redefines the equation environment to be a
+ {% variant of gather, treating it as a displayed math
+ \let\o@eq@TP=\equation% environment would lead to problems, so this redefinition is
+ \let\o@endeq@TP=\endequation% made only if amsmath 1.x is not loaded.
+ \def\equation{\o@eq@TP\begingroup\color{mathcolor}}%
+ \def\endequation{\endgroup\everymath{}\o@endeq@TP}%
+ }%
+ {}%
+ }%
+ {%
+ \let\o@eq@TP=\equation%
+ \let\o@endeq@TP=\endequation%
+ \def\equation{\o@eq@TP\begingroup\color{mathcolor}}%
+ \def\endequation{\endgroup\everymath{}\o@endeq@TP}%
+ }%
+ }% matches \AtBeginDocument{
+% \end{macrocode}
+% Sometimes, a math environment is used for something other than displaying math. The macro |\origmath| will put its
+% argument in math mode, but turn off coloring. If another math environemt should be nested inside the argument of
+% |\origmath|, it will be coloured.
+% \begin{macrocode}
+ \newcommand{\origmath}[1]{{\everymath{}\ensuremath{\everymath{\color{mathcolor}}#1}}}%
+% \end{macrocode}
+% We need to redefine some LaTeX macros which internally use math mode, to make sure that not all tabulars and
+% parboxes are coloured. Note that this can break packages which mess with tabular themselves.
+% \begin{macrocode}
+ \renewcommand*\labelitemi{\origmath{\m@th\bullet}}%
+ \@ifpackageloaded{array}% The array package redefines \@tabular
+ {%
+ \def\@tabular{%
+ \leavevmode
+ \hbox \bgroup \everymath{}$\everymath{\color{mathcolor}}\col@sep\tabcolsep \let\d@llarbegin\begingroup % $
+ \let\d@llarend\endgroup
+ \@tabarray
+ }%
+ \@ifpackageloaded{colortbl}
+ {%
+ \def\@classz{\@classx
+ \@tempcnta \count@
+ \prepnext@tok
+ \expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil
+ \@addtopreamble{%
+ \setbox\z@\hbox\bgroup\bgroup
+ \ifcase \@chnum
+ \hskip\stretch{.5}\kern\z@
+ \d@llarbegin
+ \insert@column
+ \d@llarend\hskip\stretch{.5}\or
+ \d@llarbegin \insert@column \d@llarend \hfill \or
+ \hfill\kern\z@ \d@llarbegin \insert@column \d@llarend \or
+ \@startvcenter
+ \@startpbox{\@nextchar}\insert@column \@endpbox $\or % $
+ \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
+ \vbox \@startpbox{\@nextchar}\insert@column \@endpbox
+ \fi
+ \egroup\egroup
+ \begingroup
+ \CT@setup
+ \CT@column@color
+ \CT@row@color
+ \CT@do@color
+ \endgroup
+ \@tempdima\ht\z@
+ \advance\@tempdima\minrowclearance
+ \vrule\@height\@tempdima\@width\z@
+ \unhbox\z@}%
+ \prepnext@tok}%
+ }
+ {%
+ \def\@classz{\@classx
+ \@tempcnta \count@
+ \prepnext@tok
+ \@addtopreamble{\ifcase \@chnum
+ \hfil
+ \d@llarbegin
+ \insert@column
+ \d@llarend \hfil \or
+ \hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or
+ \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \or
+ \@startvcenter
+ \@startpbox{\@nextchar}\insert@column \@endpbox $\or % $
+ \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
+ \vbox \@startpbox{\@nextchar}\insert@column \@endpbox
+ \fi}\prepnext@tok}%
+ }
+ \DeclareRobustCommand\@startvcenter{\everymath{}$\everymath{\color{mathcolor}}\vcenter}% $
+ \expandafter\def\expandafter\@mkpream\expandafter#\expandafter1%
+ \expandafter{%
+ \expandafter\let\expandafter\@startvbox\expandafter\relax
+ \@mkpream{#1}}
+ }
+ {%
+ \def\@tabular{\leavevmode \hbox \bgroup \everymath{}$\everymath{\color{mathcolor}}\let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray% $
+ }%
+ }
+ \long\def\@iiiparbox#1#2[#3]#4#5{%
+ \leavevmode
+ \@pboxswfalse
+ \setlength\@tempdima{#4}%
+ \@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
+ \ifx\@empty#2\else\ifx\relax#2\else
+ \setlength\@tempdimb{#2}%
+ \def\@parboxto{to\@tempdimb}%
+ \fi\fi
+ \if#1b\vbox
+ \else\if #1t\vtop
+ \else\ifmmode\vcenter
+ \else\@pboxswtrue \everymath{}$\everymath{\color{mathcolor}}\vcenter
+ \fi\fi\fi
+ \@parboxto{\let\hss\vss\let\unhbox\unvbox
+ \csname bm@#3\endcsname}%
+ \if@pboxsw \m@th$\fi
+ \@end@tempboxa}
+ \let\o@textsuperscript@TP=\textsuperscript
+ \def\textsuperscript#1{{\everymath{}\o@textsuperscript@TP{\everymath{\color{mathcolor}}#1}}}%
+ }% matches \ifthenelse{\boolean{colormath@TP}}{% Yes.
+{% No; keep original definition.
+ \let\origmath=\ensuremath% \origmath needs to have a sensible definition.
+}
+% \end{macrocode}
+%
+% New highlighting and emphasis commands. Most of them have a sensible alternative definition if the colorhighlight
+% option is not given.
+%
+% |\code{<text>}| will display <text> in a `code-like' style (for shell commands or macro names).
+% |\codeswitch| switches to the style used by |\code|, for use e.g. in verbatim environments.
+% \begin{macrocode}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes; code is displayed typewriter-style, bold and in a special color.
+ \DeclareRobustCommand{\code}[1]{\textcolor{codecolor}{\textbf{\texttt{#1}}}}%
+ \DeclareRobustCommand{\codeswitch}{\color{codecolor}\bfseries\ttfamily}%
+ }
+{% No; code is displayed just in typewriter-style and bold.
+ \DeclareRobustCommand{\code}[1]{\textbf{\texttt{#1}}}%
+ \DeclareRobustCommand{\codeswitch}{\bfseries\ttfamily}%
+ }
+% \end{macrocode}
+% \begin{macro}{\macroname}
+% |\macroname{<text>}| acts like |\code|, but adds a backslash in front.
+% \begin{macrocode}
+\newcommand{\macroname}[1]{\code{\textbackslash#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\commandapp}
+% |\commandapp[<opt>]{<name>}{<arg>}| displays a macro with an argument. |<name>| is the macro name, |<opt>| is an optional
+% argument, <arg> is the macro argument. Note that only one pair of braces is added for |<arg>|; for several arguments,
+% |\}\{| needs to be used inside |<arg>| to separate arguments.
+% \begin{macrocode}
+\newcommand{\commandapp}[3][]{\code{\macroname{#2}\ifthenelse{\equal{#1}{}}{}{[#1]}\{#3\}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\carg}
+% |\carg{<text>}| displays a `symbolic argument', i.e. |<text>| in code style enclosed in pointy braces.
+% \begin{macrocode}
+\newcommand{\carg}[1]{\code{\origmath{\left<\code{#1}\right>}}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\underl}
+% |\underl{<text>}| emphasises |<text>| using a special color if the colorhighlight option is given and by boldfacing
+% otherwise.
+% \begin{macrocode}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes;
+ \DeclareRobustCommand{\underl}{\textcolor{underlcolor}}% Use color to highlight.
+ }
+{% No;
+ \DeclareRobustCommand{\underl}{\textbf}% Use bold face.
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\concept}
+% |\concept{<text>}| emphasises |<text>| using a special color if the colorhighlight option is given and by boldfacing
+% otherwise. To be used for emphasizing names of (new) concepts.
+% \begin{macrocode}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes;
+ \DeclareRobustCommand{\concept}{\textcolor{conceptcolor}}% Use color to highlight.
+ }
+{% No;
+ \DeclareRobustCommand{\concept}{\textbf}% Use bold face.
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\inactive}
+% |\inactive{<text>}| emphasises |<text>| using a special color if the colorhighlight option is given. Nothing is done if
+% the option is not given. To be used for `de-emphasizing' things not currently of interest.
+% \begin{macrocode}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes;
+ \DeclareRobustCommand{\inactive}{\textcolor{inactivecolor}}% Use color to highlight.
+ }
+{% No;
+ \DeclareRobustCommand{\inactive}{\monochromeinactive}% Use monochrome default.
+ }
+
+\providecommand{\monochromeinactive}{}% What should \inactive do if colors can't be used? We provide a hook for
+ % user definitions.
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\present}
+% |\present[<opt>]{<text>}| puts its argument into an |\fbox| with coloured background.
+% If |<opt>| is given, it is added to the left of the box without taking any space, i.e. it will overlap text to the left
+% of the box. This addition is useful mainly for adding `constraints' to things presented in a description or center
+% environment.
+% \begin{macrocode}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes; use a colored box.
+ \newcommand{\present}[2][]{\leavevmode\llap{\textbf{\footnotesize#1}\,}\fcolorbox{textcolor}{presentcolor}{#2}}%
+ \newcommand{\mkpbox@TP}[1]{\fcolorbox{presentcolor}{presentcolor}{#1}}% Internal macro for use by \presentbox.
+ }
+{% No; use an \fbox.
+ \newcommand{\present}[2][]{\leavevmode\llap{\textbf{\footnotesize#1}\,}\fbox{#2}}%
+ \newcommand{\mkpbox@TP}[1]{\fbox{#1}}%
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{environment}{presentbox}
+% The presentbox environment creates a coloured patch of width |\linewidth| with a minipage inside. If the
+% colorhighlight option is not given, an |\fbox| containing the minipage is created.
+% \begin{macrocode}
+\newsavebox{\pbox@TP}% Container for the minipage to be boxed.
+\newenvironment{presentbox}%
+{%
+ \par\smallskip% First a small space to separate the area from preceding text.
+ \begin{lrbox}{\pbox@TP}% Save the contents in a minipage inside \pbox@TP.
+ \noindent
+ \begin{minipage}{\linewidth-2\fboxsep-2\fboxrule}% Reduce the width of the minipage to leave space for the frame.
+ \replacecolor{presentcolor}{pagecolor}% If \present is used inside the colored area...
+ }%
+ {%
+ \end{minipage}
+ \end{lrbox}%
+ \noindent\mkpbox@TP{\usebox{\pbox@TP}}% This typesets the saved minipage inside the coloured area.
+ \smallskip% A small space to separate the area from succeding text.
+ \par
+ }
+% \end{macrocode}
+% \end{environment}
+%
+%
+% \subsection{Structured rules, box and page backgrounds}
+%
+% \subsubsection{Structured rules}
+%
+% Some configurable defaults for rules and box backgrounds.
+%
+% Default number of stripes for gradient rules and box backgrounds.
+% \begin{macrocode}
+\newcommand{\rulestripes}{10}
+% \end{macrocode}
+% Default stripe overlap for avoiding `gaps' in color gradients.
+% \begin{macrocode}
+\newcommand{\stripeoverlap}{.15pt}
+% \end{macrocode}
+% Default gradient progression for rules and box backgrounds (single gradients or first part of double gradients).
+% \begin{macrocode}
+\newcommand{\rulefirstgradprogression}{1}
+% \end{macrocode}
+% Default gradient progression for rules and box backgrounds (second part of double gradients).
+% \begin{macrocode}
+\newcommand{\rulesecondgradprogression}{1}
+% \end{macrocode}
+% Default position of the `middle' color of a double gradient.
+% \begin{macrocode}
+\newcommand{\rulegradmidpoint}{.5}
+% \end{macrocode}
+%
+% The following are used internally when making color gradients.
+%
+% \begin{macrocode}
+\newcounter{stripe@TP}
+
+\newcounter{stripes@TP}
+
+\newcommand{\firstgradprogression@TP}{1}
+
+\newcommand{\secondgradprogression@TP}{1}
+
+\newcounter{gradprogression@TP}
+
+\newcommand{\gradmidpoint@TP}{.5}
+% \end{macrocode}
+%
+% Special versions of |\mkfactor| which apply gradient progressions.
+% \begin{macrocode}
+\newcommand{\mkgradfirstfactor@TP}{\mkgradfactor@TP\firstgradprogression@TP}
+
+\newcommand{\mkgradsecondfactor@TP}{\mkgradfactor@TP\secondgradprogression@TP}
+
+\newcommand{\mkgradfactor@TP}[3]% Calculate a factor modified by a `progression' parameter.
+{%
+ \mkfactor{#2}{#3}% Calculate the unmodified factor.
+ \setcounter{gradprogression@TP}{#1}% Factor definition may contain a calc-expression.
+ \ifthenelse{\value{gradprogression@TP}=1}{}% Progression value 1 is neutral.
+ {%
+ \ifthenelse{\value{gradprogression@TP}<0}% `Negative' progression?
+ {% Yes.
+ \@tempcnta-\value{gradprogression@TP}\relax% Complement progression wrt 0.
+ \mkfactor{#2}{1-1pt*\real{#2}}% Complement factor definition wrt 1pt.
+ }
+ {\@tempcnta\value{gradprogression@TP}\relax}% No; Use progression as given.
+ \whiledo{\the\@tempcnta>1}% Calculate (factor definition)^(progression).
+ {\advance\@tempcnta by -1\relax\mkfactor{#2}{\real{#2}*\real{#2}}}%
+ \ifthenelse{\value{gradprogression@TP}<0}% `Negative' progression?
+ {% Yes.
+ \mkfactor{#2}{1-1pt*\real{#2}}% Complement result wrt 1pt.
+ }
+ {}%
+ }%
+}
+% \end{macrocode}
+%
+% \begin{macro}{\vgradrule}
+% |\vgradrule[<stripes>][<startmodel>]{<startcolor>}[<endmodel>]{<endcolor>}[<raise>]{<width>}{<height>}| creates a
+% rule-like object consisting of a vertical color gradient composed of horizontal stripes.
+%
+% The topmost stripe has color |{<startcolor>}|, the bottommost stripe has color |{<endcolor>}|. Inbetween, color changes
+% gradually from top to bottom.
+% The colors are specified exactly as for the |\color| command: if the optional argument |<startmodel>| is given,
+% |<startcolor>| contains an explicit definition of a color from model |<startmodel>|, otherwise |<startcolor>|
+% is the name of a defined color. The same holds for |<endmodel>| and |<endcolor>|.
+%
+% The arguments |[<raise>]{<width>}{<height>}| work exactly as for the |\rule| command.
+%
+% The optional argument |<stripes>|, if given, should contain a (calc expression for a) number specifying the number of
+% stripes. If |<stripes>| is not given, the default is the content of |\rulestripes| (default 10).
+%
+% There is one more parameter which is not given as an argument. The control sequence |\rulefirstgradprogression| should
+% expand to an (calc expression for an) integer. This value (default 1) controls the `order' of progression from
+% |<startcolor>| to |<endcolor>|.
+% The default value 1 means linear progression. 2 means quadratic progression, i.e. color values `nearer' to <endcolor>
+% are reached `later' (the square of 0.5, for instance, is 0.25, i.e. in the geometric middle point of the rule
+% produced, the color gradient will have traveled only to one quarter of the `distance' between |<startcolor>| and
+% |<endcolor>|).
+% 3 means cubic progression and so on. 0 and -1 mean the same as 1. -2 means quadratic progression ``from bottom to
+% top'', i.e. color values `nearer' to |<endcolor>| are reached `earlier', and analogously for -3, -4, ...
+%
+% If you wish to give the second optional argument but not the first, just write |\vgradrule[][<startmodel>]|...
+%
+% \begin{macrocode}
+\newcommand{\vgradrule}[1][]% Pick up first optional argument: [<stripes>]
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameter for rules.
+ \ifthenelse{\equal{#1}{}}% First optional argument given?
+ {\setcounter{stripes@TP}{\rulestripes}}% No; use default value.
+ {\setcounter{stripes@TP}{#1}}% Yes.
+ \vgradrule@TP% Pick up [<startmodel>]{<startcolor>}.
+}
+
+\newcommand{\vgradrule@TP}[2][]% Pick up next pair of arguments: [<startmodel>]{<startcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}% <startmodel> given?
+ {\replacecolor{startcolor@TP}{#2}}% No; <startcolor> is a color name.
+ {\definecolor{startcolor@TP}{#1}{#2}}% Yes; {<startmodel>}{<startcolor>} is a color definition.
+ \@vgradrule@TP% Pick up [<endmodel>]{<endcolor>}.
+}
+
+\newcommand{\@vgradrule@TP}[2][]% Pick up next pair of arguments: [<endmodel>]{<endcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{endcolor@TP}{#2}}
+ {\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@vgradrule@TP% Pick up rule arguments and proceed.
+}
+% \end{macrocode}
+% Helper command for making \textbf{one} stripe. Can be overladed for making histograms.
+% \begin{macrocode}
+\newcommand{\hstripe@TP}[4]%
+{\hbox{{\setcolor@TP{stripecolor@TP}\rule{#2}{#3}}}#4}
+% \end{macrocode}
+% Main part of |\vgradrule|.
+% \begin{macrocode}
+\newcommand{\@@vgradrule@TP}[3][0pt]%
+{%
+ \ifthenelse{\value{stripes@TP}<2}% A `pathological case' which can happen in animations: If 0 or 1 stripes are
+ % requested, a division by zero error would be produced by the gradient code.
+ {\mbox{{\setcolor@TP{startcolor@TP}\rule[#1]{#2}{#3}}}}% In this case, just produce a colored rule.
+ {%
+ \raisebox{#1}% Evaluate the <raise> argument of the rule.
+ {%
+ \vbox% A vbox with \offinterlineskip allows to align the stripes vertically.
+ {%
+ \offinterlineskip
+ \setcounter{stripe@TP}{0}% Initialize the number of the current stripe.
+ \whiledo{\value{stripe@TP}<\value{stripes@TP}}
+ {%
+ \mkgradfirstfactor@TP{\tmp@TP}% Make the weight for \colorbetween, based on the number of the current stripe
+ {\value{stripe@TP}/(\value{stripes@TP}-1)}% and the first gradient progression.
+ \colorbetween[\tmp@TP]{stripecolor@TP}{endcolor@TP}{startcolor@TP}% Calculate stripe color.
+ \stepcounter{stripe@TP}%
+ \ifthenelse{\value{stripe@TP}=\value{stripes@TP}}% Last stripe?
+ {\hstripe@TP{\tmp@TP}{#2}{(#3)/\value{stripes@TP}}{}}% Yes; make stripe w/o overlap.
+ {% No; add a kern to make stripes overlap.
+ \hstripe@TP{\tmp@TP}{#2}{(#3)/\value{stripes@TP}+\stripeoverlap}{\kern-\stripeoverlap}%
+ }%
+ }% matches \whiledo{\value{stripe@TP}<\value{stripes@TP}}{%
+ }% matches \vbox{%
+ }% matches \raisebox{#1}{%
+ }% matches second argument of \ifthenelse{\value{stripes@TP}<2}
+ }% matches \newcommand{\@@vgradrule@TP}[3][0pt]{%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\dblvgradrule}
+% |\dblvgradrule[<midpoint>][<stripes>][<startmodel>]|\\
+% | {<startcolor>}[<midmodel>]{<midcolor>}[<endmodel>]|\\
+% | {<endcolor>}[<raise>]{<width>}{<height>}|
+% creates a rule-like object consisting of a vertical color gradient composed of horizontal stripes.
+%
+% The behaviour is exactly like |\vgradrule|, only in addition to the defined `start' and `end' color, there is an
+% additional defined `middle' color. The color gradient first progresses from the start to the middle color and then
+% from the middle to the end color.
+%
+% |[<midmodel>]{<midcolor>}| specify the middle color exactly as described for the other colors in the description of
+% |\vgradrule|.
+%
+% The additional optional parameter |<midpoint>| is a fixed-point value specifying where in the produced gradient the
+% middle color is placed. 0 means the middle color replaces the start color; 1 means the middle color replaces the end
+% color; 0.5 means the middle color is placed in the geometric middle between start and end color. If |<midpoint>| is not
+% given, the default is the content of |\rulegradmidpoint| (default 0.5).
+%
+% There is another parameter not passed as an argument: while |\rulefirstgradprogression| specifies the order of
+% progression from first to middle color as described for |\vgradrule|, |\rulesecondgradprogression| specifies the order of
+% progression from middle to end color.
+%
+% If you wish to give one from the first row of optional arguments but not the other(s), any one can be replaced by |[]|
+% to use the default.
+%
+% \begin{macrocode}
+\newcommand{\dblvgradrule}[1][]% Pick up first optional argument: [<midpoint>]
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameters for rules.
+ \let\secondgradprogression@TP=\rulesecondgradprogression
+ \ifthenelse{\equal{#1}{}}% First optional argument given?
+ {\let\gradmidpoint@TP=\rulegradmidpoint}% No; use default value.
+ {\def\gradmidpoint@TP{#1}}% Yes.
+ \dblvgradrule@TP% Pick up second optional argument.
+}
+
+\newcommand{\dblvgradrule@TP}[1][]% Pick up second optional argument: [<stripes>]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\setcounter{stripes@TP}{\rulestripes}}
+ {\setcounter{stripes@TP}{#1}}%
+ \@dblvgradrule@TP
+}
+
+\newcommand{\@dblvgradrule@TP}[2][]% Pick up next pair of arguments: [<startmodel>]{<startcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{startcolor@TP}{#2}}
+ {\definecolor{startcolor@TP}{#1}{#2}}%
+ \@@dblvgradrule@TP
+}
+
+\newcommand{\@@dblvgradrule@TP}[2][]% Pick up next pair of arguments: [<midmodel>]{<midcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{midcolor@TP}{#2}}
+ {\definecolor{midcolor@TP}{#1}{#2}}%
+ \@@@dblvgradrule@TP
+}
+
+\newcommand{\@@@dblvgradrule@TP}[2][]% Pick up next pair of arguments: [<endmodel>]{<endcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{endcolor@TP}{#2}}
+ {\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@@@dblvgradrule@TP% Pick up rule arguments and proceed.
+}
+
+\newcommand{\@@@@dblvgradrule@TP}[3][0pt]% Main part of \dblvgradrule.
+{%
+ \ifthenelse{\value{stripes@TP}<2}% The gradient code is not equipped for making less than 2 stripes.
+ {\mbox{{\setcolor@TP{midcolor@TP}\rule[#1]{#2}{#3}}}}% In this case, just produce a rule colored with the middle color.
+ {%
+ \raisebox{#1}% Evaluate the <raise> argument of the rule.
+ {%
+ \vbox% A vbox with \offinterlineskip allows to align the stripes
+ {% vertically.
+ \offinterlineskip
+ \setcounter{stripe@TP}{0}% Initialize the number of the current stripe.
+ \setcounter{tmpcnta@TP}% Number of the `middle' stripe.
+ {\value{stripes@TP}*\real{\gradmidpoint@TP}}%
+ \whiledo{\value{stripe@TP}<\value{tmpcnta@TP}}% Produce the upper part of the gradient.
+ {%
+ \mkgradfirstfactor@TP{\tmp@TP}% Make the weight for \colorbetween, based on the number of the
+ {\value{stripe@TP}/\value{tmpcnta@TP}}% current stripe and the first gradient progression.
+ \colorbetween[\tmp@TP]{stripecolor@TP}{midcolor@TP}{startcolor@TP}% Calculate stripe color.
+ \hstripe@TP{\tmp@TP}% Make stripe with overlap.
+ {#2}{(#3)/\value{stripes@TP}+\stripeoverlap}{\kern-\stripeoverlap}% This is the upper part, remember?
+ \stepcounter{stripe@TP}%
+ }%
+ \stepcounter{tmpcnta@TP}%
+ \ifthenelse{\value{stripes@TP}=\value{tmpcnta@TP}}% Only one stripe left to produce?
+ {\hstripe@TP{1}{#2}{(#3)/\value{stripes@TP}}{}}% Just produce one stripe colored with the end color.
+ {%
+ \whiledo{\value{stripe@TP}<\value{stripes@TP}}% Produce the lower part of the gradient.
+ {%
+ \mkgradsecondfactor@TP{\tmp@TP}% Make the weight for \colorbetween.
+ {(\value{stripe@TP}-\value{tmpcnta@TP}+1)/(\value{stripes@TP}-\value{tmpcnta@TP})}%
+ \colorbetween[\tmp@TP]{stripecolor@TP}{endcolor@TP}{midcolor@TP}% Calculate stripe color.
+ \stepcounter{stripe@TP}%
+ \ifthenelse{\value{stripe@TP}=\value{stripes@TP}}% Last stripe?
+ {\hstripe@TP{\tmp@TP}{#2}{(#3)/\value{stripes@TP}}{}}% Yes; make stripe w/o overlap.
+ {% No; add kern to make stripes overlap.
+ \hstripe@TP{\tmp@TP}{#2}{(#3)/\value{stripes@TP}+\stripeoverlap}{\kern-\stripeoverlap}%
+ }%
+ }% matches \whiledo{\value{stripe@TP}<\value{stripes@TP}}%
+ }% matches second argument of \ifthenelse{\value{stripes@TP}=\value{tmpcnta@TP}}%
+ }% matches \vbox{%
+ }% matches \raisebox{#1}{%
+ }% matches second argument of \ifthenelse{\value{stripes@TP}<2}%
+ }% matches \newcommand{\@@@@dblvgradrule@TP}[3][0pt]%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hgradrule}
+% |\hgradrule[<stripes>][<startmodel>]{<startcolor>}|\\
+% | [<endmodel>]{<endcolor>}[<raise>]{<width>}{<height>}| creates a
+% rule-like object consisting of a horizontal color gradient composed of vertical stripes.
+%
+% Parameters are exactly as those for |\vgradrule| (replacing `top' by `left' and `bottom' by `right'). See there for
+% explanations.
+%
+% \begin{macrocode}
+\newcommand{\hgradrule}[1][]% Pick up first optional argument: [<stripes>].
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameter for rules.
+ \ifthenelse{\equal{#1}{}}% First optional argument given?
+ {\setcounter{stripes@TP}{\rulestripes}}% No; use default value.
+ {\setcounter{stripes@TP}{#1}}% Yes.
+ \hgradrule@TP% Pick up [<startmodel>]{<startcolor>}.
+}
+
+\newcommand{\hgradrule@TP}[2][]% Pick up next pair of arguments: [<startmodel>]{<startcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{startcolor@TP}{#2}}
+ {\definecolor{startcolor@TP}{#1}{#2}}%
+ \@hgradrule@TP
+}
+
+\newcommand{\@hgradrule@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{endcolor@TP}{#2}}
+ {\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@hgradrule@TP% Pick up rule arguments and proceed.
+}
+
+\newcommand{\vstripe@TP}[4]% Helper command for making _one_ stripe. Can be overladed for making historams.
+{{\setcolor@TP{stripecolor@TP}\rule{#2}{#3}#4}}
+
+\newcommand{\@@hgradrule@TP}[3][0pt]% Main part of \hgradrule.
+{%
+ \ifthenelse{\value{stripes@TP}<2}% A `pathological case' which can happen in animations: If 0 or 1 stripes are
+ % requested, a division by zero error would be produced by the gradient code.
+ {\mbox{{\setcolor@TP{startcolor@TP}\rule[#1]{#2}{#3}}}}% In this case, just produce a colored rule.
+ {%
+ \raisebox{#1}% Evaluate the <raise> argument of the rule.
+ {%
+ \setcounter{stripe@TP}{0}% Initialize the number of the current stripe.
+ \whiledo{\value{stripe@TP}<\value{stripes@TP}}
+ {%
+ \mkgradfirstfactor@TP{\tmp@TP}% Make the weight for \colorbetween, based on the number of the current stripe
+ {\value{stripe@TP}/(\value{stripes@TP}-1)}% and the first gradient progression.
+ \colorbetween[\tmp@TP]{stripecolor@TP}{endcolor@TP}{startcolor@TP}% Calculate stripe color.
+ \stepcounter{stripe@TP}%
+ \ifthenelse{\value{stripe@TP}=\value{stripes@TP}}% Last stripe?
+ {\vstripe@TP{\tmp@TP}{(#2)/\value{stripes@TP}}{#3}{}}% Yes; make stripe w/o overlap.
+ {% No; add a kern to make stripes overlap.
+ \vstripe@TP{\tmp@TP}{(#2)/\value{stripes@TP}+\stripeoverlap}{#3}{\kern-\stripeoverlap}%
+ }%
+ }% matches \whiledo{\value{stripe@TP}<\value{stripes@TP}}{%
+ }% matches \raisebox{#1}{%
+ }% matches second argument of \ifthenelse{\value{stripes@TP}<2}%
+ }% matches \newcommand{\@@hgradrule@TP}[3][0pt]{%
+% \end{macrocode}
+% \end{macro}
+
+% \begin{macro}{\dblhgradrule}
+% |\dblhgradrule[<midpoint>][<stripes>][<startmodel>]|\\
+% | {<startcolor>}[<midmodel>]{<midcolor>}[<endmodel>]|\\
+% | {<endcolor>}[<raise>]{<width>}{<height>}|
+% creates a rule-like object consisting of a horizontal color gradient composed of vertical stripes.
+%
+% Parameters are exactly as those for |\dblvgradrule| (replacing `top' by `left' and `bottom' by `right'). See there for
+% explanations.
+%
+% \begin{macrocode}
+\newcommand{\dblhgradrule}[1][]% Pick up first optional argument: [<midpoint>].
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameters for rules.
+ \let\secondgradprogression@TP=\rulesecondgradprogression
+ \ifthenelse{\equal{#1}{}}{\let\gradmidpoint@TP=\rulegradmidpoint}{\def\gradmidpoint@TP{#1}}%
+ \dblhgradrule@TP
+}
+
+\newcommand{\dblhgradrule@TP}[1][]% Pick up second optional argument: [<stripes>].
+{%
+ \ifthenelse{\equal{#1}{}}{\setcounter{stripes@TP}{\rulestripes}}{\setcounter{stripes@TP}{#1}}%
+ \@dblhgradrule@TP
+}
+
+\newcommand{\@dblhgradrule@TP}[2][]% Pick up next pair of arguments: [<startmodel>]{<startcolor>}.
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{startcolor@TP}{#2}}{\definecolor{startcolor@TP}{#1}{#2}}%
+ \@@dblhgradrule@TP
+}
+
+\newcommand{\@@dblhgradrule@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{midcolor@TP}{#2}}{\definecolor{midcolor@TP}{#1}{#2}}%
+ \@@@dblhgradrule@TP
+}
+
+\newcommand{\@@@dblhgradrule@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\replacecolor{endcolor@TP}{#2}}
+ {\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@@@dblhgradrule@TP% Pick up rule arguments and proceed.
+}
+
+\newcommand{\@@@@dblhgradrule@TP}[3][0pt]% Main part of \dblhgradrule.
+{%
+ \ifthenelse{\value{stripes@TP}<2}% The gradient code is not equipped for making less than 2 stripes.
+ {\mbox{{\setcolor@TP{midcolor@TP}\rule[#1]{#2}{#3}}}}% In this case, just produce a rule colored with the middle color.
+ {%
+ \raisebox{#1}% Evaluate the <raise> argument of the rule.
+ {%
+ \setcounter{stripe@TP}{0}% Initialize the number of the current stripe.
+ \setcounter{tmpcnta@TP}% Number of the `middle' stripe.
+ {\value{stripes@TP}*\real{\gradmidpoint@TP}}%
+ \whiledo{\value{stripe@TP}<\value{tmpcnta@TP}}% Produce the left part of the gradient.
+ {%
+ \mkgradfirstfactor@TP{\tmp@TP}% Make the weight for \colorbetween, based on the number of the
+ {\value{stripe@TP}/\value{tmpcnta@TP}}% current stripe and the first gradient progression.
+ \colorbetween[\tmp@TP]{stripecolor@TP}{midcolor@TP}{startcolor@TP}% Calculate stripe color.
+ \vstripe@TP{\tmp@TP}% Make stripe with overlap.
+ {(#2)/\value{stripes@TP}+\stripeoverlap}{#3}{\kern-\stripeoverlap}% This is the left part, remember?
+ \stepcounter{stripe@TP}%
+ }%
+ \stepcounter{tmpcnta@TP}%
+ \ifthenelse{\value{stripes@TP}=\value{tmpcnta@TP}}% Only one stripe left to produce?
+ {\vstripe@TP{1}{(#2)/\value{stripes@TP}}{#3}{}}% Just produce one stripe colored with the end color.
+ {%
+ \whiledo{\value{stripe@TP}<\value{stripes@TP}}% Produce the right part of the gradient.
+ {%
+ \mkgradsecondfactor@TP{\tmp@TP}% Make the weight for \colorbetween.
+ {(\value{stripe@TP}-\value{tmpcnta@TP})/(\value{stripes@TP}-\value{tmpcnta@TP}-1)}%
+ \colorbetween[\tmp@TP]{stripecolor@TP}{endcolor@TP}{midcolor@TP}% Calculate stripe color.
+ \stepcounter{stripe@TP}%
+ \ifthenelse{\value{stripe@TP}=\value{stripes@TP}}% Last stripe?
+ {\vstripe@TP{\tmp@TP}{(#2)/\value{stripes@TP}}{#3}{}}% Yes; make stripe w/o overlap.
+ {% Add kern to make stripes overlap.
+ \vstripe@TP{\tmp@TP}{(#2)/\value{stripes@TP}+\stripeoverlap}{#3}{\kern-\stripeoverlap}%
+ }%
+ }% matches \whiledo{\value{stripe@TP}<\value{stripes@TP}}{%
+ }% matches second argument of \ifthenelse{\value{stripes@TP}=\value{tmpcnta@TP}}%
+ }% matches \raisebox{#1}{%
+ }% matches second argument of \ifthenelse{\value{stripes@TP}<2}%
+ }% matches \newcommand{\@@@@dblhgradrule@TP}[3][0pt]{%
+% \end{macrocode}
+% \end{macro}
+%
+% Clipbox stuff. The first part isn't used currently.
+% \begin{macrocode}
+% PDF:
+% \def\clipbox{\@ifnextchar[{\clipbox@}{\clipbox@[0pt]}}
+% \def\clipbox@[#1]#2{%
+% \begingroup
+% \setlength{\@tempdima}{#1}%
+% \setbox\@tempboxa=\hbox{%
+% \color@begingroup
+% #2%
+% \color@endgroup
+% }%
+% \leavevmode\hbox to \wd\@tempboxa{%
+% \@ifundefined{dimexpr}{%
+% \@defbp\x{-\@tempdima}%
+% \@tempdimc=\dp\@tempboxa
+% \advance\@tempdimc by \@tempdima
+% \@defbp\y{-\@tempdimc}%
+% \@tempdimc=\wd\@tempboxa
+% \advance\@tempdimc by 2\@tempdima
+% \@defbp\w{\@tempdimc}%
+% \@tempdimc=\dp\@tempboxa
+% \advance\@tempdimc by \ht\@tempboxa
+% \advance\@tempdimc by 2\@tempdima
+% \@defbp\h{\@tempdimc}%
+% \pdfliteral{%
+% q % gsave
+% \x\space\y\space\w\space\h\space re % rectangle
+% W n% make clip-path
+% }%
+% }{% e-TeX
+% \pdfliteral{%
+% q % gsave
+% \@dimtobp{-\@tempdima} % x
+% \@dimtobp{-\dp\@tempboxa-\@tempdima} % y
+% \@dimtobp{\wd\@tempboxa+2\@tempdima} % width
+% \@dimtobp{\dp\@tempboxa+\ht\@tempboxa+2\@tempdima} % height
+% re % rectangle
+% W n% make clip-path
+% }%
+% }%
+% \rlap{\unhbox\@tempboxa}%
+% \pdfliteral{%
+% Q% grestore
+% }%
+% \hss
+% }%
+% \endgroup
+% }
+% \begingroup\expandafter\expandafter\expandafter\endgroup
+% \expandafter\ifx\csname dimexpr\endcsname\relax
+% \def\@defbp#1#2{%
+% \setlength{\@tempdimb}{#2}%
+% \setlength{\@tempdimb}{.99626401\@tempdimb}%
+% \edef#1{\strip@pt\@tempdimb}%
+% }
+% \else
+% \def\@dimtobp#1{%
+% \strip@pt\dimexpr.99626401\dimexpr#1\relax\relax
+% }
+% \fi
+%
+% PS:
+% \def\clipbox{\@ifnextchar[{\clipbox@}{\clipbox@[0pt]}}
+% \def\clipbox@[#1]#2{%
+% \begingroup
+% \setlength{\@tempdima}{#1}%
+% \setbox\@tempboxa=\hbox{%
+% \color@begingroup
+% #2%
+% \color@endgroup
+% }%
+% \leavevmode\hbox to \wd\@tempboxa{%
+% \@ifundefined{dimexpr}{%
+% \@defpt\x{-\@tempdima}%
+% \@tempdimc=\ht\@tempboxa
+% \advance\@tempdimc by \@tempdima
+% \@defpt\y{-\@tempdimc}%
+% \@tempdimc=\wd\@tempboxa
+% \advance\@tempdimc by 2\@tempdima
+% \@defpt\w{\@tempdimc}%
+% \@tempdimc=\dp\@tempboxa
+% \advance\@tempdimc by \ht\@tempboxa
+% \advance\@tempdimc by 2\@tempdima
+% \@defpt\h{\@tempdimc}%
+% \special{ps:%
+% gsave %
+% SDict begin %
+% \x\space PTtoDVIPS \y\space PTtoDVIPS rmoveto %
+% currentpoint %
+% \w\space PTtoDVIPS \h\space PTtoDVIPS rectclip %
+% end%
+% }%
+% }{% e-TeX
+% \special{ps:%
+% gsave %
+% SDict begin %
+% \@dimtopt{-\@tempdima} PTtoDVIPS % x
+% \@dimtopt{-\ht\@tempboxa-\@tempdima} PTtoDVIPS % y
+% rmoveto currentpoint %
+% \@dimtopt{\wd\@tempboxa+2\@tempdima} PTtoDVIPS % width
+% \@dimtopt{\dp\@tempboxa+\ht\@tempboxa+2\@tempdima} %
+% PTtoDVIPS % height
+% rectclip %
+% end%
+% }%
+% }%
+% \rlap{\unhbox\@tempboxa}%
+% \special{ps:grestore}%
+% \hss
+% }%
+% \endgroup
+% }
+% \special{!%
+% /PTtoDVIPS{72.27 div Resolution mul}def%
+% % rectclip is a level 2 feature
+% /rectclip where{pop}{%
+% /rectclip{%
+% newpath %
+% 4 2 roll moveto %
+% exch dup 0 rlineto %
+% exch 0 exch rlineto %
+% neg 0 rlineto %
+% closepath %
+% clip %
+% newpath %
+% }bind def%
+% }%
+% ifelse%
+% }
+% \begingroup\expandafter\expandafter\expandafter\endgroup
+% \expandafter\ifx\csname dimexpr\endcsname\relax
+% \def\@defpt#1#2{%
+% \setlength{\@tempdimb}{#2}%
+% \edef#1{\strip@pt\@tempdimb}%
+% }
+% \else
+% \def\@dimtopt#1{%
+% \strip@pt\dimexpr#1\relax
+% }
+% \fi
+
+
+\ifpdf
+ \providecommand{\clipbox}[2][\z@]
+ {%
+ \setlength{\@tempdima}{#1}%
+ \setbox\@tempboxa=
+ \hbox{\kern\@tempdima\vbox{\offinterlineskip\kern\@tempdima\hbox{#2}\kern\@tempdima}\kern\@tempdima}%
+ \pdfxform\@tempboxa
+ \leavevmode
+ \hbox
+ {%
+ \kern-\@tempdima
+ \vbox{\offinterlineskip\kern-\@tempdima\hbox{\pdfrefxform\pdflastxform}\kern-\@tempdima}%
+ \kern-\@tempdima
+ }%
+ }
+ \else
+ \providecommand{\clipbox}[2][\z@]{\leavevmode\hbox{#2}}
+\fi
+% \end{macrocode}
+%
+% |\dgradslope| stuff.
+% \begin{macrocode}
+\newcommand{\dgradslope}{1,1}
+
+\newcounter{dgradhslope@TP}
+
+\newcounter{dgradvslope@TP}
+
+\def\setdgradslope(#1,#2){\setcounter{dgradhslope@TP}{#1}\setcounter{dgradvslope@TP}{#2}}
+% \end{macrocode}
+%
+% |\dgradrule| stuff.
+% \begin{macrocode}
+\newcommand{\dgradrule}[1][]
+{%
+ \ifthenelse{\equal{#1}{}}{\expandafter\setdgradslope\expandafter(\dgradslope)}{\setdgradslope(#1)}%
+ \dgradrule@TP
+}
+
+\newcommand{\dgradrule@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{startcolor@TP}{#2}}{\definecolor{startcolor@TP}{#1}{#2}}%
+ \@dgradrule@TP
+}
+
+\newcommand{\@dgradrule@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{endcolor@TP}{#2}}{\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@dgradrule@TP
+}
+
+\newcommand{\dstripewd@TP}{.7pt}
+
+\newcommand{\@@dgradrule@TP}[3][0pt]
+{%
+ \raisebox{#1}
+ {%
+ \thicklines
+ \setcounter{stripe@TP}{0}%
+ \setcounter{tmpcnta@TP}{1*\ratio{#3}{\dstripewd@TP}}%
+ \setcounter{stripes@TP}{1*\ratio{#3}{\dstripewd@TP}+1*\ratio{#2}{\dstripewd@TP}}%
+ \@xarg\c@dgradhslope@TP\@yarg\c@dgradvslope@TP
+ \makebox[\dstripewd@TP]
+ {%
+ \whiledo{\value{stripe@TP}<\value{tmpcnta@TP}}
+ {%
+ \mkfactor{\tmp@TP}{\value{stripe@TP}/(\value{stripes@TP}-1)}%
+ \colorbetween[\tmp@TP]{stripecolor@TP}{endcolor@TP}{startcolor@TP}%
+ \setlength{\@linelen}{\dstripewd@TP*\value{stripe@TP}}%
+ \raisebox{\dstripewd@TP*(\value{tmpcnta@TP}-\value{stripe@TP})}
+ {\makebox[0pt]{{\setcolor@TP{stripecolor@TP}\hbox to 0pt{\@sline\hss}}}}%
+ \stepcounter{stripe@TP}%
+ }%
+ }%
+ \whiledo{\value{stripe@TP}<\value{stripes@TP}}
+ {%
+ \mkfactor{\tmp@TP}{\value{stripe@TP}/(\value{stripes@TP}-1)}%
+ \colorbetween[\tmp@TP]{stripecolor@TP}{endcolor@TP}{startcolor@TP}%
+ \makebox[\dstripewd@TP]{{\setcolor@TP{stripecolor@TP}.}}%
+ \stepcounter{stripe@TP}%
+ }%
+ }%
+ }%
+% \end{macrocode}
+%
+% \subsubsection{Structured box backgrounds}
+%
+% \begin{macro}{\vgradbox}
+% |\vgradbox[<stripes>][<startmodel>]{<startcolor>}[<endmodel>]{<endcolor>}{<content>}| creates an mbox containing
+% |<content>|, which has a background made up of a vertical color gradient. In fact, the background exceeds the extent of
+% |<content>| by the value of |\fboxsep| on every side, just like the |\colorbox| command from the color package.
+%
+% The gradient background is constructed using the |\vgradrule| command; see the description of |\vgradrule| on the way the
+% gradient is constructed and on the meaning of the parameters |<stripes>|, |<startmodel>|, |<startcolor>|, |<endmodel>|,
+% |<endcolor>| and the additional parameter |\rulefirstgradprogression| which has the same meaning for |\vgradbox| as for
+% |\vgradrule|.
+%
+% \begin{macrocode}
+\newcommand{\vgradbox}[1][]% Pick up first optional argument: [<stripes>].
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameter for rules.
+ \ifthenelse{\equal{#1}{}}% First optional argument given?
+ {\setcounter{stripes@TP}{\rulestripes}}% No; use default value.
+ {\setcounter{stripes@TP}{#1}}% Yes.
+ \vgradbox@TP% Pick up remaining optional arguments.
+}
+
+\newcommand{\vgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{startcolor@TP}{#2}}{\definecolor{startcolor@TP}{#1}{#2}}%
+ \@vgradbox@TP
+}
+
+\newcommand{\@vgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{endcolor@TP}{#2}}{\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@gradbox@TP\@@vgradrule@TP% Make a generic background box with vertical gradient background.
+}
+
+\newcommand{\@@gradbox@TP}[2]% Generic background box.
+{%
+ \leavevmode% Make box behave like \mbox.
+ \setbox\tempbox@TP
+ \hbox{\kern\fboxsep{\set@color#2}\kern\fboxsep}% An \hbox containing <contents> plus additional white space.
+ \rlap% Underlay box background with rule command passed as #1.
+ {%
+ #1[-\fboxsep-\dp\tempbox@TP]% Box depth augmented by `white' space.
+ {\wd\tempbox@TP}% Space on the sides has already been added.
+ {\ht\tempbox@TP+\dp\tempbox@TP+2\fboxsep}}% Total height.
+ \box\tempbox@TP% Overlay box contents.
+ }%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\hgradbox}
+% |\hgradbox[<stripes>][<startmodel>]{<startcolor>}[<endmodel>]{<endcolor>}{<content>}| acts like |\vgradbox|, but creates
+% the background using |\hgradrule|. See comments above.
+%
+% \begin{macrocode}
+\newcommand{\hgradbox}[1][]
+{%
+ \let\secondgradprogression@TP=\rulesecondgradprogression
+ \ifthenelse{\equal{#1}{}}{\setcounter{stripes@TP}{\rulestripes}}{\setcounter{stripes@TP}{#1}}%
+ \hgradbox@TP
+}
+
+\newcommand{\hgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{startcolor@TP}{#2}}{\definecolor{startcolor@TP}{#1}{#2}}%
+ \@hgradbox@TP
+}
+
+\newcommand{\@hgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{endcolor@TP}{#2}}{\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@gradbox@TP\@@hgradrule@TP
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\dblvgradbox}
+% |\dblvgradbox[<midpoint>][<stripes>][<startmodel>]|\\
+% | {<startcolor>}[<midmodel>]{<midcolor>}[<endmodel>]{<endcolor>}{<contents>}|
+% acts like |\vgradbox|, but creates the background using |\dblvgradrule| (hence the additional parameters). See comments
+% above (and the description of |\dblvgradrule| concerning the meaning of |\dblvgradrule| parameters).
+%
+% \begin{macrocode}
+\newcommand{\dblvgradbox}[1][]
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameters for rules.
+ \let\secondgradprogression@TP=\rulesecondgradprogression
+ \ifthenelse{\equal{#1}{}}{\let\gradmidpoint@TP=\rulegradmidpoint}{\def\gradmidpoint@TP{#1}}%
+ \dblvgradbox@TP
+}
+
+\newcommand{\dblvgradbox@TP}[1][]
+{%
+ \ifthenelse{\equal{#1}{}}{\setcounter{stripes@TP}{\rulestripes}}{\setcounter{stripes@TP}{#1}}%
+ \@dblvgradbox@TP
+}
+
+\newcommand{\@dblvgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{startcolor@TP}{#2}}{\definecolor{startcolor@TP}{#1}{#2}}%
+ \@@dblvgradbox@TP
+}
+
+\newcommand{\@@dblvgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{midcolor@TP}{#2}}{\definecolor{midcolor@TP}{#1}{#2}}%
+ \@@@dblvgradbox@TP
+}
+
+\newcommand{\@@@dblvgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{endcolor@TP}{#2}}{\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@gradbox@TP\@@@@dblvgradrule@TP
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\dblhgradbox}
+% |\dblhgradbox[<midpoint>][<stripes>][<startmodel>]|\\
+% | {<startcolor>}[<midmodel>]{<midcolor>}[<endmodel>]{<endcolor>}{<contents>}|
+% acts like |\dblvgradbox|, but creates the background using |\dblhgradrule|. See comments above.
+%
+% \begin{macrocode}
+\newcommand{\dblhgradbox}[1][]
+{%
+ \let\firstgradprogression@TP=\rulefirstgradprogression
+ \let\secondgradprogression@TP=\rulesecondgradprogression
+ \ifthenelse{\equal{#1}{}}{\let\gradmidpoint@TP=\rulegradmidpoint}{\def\gradmidpoint@TP{#1}}%
+ \dblhgradbox@TP
+}
+
+\newcommand{\dblhgradbox@TP}[1][]
+{%
+ \ifthenelse{\equal{#1}{}}{\setcounter{stripes@TP}{\rulestripes}}{\setcounter{stripes@TP}{#1}}%
+ \@dblhgradbox@TP
+}
+
+\newcommand{\@dblhgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{startcolor@TP}{#2}}{\definecolor{startcolor@TP}{#1}{#2}}%
+ \@@dblhgradbox@TP
+}
+
+\newcommand{\@@dblhgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{midcolor@TP}{#2}}{\definecolor{midcolor@TP}{#1}{#2}}%
+ \@@@dblhgradbox@TP
+}
+
+\newcommand{\@@@dblhgradbox@TP}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}{\replacecolor{endcolor@TP}{#2}}{\definecolor{endcolor@TP}{#1}{#2}}%
+ \@@gradbox@TP\@@@@dblhgradrule@TP
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Structured page backgrounds}
+%
+% \begin{macro}{\backgroundstyle}
+% |\backgroundstyle[<options>]{<style>}| is the central command for structured page backgrounds. It works like |\pagestyle|
+% and other commands of this type. This means |<style>| is a symbolic name specifying the general method by which the page
+% background is constructed.
+% The detailed construction is influenced by parameters which can be set in |<options>|. If given, the optional parameter
+% |<options>| should contain a list of settings in ``keyval'' manner. The keyval method (which is used by the
+% |\includegraphics| command from the graphicx package, for instance) is based on associating a symbolic name with every
+% parameter. |<options>| is then a comma-separated list of parameter settings of the form |<name>=<value>|, where |<name>| is
+% the symbolic name of the parameter to be set and |<value>| is the value it is to be set to.
+% Not every |<style>| evaluates every parameter. In the following, a description of all styles, together with lists of the
+% parameters employed, is given. It is followed by a list of all parameters.
+% Note that some parameter names internally access the same parameter. For instance, parameters startcolor and
+% startcolordef both set the start color of a color gradient. In case of conflict, the last setting in the list
+% |<options>| will prevail. It is noted in the list of parameters which other parameters are overwritten.
+%
+% |<style>| may have one of the following values:
+%
+% \begin{longtable}{@{}lp{0.5\textwidth}}
+% none & No background. This means the page background is whatever it would be if |\backgroundstyle| wasn't used at all
+% (for instance, a plain area of color pagecolor if one of the color options has been given).
+% Parameters used: none. \\
+% plain & Plain background. This means the page background is whatever it would be if |\backgroundstyle| wasn't used at all
+% (for instance, a plain area of color pagecolor if one of the color options has been given). In addition to
+% background style ``none'', the background style ``plain'' does produce panel backgrounds. The colors and
+% dimensions of a ``top panel'', ``bottom panel'', ``left panel'', and ``right panel'' can be specified.
+%
+% Parameters used: hpanels, autopanels, toppanelcolor, bottompanelcolor, leftpanelcolor, rightpanelcolor,
+% toppanelcolordef, bottompanelcolordef, leftpanelcolordef, rightpanelcolordef,
+% toppanelheight, bottompanelheight, leftpanelwidth, rightpanelwidth.\\
+% vgradient & Vertical gradient. The page background is constructed using the |\vgradrule| command.
+% In addition to the usual parameters of gradient rules, the vgradient background style allows to leave
+% space for headers, footers, or panels. The colors and dimensions of a ``top panel'', ``bottom panel'',
+% ``left panel'', and ``right panel'' can be specified. The gradient rule fills the rectangular space left
+% between the specified panels.
+%
+% Parameters used: stripes, firstgradprogression, startcolor, startcolordef, endcolor, endcolordef,
+% hpanels, autopanels,
+% toppanelcolor, bottompanelcolor, leftpanelcolor, rightpanelcolor,
+% toppanelcolordef, bottompanelcolordef, leftpanelcolordef, rightpanelcolordef,
+% toppanelheight, bottompanelheight, leftpanelwidth, rightpanelwidth.\\
+% hgradient & Horizontal gradient. The page background is constructed using the |\hgradrule| command.
+% See the description of vgradient concerning panels.
+%
+% Parameters used: stripes, firstgradprogression, startcolor, startcolordef, endcolor, endcolordef,
+% hpanels, autopanels,
+% toppanelcolor, bottompanelcolor, leftpanelcolor, rightpanelcolor,
+% toppanelcolordef, bottompanelcolordef, leftpanelcolordef, rightpanelcolordef,
+% toppanelheight, bottompanelheight, leftpanelwidth, rightpanelwidth.\\
+% doublevgradient & `Double' vertical gradient. The page background is constructed using the |\dblvgradrule| command.
+% See the description of vgradient concerning panels.
+%
+% Parameters used: stripes, gradmidpoint, firstgradprogression, secondgradprogression,
+% startcolor, startcolordef, midcolor, midcolordef, endcolor, endcolordef,
+% hpanels, autopanels,
+% toppanelcolor, bottompanelcolor, leftpanelcolor, rightpanelcolor,
+% toppanelcolordef, bottompanelcolordef, leftpanelcolordef, rightpanelcolordef,
+% toppanelheight, bottompanelheight, leftpanelwidth, rightpanelwidth.\\
+% doublehgradient & `Double' horizontal gradient. The page background is constructed using the |\dblhgradrule| command.
+% See the description of vgradient concerning panels.
+%
+% Parameters used: stripes, gradmidpoint, firstgradprogression, secondgradprogression,
+% startcolor, startcolordef, midcolor, midcolordef, endcolor, endcolordef,
+% hpanels, autopanels,
+% toppanelcolor, bottompanelcolor, leftpanelcolor, rightpanelcolor,
+% toppanelcolordef, bottompanelcolordef, leftpanelcolordef, rightpanelcolordef,
+% toppanelheight, bottompanelheight, leftpanelwidth, rightpanelwidth.
+% \end{longtable}
+%
+% Now, a list of all parameters and their meaning. In the following,
+%
+% \begin{longtable}{@{}lp{0.5\textwidth}}
+% |<n>| & denotes a (calc expression for a) nonnegative integer\\
+% |<i>| & denotes a (calc expression for an) integer\\
+% |<r>| & denotes a fixed-point number\\
+% |<l>| & denotes a (calc expression for a) length\\
+% |<c>| & denotes the name of a defined color\\
+% |<cm>|& denotes a valid color model name (in the sense of the color package)\\
+% |<cd>|& denotes a valid color definition (in the sense of the color package) wrt a given |<cm>| parameter\\
+% |<t>| & denotes a `truth value' in the sense of the ifthen package: either true or false. As usual for keyval,
+% if |=<t>| is omitted, the default true is assumed.
+% \end{longtable}
+%
+% \begin{longtable}{@{}lp{0.5\textwidth}}
+% Parameter & Meaning\\
+%
+% |stripes=<n>| & Set the |<stripes>| parameter of gradient rules to |<n>|.
+% Default: |\bgndstripes|
+% Used by: vgradient, hgradient, doublevgradient, doublehgradient\\
+%
+% |gradmidpoint=<r>| & Set the |<midpoint>| parameter of double gradient rules to |<r>|.
+% Default: |\bgndgradmidpoint|
+% Used by: doublevgradient, doublehgradient\\
+%
+% |firstgradprogression=<i>| & Set the first gradient progression of gradient rules to |<i>|.
+% Default: |\bgndfirstgradprogression|
+% Used by: vgradient, hgradient, doublevgradient, doublehgradient\\
+%
+% |secondgradprogression=<i>| & Set the second gradient progression of double gradient rules to |<i>|.
+% Default: |\bgndsecondgradprogression|
+% Used by: doublevgradient, doublehgradient\\
+%
+% |startcolor=<c>| & Set the |<startcolor>| parameter of gradient rules to |<c>|.
+% Default: If neither startcolor nor startcolordef is given, the color bgndstartcolor is
+% used as |<startcolor>|.
+% Used by: vgradient, hgradient, doublevgradient, doublehgradient
+% Overwrites: startcolordef\\
+%
+% |startcolordef={<cm>}{<cd>}|& Set the |<startcolor>| parameter of gradient rules to color foo, which is obtained by
+% |\definecolor{foo}{<cm>}{<cd>}|. Note that the two pairs of curly braces are mandatory.
+% Default: If neither startcolor nor startcolordef is given, the color bgndstartcolor is
+% used as |<startcolor>|.
+% Used by: vgradient, hgradient, doublevgradient, doublehgradient
+% Overwrites: startcolor\\
+%
+% |endcolor=<c>| & Set the |<endcolor>| parameter of gradient rules to |<c>|.
+% Default: If neither endcolor nor endcolordef is given, the color bgndendcolor is
+% used as |<endcolor>|.
+% Used by: vgradient, hgradient, doublevgradient, doublehgradient
+% Overwrites: endcolordef\\
+%
+% |endcolordef={<cm>}{<cd>}| & Set the |<endcolor>| parameter of gradient rules to color foo, which is obtained by
+% |\definecolor{foo}{<cm>}{<cd>}|. Note that the two pairs of curly braces are mandatory.
+% Default: If neither endcolor nor endcolordef is given, the color bgndendcolor is
+% used as |<endcolor>|.
+% Used by: vgradient, hgradient, doublevgradient, doublehgradient
+% Overwrites: endcolor\\
+%
+% |midcolor=<c>| & Set the |<midcolor>| parameter of double gradient rules to |<c>|.
+% Default: If neither midcolor nor midcolordef is given, the color bgndmidcolor is
+% used as |<midcolor>|.
+% Used by: doublevgradient, doublehgradient
+% Overwrites: midcolordef\\
+%
+% |midcolordef={<cm>}{<cd>}| & Set the |<midcolor>| parameter of double gradient rules to color foo, which is obtained by
+% |\definecolor{foo}{<cm>}{<cd>}|. Note that the two pairs of curly braces are mandatory.
+% Default: If neither midcolor nor midcolordef is given, the color bgndmidcolor is
+% used as |<midcolor>|.
+% Used by: doublevgradient, doublehgradient
+% Overwrites: midcolor\\
+%
+% |hpanels=<t>| & Specifies the `direction' of panels produced. hpanels=true means the top and bottom
+% panel span the full width of the screen. In the space left in the middle, the left
+% panel, the background itself, and the right panel are displayed.
+% hpanels=false means the left and right panel span the full height of the screen. In the
+% space left in the middle, the top panel, the background itself, and the bottom panel are
+% displayed.
+% Default: hpanels=true is the default for plain, hgradient and
+% doublehgradient. hpanels=false is the default for vgradient and
+% doublevgradient.
+% Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient\\
+%
+% |autopanels=<t>| & Specifies whether the default values of the parameters toppanelheight,
+% bottompanelheight, leftpanelwidth, rightpanelwidth should be calculated automatically
+% from the contents of declared panels.
+% The automatism used is analogous to that of |\DeclarePanel*|.
+% Note that for panel arrangement, both the width and the height of all declared panels
+% are overwritten. If you don't want this, calculate the panel parameters yourself and set
+% autopanels=false. In this case, the current panel dimensions of declared panels are used
+% as defaults for toppanelheight, bottompanelheight, leftpanelwidth, rightpanelwidth.
+% Default: true.
+% Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient\\
+%
+% |toppanelheight=<l>| & \\
+% |bottompanelheight=<l>| & \\
+% |leftpanelwidth=<l>| & \\
+% |rightpanelwidth=<l>| & Set the height/width of the space left for the top/bottom/left/right panel to <l>.
+% Note that the remaining dimensions of panels, for instance the width of the top panel,
+% are always calculated automatically, depending on the setting of the hpanels parameter.
+% Default: If a respective panel has been defined using |\DeclarePanel|, the default used
+% depends on the setting of the autopanels parameter.
+% If autopanels=true, the correct dimension is calculated from the contents of
+% the panel. The respective one of |\toppanelheight|, |\bottompanelheight|,
+% |\leftpanelwidth|, |\rightpanelwidth| is overwritten with the result.
+% If autopanels=false, then the respective setting of |\toppanelheight|,
+% |\bottompanelheight|, |\leftpanelwidth|, |\rightpanelwidth| is taken as the default.
+% If a panel has not been declared, the appropriate one of |\bgndtoppanelheight|,
+% |\bgndbottompanelheight|, |\bgndleftpanelwidth|, |\bgndrightpanelwidth| is used as
+% default.
+% Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient\\
+%
+% |toppanelcolor=<c>| & \\
+% |bottompanelcolor=<c>| & \\
+% |leftpanelcolor=<c>| & \\
+% |rightpanelcolor=<c>| & Set the color of the space left for the top/bottom/left/right panel to <c>.
+% Default: The standard colors toppanelcolor, bottompanelcolor, leftpanelcolor,
+% rightpanelcolor are used as defaults.
+% Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient
+% Overwrites: toppanelcolordef bottompanelcolordef leftpanelcolordef rightpanelcolordef \\
+%
+% |toppanelcolordef={<cm>}{<cd>}| & \\
+% |bottompanelcolordef={<cm>}{<cd>}| & \\
+% |leftpanelcolordef={<cm>}{<cd>}| & \\
+% |rightpanelcolordef={<cm>}{<cd>}| &
+% Set the color of the space left for the top/bottom/left/right panel to color foo, which
+% is obtained by |\definecolor{foo}{<cm>}{<cd>}|. Note that the two pairs of curly braces
+% are mandatory.
+% Default: See the description of top/bottom/left/rightpanelcolor.
+% Used by: plain, vgradient, hgradient, doublevgradient, doublehgradient
+% Overwrites: toppanelcolor bottompanelcolor leftpanelcolor rightpanelcolor
+% \end{longtable}
+%
+% \begin{macrocode}
+\newcommand{\backgroundstyle}[2][]
+{%
+ \replacecolor{startcolor@TP}{bgndstartcolor}% Initialize the internal counterparts
+ \replacecolor{midcolor@TP}{bgndmidcolor}% of parameters to their default values.
+ \replacecolor{endcolor@TP}{bgndendcolor}%
+ \replacecolor{bgndtoppanelcolor@TP}{toppanelcolor}%
+ \replacecolor{bgndbottompanelcolor@TP}{bottompanelcolor}%
+ \replacecolor{bgndleftpanelcolor@TP}{leftpanelcolor}%
+ \replacecolor{bgndrightpanelcolor@TP}{rightpanelcolor}%
+ \let\firstgradprogression@TP=\bgndfirstgradprogression
+ \let\secondgradprogression@TP=\bgndsecondgradprogression%
+ \setcounter{stripes@TP}{\bgndstripes}%
+ \let\gradmidpoint@TP=\bgndgradmidpoint
+ \let\bgndtoppanelheight@TP=\empty% The panel dimensions depend on other parameters. If they are not
+ \let\bgndbottompanelheight@TP=\empty% set directly, defaults are calculated after setting keyval
+ \let\bgndleftpanelwidth@TP=\empty% parameters.
+ \let\bgndrightpanelwidth@TP=\empty
+ \let\hpanelsvalue@TP=\empty
+ \setboolean{autopanels@TP}{true}%
+ \csname set#2bgnd@TP\endcsname{#1}% Execute the style-specific command which defines the background box.
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% Background-specific default values.
+%
+% Default number of stripes for gradient page backgrounds.
+% \begin{macrocode}
+\newcommand{\bgndstripes}{10}
+% \end{macrocode}
+% Default position of the `middle' color of a double gradient.
+% \begin{macrocode}
+\newcommand{\bgndgradmidpoint}{.5}
+% \end{macrocode}
+% Default gradient progression for page backgrounds (single gradients or first part of double gradients).
+% \begin{macrocode}
+\newcommand{\bgndfirstgradprogression}{1}
+% \end{macrocode}
+% Default gradient progression for page backgrounds (second part of double gradients).
+% \begin{macrocode}
+\newcommand{\bgndsecondgradprogression}{1}
+% \end{macrocode}
+% Default height/width of the space left for the top/bottom/left/right panel, in case no panel in the respective
+% position has been declared. Otherwise, the defaults are taken from |\toppanelheight|, |\bottompanelheight|,
+% |\leftpanelwidth|, |\rightpanelwidth| or calculated automatically, depending on the setting of the autopanels parameter.
+% Note that the remaining dimensions of panels, for instance the width of the top panel, are always calculated
+% automatically, depending on the setting of the hpanels parameter.
+% \begin{macrocode}
+\newcommand{\bgndtoppanelheight}{0pt}
+
+\newcommand{\bgndbottompanelheight}{0pt}
+
+\newcommand{\bgndleftpanelwidth}{0pt}
+
+\newcommand{\bgndrightpanelwidth}{0pt}
+% \end{macrocode}
+%
+% Internal names for parameter values.
+% \begin{macrocode}
+\newcommand{\bgndtoppanelheight@TP}{0pt}
+
+\newcommand{\bgndtoppanelwidth@TP}{0pt}
+
+\newcommand{\bgndbottompanelheight@TP}{0pt}
+
+\newcommand{\bgndbottompanelwidth@TP}{0pt}
+
+\newcommand{\bgndleftpanelheight@TP}{0pt}
+
+\newcommand{\bgndleftpanelwidth@TP}{0pt}
+
+\newcommand{\bgndrightpanelheight@TP}{0pt}
+
+\newcommand{\bgndrightpanelwidth@TP}{0pt}
+
+\newboolean{hpanels@TP}
+
+\newboolean{autopanels@TP}
+% \end{macrocode}
+%
+% The following commands define the keys for setting the parameters using the keyval package.
+% \begin{macrocode}
+\define@key{bgnd@TP}{stripes}{\setcounter{stripes@TP}{#1}}
+
+
+\define@key{bgnd@TP}{startcolor}{\replacecolor{startcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{startcolordef}{\definecolor{startcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{midcolor}{\replacecolor{midcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{midcolordef}{\definecolor{midcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{endcolor}{\replacecolor{endcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{endcolordef}{\definecolor{endcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{gradmidpoint}{\edef\gradmidpoint@TP{#1}}
+
+
+\define@key{bgnd@TP}{firstgradprogression}{\def\firstgradprogression@TP{#1}}
+
+\define@key{bgnd@TP}{secondgradprogression}{\def\secondgradprogression@TP{#1}}
+
+
+\define@key{bgnd@TP}{hpanels}[true]{\def\hpanelsvalue@TP{#1}}
+
+\define@key{bgnd@TP}{autopanels}[true]{\setboolean{autopanels@TP}{#1}}
+
+
+\define@key{bgnd@TP}{toppanelcolor}{\replacecolor{bgndtoppanelcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{toppanelcolordef}{\definecolor{bgndtoppanelcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{bottompanelcolor}{\replacecolor{bgndbottompanelcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{bottompanelcolordef}{\definecolor{bgndbottompanelcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{leftpanelcolor}{\replacecolor{bgndleftpanelcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{leftpanelcolordef}{\definecolor{bgndleftpanelcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{rightpanelcolor}{\replacecolor{bgndrightpanelcolor@TP}{#1}}
+
+\define@key{bgnd@TP}{rightpanelcolordef}{\definecolor{bgndrightpanelcolor@TP}#1}
+
+
+\define@key{bgnd@TP}{toppanelheight}{\mklength@TP{\bgndtoppanelheight@TP}{#1}}
+
+\define@key{bgnd@TP}{bottompanelheight}{\mklength@TP{\bgndbottompanelheight@TP}{#1}}
+
+\define@key{bgnd@TP}{leftpanelwidth}{\mklength@TP{\bgndleftpanelwidth@TP}{#1}}
+
+\define@key{bgnd@TP}{rightpanelwidth}{\mklength@TP{\bgndrightpanelwidth@TP}{#1}}
+% \end{macrocode}
+%
+% \subsubsection{Implementation of \textbackslash backgroundstyle}
+%
+% In this box, the constructed background is stored. This box is placed behind every page at |\shipout| time by the kernel
+% (see below).
+% \begin{macrocode}
+\newbox\bgndbox@TP
+\setbox\bgndbox@TP\null% Default: Empty.
+% \end{macrocode}
+% |\mkpanels@TP{<command>}| adds the panels to the main page background. The main page background should be produced by the
+% command |<command>|, which is given the width and height of the central area as arguments.
+% \begin{macrocode}
+\newcommand{\mkpanels@TP}[1]%
+{%
+ \ifthenelse{\boolean{hpanels@TP}}% `horizontal' panels?
+ {% Yes. Vertically align top panel, center area with left and right panels, and bottom panel.
+ \vbox% A vbox with \offinterlineskip allows to align the
+ {% horizontal panels with the `background center'.
+ \offinterlineskip
+ \ifthenelse{\lengthtest{\bgndtoppanelheight@TP=0pt}}% Should top panel be created?
+ {}% No.
+ {%
+ \hbox{{%
+ \setcolor@TP{bgndtoppanelcolor@TP}%
+ \rule{\bgndtoppanelwidth@TP}{\bgndtoppanelheight@TP}% Make horizontal colored area.
+ }}%
+ }%
+ \hbox% Make `background center'.
+ {%
+ \ifthenelse{\lengthtest{\bgndleftpanelwidth@TP=0pt}}% Should left panel be created?
+ {}% No.
+ {{%
+ \setcolor@TP{bgndleftpanelcolor@TP}%
+ \rule{\bgndleftpanelwidth@TP}{\bgndleftpanelheight@TP}% Make vertical colored area.
+ }}%
+ #1% Make main background object.
+ {\bgndtoppanelwidth@TP-\bgndleftpanelwidth@TP-\bgndrightpanelwidth@TP}% Calculate remaining space in the center.
+ {\bgndleftpanelheight@TP}%
+ \ifthenelse{\lengthtest{\bgndrightpanelwidth@TP=0pt}}% Should right panel be created?
+ {}% No.
+ {{%
+ \setcolor@TP{bgndrightpanelcolor@TP}%
+ \rule{\bgndrightpanelwidth@TP}{\bgndrightpanelheight@TP}% Make vertical colored area.
+ }}%
+ }% matches \hbox{%
+ \ifthenelse{\lengthtest{\bgndbottompanelheight@TP=0pt}}% Should bottom panel be created?
+ {}% No.
+ {%
+ \hbox
+ {{%
+ \setcolor@TP{bgndbottompanelcolor@TP}%
+ \rule{\bgndbottompanelwidth@TP}{\bgndbottompanelheight@TP}% Make horizontal colored area.
+ }}%
+ }%
+ }% matches \vbox{%
+ }% matches \ifthenelse{\boolean{hpanels@TP}}{%
+ {% No. Horizontally align left panel, center area with top and bottom panels, and right panel.
+ \ifthenelse{\lengthtest{\bgndleftpanelwidth@TP=0pt}}% Should left panel be created?
+ {}% No.
+ {{%
+ \setcolor@TP{bgndleftpanelcolor@TP}%
+ \rule{\bgndleftpanelwidth@TP}{\bgndleftpanelheight@TP}% Make vertical colored area.
+ }}%
+ \vbox% A vbox with \offinterlineskip allows to align
+ {% the horizontal panels with the center object.
+ \offinterlineskip
+ \ifthenelse{\lengthtest{\bgndtoppanelheight@TP=0pt}}% Should top panel be created?
+ {}% No.
+ {%
+ \hbox%
+ {{%
+ \setcolor@TP{bgndtoppanelcolor@TP}%
+ \rule{\bgndtoppanelwidth@TP}{\bgndtoppanelheight@TP}% Make horizontal colored area.
+ }}%
+ }%
+ \hbox% Make main background object.
+ {%
+ #1%
+ {\bgndtoppanelwidth@TP}%
+ {\bgndleftpanelheight@TP-\bgndtoppanelheight@TP-\bgndbottompanelheight@TP}% Calculate space in the center.
+ }%
+ \ifthenelse{\lengthtest{\bgndbottompanelheight@TP=0pt}}% Should bottom panel be created?
+ {}% No.
+ {%
+ \hbox%
+ {{%
+ \setcolor@TP{bgndbottompanelcolor@TP}%
+ \rule{\bgndbottompanelwidth@TP}{\bgndbottompanelheight@TP}% Make horizontal colored area.
+ }}%
+ }%
+ }% matches \vbox{%
+ \ifthenelse{\lengthtest{\bgndrightpanelwidth@TP=0pt}}% Should right panel be created?
+ {}% No.
+ {{%
+ \setcolor@TP{bgndrightpanelcolor@TP}%
+ \rule{\bgndrightpanelwidth@TP}{\bgndrightpanelheight@TP}% Make vertical colored area.
+ }}%
+ }% matches second argument of \ifthenelse{\boolean{hpanels@TP}}
+ }% matches \newcommand{\mkpanels@TP}[1]{%
+% \end{macrocode}
+%
+% For those background styles which use panels, |\initpanels@TP{<hpanels>}| sets all panel-related parameters depending on
+% the options and defaults. <hpanels> gives the background style dependent default of the hpanels option.
+% \begin{macrocode}
+\newcommand{\initpanels@TP}[1]%
+{%
+ \ifx\hpanelsvalue@TP\empty% Has the hpanels parameter been given?
+ \setboolean{hpanels@TP}{#1}% No; use default.
+ \else
+ \setboolean{hpanels@TP}{\hpanelsvalue@TP}% Yes; use parameter setting.
+ \fi
+ \ifthenelse{\boolean{hpanels@TP}}% `horizontal' panel direction?
+ {% Yes. Horizontal panels are `outer', vertical panels are `inner'.
+ \let\bgndtoppanelwidth@TP=\TPpagewidth% Full width for horizontal panels.
+ \let\bgndbottompanelwidth@TP=\TPpagewidth%
+ \ifthenelse{\equal{\bgndtoppanelheight@TP}{}}% Has the top panel height been set?
+ {% No. Guess default.
+ \ifx\toppanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndtoppanelheight@TP}{\bgndtoppanelheight}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calcvdimen@TP{\bgndtoppanelheight@TP}{\bgndtoppanelwidth@TP}% Measure the height of panel contents.
+ {\toppanelcontents@TP}%
+ \let\toppanelheight=\bgndtoppanelheight@TP% Overwrite panel settings.
+ \let\toppanelwidth=\bgndtoppanelwidth@TP%
+ \def\toppanelshift{0pt}% Top panel spans the whole upper screen.
+ }
+ {% No
+ \mklength@TP{\bgndtoppanelheight@TP}{\toppanelheight}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndtoppanelheight@TP}{}}
+ {}% Yes. Nothing to do.
+ \ifthenelse{\equal{\bgndbottompanelheight@TP}{}}% Has the bottom panel height been set?
+ {% No. Guess default.
+ \ifx\bottompanelcontents@TP\empty% Is the bottom panel defined?
+ \mklength@TP{\bgndbottompanelheight@TP}{\bgndbottompanelheight}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calcvdimen@TP{\bgndbottompanelheight@TP}{\bgndbottompanelwidth@TP}% Measure the height of panel contents.
+ {\bottompanelcontents@TP}%
+ \let\bottompanelheight=\bgndbottompanelheight@TP% Overwrite panel settings.
+ \let\bottompanelwidth=\bgndbottompanelwidth@TP%
+ \def\bottompanelshift{0pt}% Bottom panel spans the whole upper screen.
+ }
+ {% No
+ \mklength@TP{\bgndbottompanelheight@TP}{\bottompanelheight}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndbottompanelheight@TP}{}}
+ {}% Yes. Nothing to do.
+ \mklength@TP{\bgndleftpanelheight@TP}% Calculate remaining space in the center.
+ {\TPpageheight-\bgndtoppanelheight@TP-\bgndbottompanelheight@TP}%
+ \let\bgndrightpanelheight@TP=\bgndleftpanelheight@TP% Height of left and right panels is equal.
+ \ifthenelse{\equal{\bgndleftpanelwidth@TP}{}}% Has the left panel width been set?
+ {% No. Guess default.
+ \ifx\leftpanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndleftpanelwidth@TP}{\bgndleftpanelwidth}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calchdimen@TP{\bgndleftpanelwidth@TP}{\bgndleftpanelheight@TP}% Measure the `optimal' width of panel contents.
+ {\leftpanelcontents@TP}%
+ \let\leftpanelheight=\bgndleftpanelheight@TP% Overwrite panel settings.
+ \let\leftpanelwidth=\bgndleftpanelwidth@TP%
+ \let\leftpanelraise=\bgndbottompanelheight@TP% Left panel is raised above bottom panel.
+ }
+ {% No
+ \mklength@TP{\bgndleftpanelwidth@TP}{\leftpanelwidth}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndleftpanelwidth@TP}{}}
+ {}% Yes. Nothing to do.
+ \ifthenelse{\equal{\bgndrightpanelwidth@TP}{}}% Has the right panel width been set?
+ {% No. Guess default.
+ \ifx\rightpanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndrightpanelwidth@TP}{\bgndrightpanelwidth}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calchdimen@TP{\bgndrightpanelwidth@TP}{\bgndrightpanelheight@TP}% Measure `optimal' width of panel contents.
+ {\rightpanelcontents@TP}%
+ \let\rightpanelheight=\bgndrightpanelheight@TP% Overwrite panel settings.
+ \let\rightpanelwidth=\bgndrightpanelwidth@TP%
+ \let\rightpanelraise=\bgndbottompanelheight@TP% Right panel is raised above bottom panel.
+ }
+ {% No
+ \mklength@TP{\bgndrightpanelwidth@TP}{\rightpanelwidth}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndrightpanelwidth@TP}{}}
+ {}% Yes. Nothing to do.
+ }% matches \ifthenelse{\boolean{hpanels@TP}}
+ {% No. Vertical panels are `outer', horizontal panels are `inner'.
+ \let\bgndleftpanelheight@TP=\TPpageheight% Full height for vertical panels.
+ \let\bgndrightpanelheight@TP=\TPpageheight%
+ \ifthenelse{\equal{\bgndleftpanelwidth@TP}{}}% Has the left panel width been set?
+ {% No. Guess default.
+ \ifx\leftpanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndleftpanelwidth@TP}{\bgndleftpanelwidth}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calchdimen@TP{\bgndleftpanelwidth@TP}{\bgndleftpanelheight@TP}% Measure the `optimal' width of panel contents.
+ {\leftpanelcontents@TP}%
+ \let\leftpanelheight=\bgndleftpanelheight@TP% Overwrite panel settings.
+ \let\leftpanelwidth=\bgndleftpanelwidth@TP%
+ \def\leftpanelraise{0pt}% Left panel spans the whole left part of the screen.
+ }
+ {% No
+ \mklength@TP{\bgndleftpanelwidth@TP}{\leftpanelwidth}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndleftpanelwidth@TP}{}}
+ {}% Yes. Nothing to do.
+ \ifthenelse{\equal{\bgndrightpanelwidth@TP}{}}% Has the right panel width been set?
+ {% No. Guess default.
+ \ifx\rightpanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndrightpanelwidth@TP}{\bgndrightpanelwidth}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calchdimen@TP{\bgndrightpanelwidth@TP}{\bgndrightpanelheight@TP}% Measure `optimal' width of panel contents.
+ {\rightpanelcontents@TP}%
+ \let\rightpanelheight=\bgndrightpanelheight@TP% Overwrite panel settings.
+ \let\rightpanelwidth=\bgndrightpanelwidth@TP%
+ \def\rightpanelraise{0pt}% Right panel spans the whole left part of the screen.
+ }
+ {% No
+ \mklength@TP{\bgndrightpanelwidth@TP}{\rightpanelwidth}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndrightpanelwidth@TP}{}}
+ {}% Yes. Nothing to do.
+ \mklength@TP{\bgndtoppanelwidth@TP}% Calculate remaining space in the center.
+ {\TPpagewidth-\bgndleftpanelwidth@TP-\bgndrightpanelwidth@TP}%
+ \let\bgndbottompanelwidth@TP=\bgndtoppanelwidth@TP% Width of top and bottom panels is equal.
+ \ifthenelse{\equal{\bgndtoppanelheight@TP}{}}% Has the top panel height been set?
+ {% No. Guess default.
+ \ifx\toppanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndtoppanelheight@TP}{\bgndtoppanelheight}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calcvdimen@TP{\bgndtoppanelheight@TP}{\bgndtoppanelwidth@TP}% Measure the height of panel contents.
+ {\toppanelcontents@TP}%
+ \let\toppanelheight=\bgndtoppanelheight@TP% Overwrite panel settings.
+ \let\toppanelwidth=\bgndtoppanelwidth@TP%
+ \let\toppanelshift=\bgndleftpanelwidth@TP% Shift top panel to the right of left panel.
+ }
+ {% No
+ \mklength@TP{\bgndtoppanelheight@TP}{\toppanelheight}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndtoppanelheight@TP}{}}
+ {}% Yes. Nothing to do.
+ \ifthenelse{\equal{\bgndbottompanelheight@TP}{}}% Has the bottom panel height been set?
+ {% No. Guess default.
+ \ifx\bottompanelcontents@TP\empty% Is the panel defined?
+ \mklength@TP{\bgndbottompanelheight@TP}{\bgndbottompanelheight}% Use background-specific default.
+ \else
+ \ifthenelse{\boolean{autopanels@TP}}% Calculate panel dimensions?
+ {% Yes.
+ \calcvdimen@TP{\bgndbottompanelheight@TP}{\bgndbottompanelwidth@TP}% Measure the height of panel contents.
+ {\bottompanelcontents@TP}%
+ \let\bottompanelheight=\bgndbottompanelheight@TP% Overwrite panel settings.
+ \let\bottompanelwidth=\bgndbottompanelwidth@TP%
+ \let\bottompanelshift=\bgndleftpanelwidth@TP% Shift bottom panel to the right of left panel.
+ }
+ {% No
+ \mklength@TP{\bgndbottompanelheight@TP}{\bottompanelheight}% Use panel-specific default.
+ }%
+ \fi
+ }% matches \ifthenelse{\equal{\bgndbottompanelheight@TP}{}}
+ {}% Yes. Nothing to do.
+ }% matches second argument of \ifthenelse{\boolean{hpanels@TP}}
+ }% matches \newcommand{\initpanels@TP}[1]{
+% \end{macrocode}
+%
+% Make an `invisible' rule.
+% \begin{macrocode}
+\newcommand{\phantomrule@TP}[2]{\rule{0pt}{#2}\rule{#1}{0pt}}
+% \end{macrocode}
+%
+% Implementations of individual background styles.
+% \begin{macrocode}
+\newcommand{\setnonebgnd@TP}[1]% Implementation of the background style ``none''.
+{\global\setbox\bgndbox@TP=\null}% Just produce an empty box.
+
+
+\newcommand{\setplainbgnd@TP}[1]% Implementation of the background style ``plain''.
+{%
+ \setkeys{bgnd@TP}{#1}% Evaluate parameters.
+ \initpanels@TP{true}% Initialize panel parameters.
+ \global\setbox\bgndbox@TP=\hbox{\mkpanels@TP{\phantomrule@TP}}% Make panels only.
+ }%
+
+
+\newcommand{\setvgradientbgnd@TP}[1]% Implementation of the background style ``vgradient''.
+{%
+ \setkeys{bgnd@TP}{#1}% Evaluate parameters.
+ \initpanels@TP{false}% Initialize panel parameters.
+ \global\setbox\bgndbox@TP=\hbox{\mkpanels@TP{\@@vgradrule@TP}}% Make background box.
+ }
+
+\newcommand{\sethgradientbgnd@TP}[1]% Implementation of the background style ``hgradient''.
+{%
+ \setkeys{bgnd@TP}{#1}% Evaluate parameters.
+ \initpanels@TP{true}% Initialize panel parameters.
+ \global\setbox\bgndbox@TP=\hbox{\mkpanels@TP{\@@hgradrule@TP}}% Make background box.
+ }
+
+
+\newcommand{\setdoublevgradientbgnd@TP}[1]% Implementation of the background style ``doublevgradient''.
+{%
+ \setkeys{bgnd@TP}{#1}% Evaluate parameters.
+ \initpanels@TP{false}% Initialize panel parameters.
+ \global\setbox\bgndbox@TP=\hbox{\mkpanels@TP{\@@@@dblvgradrule@TP}}% Make background box.
+ }
+
+
+\newcommand{\setdoublehgradientbgnd@TP}[1]% Implementation of the background style ``doublehgradient''.
+{%
+ \setkeys{bgnd@TP}{#1}% Evaluate parameters.
+ \initpanels@TP{true}% Initialize panel parameters.
+ \global\setbox\bgndbox@TP=\hbox{\mkpanels@TP{\@@@@dblhgradrule@TP}}% Make background box.
+ }
+% \end{macrocode}
+%
+% |\hpagecolor[<start>]{<end>}| is provided here for compatibility with background.sty from PPower4. It sets a horizontal
+% gradient background. See the PPower4 documentation on the meaning of the arguments (which is quite confusing).
+% \begin{macrocode}
+\providecommand{\hpagecolor}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\colorbetween{ppendcolor}{#2}{white}\backgroundstyle[startcolor=#2,endcolor=ppendcolor]{hgradient}}
+ {\backgroundstyle[startcolor=#1,endcolor=#2]{hgradient}}%
+ }
+% \end{macrocode}
+%
+% |\vpagecolor[<start>]{<end>}| is provided here for compatibility with background.sty from PPower4. It sets a vertical
+% gradient background. See the PPower4 documentation on the meaning of the arguments (which is quite confusing).
+% \begin{macrocode}
+\providecommand{\vpagecolor}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\colorbetween{ppendcolor}{#2}{white}\backgroundstyle[startcolor=#2,endcolor=ppendcolor]{vgradient}}
+ {\backgroundstyle[startcolor=#1,endcolor=#2]{vgradient}}%
+ }
+% \end{macrocode}
+%
+% \subsection{Panels}
+%
+% The following code is rather preliminary and provides only the very basics for constructing panels. If you're using a
+% document class or package which allows to do this or know how to achieve it using fancy headers, don't even consider
+% using the following.
+%
+% Some configurable panel parameters.
+%
+% Margin around panels (space [on all sides] between beginning of background and panel contents).
+% \begin{macrocode}
+\mklength@TP{\panelmargin}{\fboxsep}
+% \end{macrocode}
+% Dimensions of top panel. Note that parts or all of these dimensions might be overwritten by |\DeclarePanel*| or
+% using |\backgroundstyle| with specific settings.
+% \begin{macrocode}
+\newcommand{\toppanelwidth}{\TPpagewidth}% Width.
+\newcommand{\toppanelheight}{\TPpageheight/5}% Height.
+\newcommand{\toppanelshift}{0pt}% Space between left screen edge and left edge of top panel.
+% \end{macrocode}
+% Dimensions of bottom panel.
+% \begin{macrocode}
+\newcommand{\bottompanelwidth}{\TPpagewidth}% Width.
+\newcommand{\bottompanelheight}{\TPpageheight/5}% Height.
+\newcommand{\bottompanelshift}{0pt}% Space between left screen edge and left edge of bottom panel.
+% \end{macrocode}
+% Dimensions of left panel.
+% \begin{macrocode}
+\newcommand{\leftpanelwidth}{\TPpagewidth/5}% Width.
+\newcommand{\leftpanelheight}{\TPpageheight}% Height.
+\newcommand{\leftpanelraise}{0pt}% Space between bottom screen edge and bottom edge of left panel.
+% \end{macrocode}
+% Dimensions of right panel.
+% \begin{macrocode}
+\newcommand{\rightpanelwidth}{\TPpagewidth/5}% Width.
+\newcommand{\rightpanelheight}{\TPpageheight}% Height.
+\newcommand{\rightpanelraise}{0pt}% Space between bottom screen edge and bottom edge of left panel.
+% \end{macrocode}
+%
+% Some internal panel parameters.
+%
+% Storage for panel contents.
+% \begin{macrocode}
+\newcommand*{\toppanelcontents@TP}{}
+\newcommand*{\bottompanelcontents@TP}{}
+\newcommand*{\leftpanelcontents@TP}{}
+\newcommand*{\rightpanelcontents@TP}{}
+% \end{macrocode}
+%
+%
+% \subsubsection{Panel-specific user level commands}
+% \begin{macro}{\DeclarePanel}
+% |\DeclarePanel[<name>]{<pos>}{<contents>}| declares the contents |<contents>| of the panel at position |<pos>|.
+% Afterwards, on every page the panel contents are set in a parbox of dimensions and position specified by
+% |<pos>panelwidth|, |<pos>panelheight|, |\panelmargin| and |<pos>panelshift| for top and bottom panels and |<pos>panelraise| for
+% left and right panels. The parbox is constructed anew on every page, so all changes influencing panel contents or
+% parameters (like a |\thepage| in the panel contents) are respected.
+%
+% The panel contents are set in color |<pos>paneltextcolor|. There is another standard color |<pos>panelcolor|, which is
+% however not activated by |\DeclarePanel| but by selecting an appropriate background style.
+% Note that pages are constructed as follows: first the page background, then the panels, and then the page
+% contents. Hence, panels overwrite the background and the page contents overwrite the panels. The user is supposed to
+% make sure themselves that there is enough space left on the page for the panels (document class specific settings).
+% The panel declaration is global. A panel can be `undeclared' by using |\DeclarePanel{<pos>}{}|.
+%
+% There is a starred version which will (try to) automatically calculate the `flexible' dimension of each panel. For top
+% and bottom panels this is the height, for left and right panels this is the width. Make sure the panel contents are
+% `valid' at the time |\DeclarePanel*| is called so the calculation can be carried out in a meaningful way.
+% While the automatic calculation of the height of top and bottom panels is trivial (using |\settoheight|), there is a
+% sophisticated procedure for calculating a `good' width for the parbox containing the panel. Owing to limitations set
+% by TeX, there are certain limits to the sophistication of the procedure. For instance, any `whatsits' (specials (like
+% color changes), file accesses (like |\label|), or hyper anchors) or rules which are inserted directly in the vertical
+% list of the parbox `block' the analysis, so the procedure can't `see' past them (starting at the bottom of the box)
+% when analysing the contents of the parbox. The user should make sure such items are set in horizontal mode (by using
+% |\leavevmode| or enclosing stuff in boxes). Furthermore, only overfull and underfull hboxes which occur while setting
+% the parbox are considered when judging which width is `best'. This will reliably make the width large enough to
+% contain `wide' objects like tabulars, logos and buttons, but might not give optimal results for justified text.
+% vboxes occurring directly in the vbox are ignored.
+% Note further that hboxes with fixed width (made by |\hbox| to...) which occur directly in the vbox may disturb the
+% procedure, because the fixed width cannot be recovered. These hboxes will be reformatted with the width of the vbox,
+% generating an extremely large badness, unsettling the calculation of maximum badness. To avoid this such hboxes should
+% be either contained in a vbox or set in horizontal mode with appropriate glue at the end.
+%
+% If the optional argument <name> is given, the panel contents and (calculated) size will also be stored under the given
+% name, to be restored later with |\restorepanels|. This is nice for switching between different sets of panels.
+% \begin{macrocode}
+\newcommand{\DeclarePanel}{\@ifstar\auto@declarepanel@TP\declarepanel@TP}
+
+\newcommand{\declarepanel@TP}[3][]% Non-starred version of \DeclarePanel.
+{%
+ \expandafter\gdef\csname #2panelcontents@TP\endcsname{#3}% Just store panel contents.
+ \ifthenelse{\equal{#1}{}}{}{\csname store#2panel@TP\endcsname{#1}}% If <name> was given, store panel parameters away.
+ }%
+
+% Store away top panel parameters.
+\newcommand{\storetoppanel@TP}[1]
+{%
+ \expandafter\global\expandafter\let\csname toppanelcontents@TP@#1\endcsname\toppanelcontents@TP% Contents.
+ \expandafter\global\expandafter\let\csname toppanelwidth@TP@#1\endcsname\toppanelwidth@TP% Width.
+ \expandafter\global\expandafter\let\csname toppanelheight@TP@#1\endcsname\toppanelheight@TP% Height.
+ \expandafter\global\expandafter\let\csname toppanelshift@TP@#1\endcsname\toppanelshift@TP% Raise.
+}
+
+% Store away bottom panel parameters.
+\newcommand{\storebottompanel@TP}[1]
+{%
+ \expandafter\global\expandafter\let\csname bottompanelcontents@TP@#1\endcsname\bottompanelcontents@TP%
+ \expandafter\global\expandafter\let\csname bottompanelwidth@TP@#1\endcsname\bottompanelwidth@TP%
+ \expandafter\global\expandafter\let\csname bottompanelheight@TP@#1\endcsname\bottompanelheight@TP%
+ \expandafter\global\expandafter\let\csname bottompanelshift@TP@#1\endcsname\bottompanelshift@TP%
+}
+
+% Store away left panel parameters.
+\newcommand{\storeleftpanel@TP}[1]
+{%
+ \expandafter\global\expandafter\let\csname leftpanelcontents@TP@#1\endcsname\leftpanelcontents@TP%
+ \expandafter\global\expandafter\let\csname leftpanelwidth@TP@#1\endcsname\leftpanelwidth@TP%
+ \expandafter\global\expandafter\let\csname leftpanelheight@TP@#1\endcsname\leftpanelheight@TP%
+ \expandafter\global\expandafter\let\csname leftpanelraise@TP@#1\endcsname\leftpanelraise@TP%
+}
+
+% Store away right panel parameters.
+\newcommand{\storerightpanel@TP}[1]
+{%
+ \expandafter\global\expandafter\let\csname rightpanelcontents@TP@#1\endcsname\rightpanelcontents@TP%
+ \expandafter\global\expandafter\let\csname rightpanelwidth@TP@#1\endcsname\rightpanelwidth@TP%
+ \expandafter\global\expandafter\let\csname rightpanelheight@TP@#1\endcsname\rightpanelheight@TP%
+ \expandafter\global\expandafter\let\csname rightpanelraise@TP@#1\endcsname\rightpanelraise@TP%
+}
+
+
+\newcommand{\auto@declarepanel@TP}[2]% Starred version of \DeclarePanel.
+{\csname calc#1dimen@TP\endcsname{#2}\declarepanel@TP{#1}{#2}} % Calculate `optimal' dimension and store contents.
+
+% Restore panel parameters stored away under a given name.
+\newcommand{\restorepanels}[1]
+{%
+ \@ifundefined{toppanelcontents@TP@#1}{\global\let\toppanelcontents@TP\empty}
+ {%
+ \expandafter\global\expandafter\let\expandafter\toppanelcontents@TP\csname toppanelcontents@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\toppanelwidth@TP\csname toppanelwidth@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\toppanelheight@TP\csname toppanelheight@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\toppanelshift@TP\csname toppanelshift@TP@#1\endcsname
+ }%
+ \@ifundefined{bottompanelcontents@TP@#1}{\global\let\bottompanelcontents@TP\empty}
+ {%
+ \expandafter\global\expandafter\let\expandafter\bottompanelcontents@TP\csname bottompanelcontents@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\bottompanelwidth@TP\csname bottompanelwidth@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\bottompanelheight@TP\csname bottompanelheight@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\bottompanelshift@TP\csname bottompanelshift@TP@#1\endcsname
+ }%
+ \@ifundefined{leftpanelcontents@TP@#1}{\global\let\leftpanelcontents@TP\empty}
+ {%
+ \expandafter\global\expandafter\let\expandafter\leftpanelcontents@TP\csname leftpanelcontents@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\leftpanelwidth@TP\csname leftpanelwidth@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\leftpanelheight@TP\csname leftpanelheight@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\leftpanelraise@TP\csname leftpanelraise@TP@#1\endcsname
+ }%
+ \@ifundefined{rightpanelcontents@TP@#1}{\global\let\rightpanelcontents@TP\empty}
+ {%
+ \expandafter\global\expandafter\let\expandafter\rightpanelcontents@TP\csname rightpanelcontents@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\rightpanelwidth@TP\csname rightpanelwidth@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\rightpanelheight@TP\csname rightpanelheight@TP@#1\endcsname
+ \expandafter\global\expandafter\let\expandafter\rightpanelraise@TP\csname rightpanelraise@TP@#1\endcsname
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \subsubsection{Implementation of automatic dimension calculation}
+%
+% Interface to the horizontal and vertical calculation procedures. The first argument is being recalculated, the second
+% and third ones are parameters.
+% \begin{macrocode}
+\newcommand{\calctopdimen@TP}[1]{\calcvdimen@TP{\toppanelheight}{\toppanelwidth}{#1}}
+\newcommand{\calcbottomdimen@TP}[1]{\calcvdimen@TP{\bottompanelheight}{\bottompanelwidth}{#1}}
+\newcommand{\calcleftdimen@TP}[1]{\calchdimen@TP{\leftpanelwidth}{\leftpanelheight}{#1}}%
+\newcommand{\calcrightdimen@TP}[1]{\calchdimen@TP{\rightpanelwidth}{\rightpanelheight}{#1}}%
+% \end{macrocode}
+% Remove any contents which could mess up the box analysis.
+% \begin{macrocode}
+\newcommand{\panel@sanitize@TP}
+{%
+ \let\hyperlink=\@secondoftwo
+ \let\Acrobatmenu=\@secondoftwo
+}
+% \end{macrocode}
+% Calculate height of `horizontal' panel.
+% \begin{macrocode}
+\newcommand{\calcvdimen@TP}[3]
+{%
+ \setbox\tempbox@TP=\hbox{\panel@sanitize@TP\@@mk@panel@TP{#2}{}{toppaneltextcolor}{#3}}% Set panel into a dummy box.
+ \mklength@TP{#1}{\ht\tempbox@TP+\dp\tempbox@TP}% % Measure total height.
+}
+% \end{macrocode}
+% Calculate `optimal' width of `vertical panel.
+% \begin{macrocode}
+\newcommand{\calchdimen@TP}[3]
+{%
+ \optwidth@TP{#1}{#2-\panelmargin*2}% Calculate `optimal' width of a parbox. Panel margins are respected.
+ {.5\textwidth-\panelmargin*2}{\panelalignment#3}% .5\textwidth is the hardcoded absolute maximum width.
+ \mklength@TP{#1}{#1+\panelmargin*2}%
+ }
+% \end{macrocode}
+% User-configurable: Which `resolution' should be used when searching for `best' width?
+% \begin{macrocode}
+\newcommand{\optwidthsteps}{100}
+% \end{macrocode}
+% User-configurable: Which badness should be tolerated as `perfect' (stopping the search for a better one).
+% \begin{macrocode}
+\newcommand{\optwidthlinetolerance}{200}
+% \end{macrocode}
+%
+% Internal parameter: Badness of the parbox currently under consideration.
+% \begin{macrocode}
+\let\maxbadness@TP=\@tempcnta
+% \end{macrocode}
+% A hook to disable some commands which would be in the way while measuring things.
+% \begin{macrocode}
+\def\optwidthdisablecommands@TP
+{%
+ \let\Hy@colorlink\@firstofone
+ \let\Hy@endcolorlink\relax
+ }
+% \end{macrocode}
+% Calculate `best' width of a parbox. The current algorithm will set the textual contents into parboxes of increasing
+% width, starting from 0pt and ending with the maximum width given, in |\optwidthsteps| steps. The `badness' of every
+% parbox is measured. If it is below the threshold defined by |\optwidthlinetolerance|, the process is stopped and the
+% found width accepted. If this doesn't happen, the width of the parbox with the least badness is returned.
+% \begin{macrocode}
+\newcommand{\optwidth@TP}[4]
+{%
+ \setcounter{tmpcnta@TP}{0}% Initialize `probe counter' for box width.
+ \let\best@cnt@TP=\empty% Initialize number of best `probe' so far.
+ \def\bestbadness@TP{1000000}% Initialize badness of best `probe'.
+ \setboolean{carryon@TP}{true}% Flag for breaking out of loop.
+ \setlength{\tempdimb@TP}{#2}% Store maximal box height.
+ \whiledo
+ {\value{tmpcnta@TP}<\optwidthsteps\and\boolean{carryon@TP}}% Probes done or break of loop?
+ {%
+ \stepcounter{tmpcnta@TP}% Start next probe.
+ \setbox\@tempboxa=\hbox% The trick with vbox/lastbox is to get the vbox
+ {% produced by \parbox `immediately' into a box register.
+ \optwidthdisablecommands@TP% Turn off some nasties not needed when measuring.
+ \parbox[b]{(#3)/\optwidthsteps*\value{tmpcnta@TP}}% Make the next parbox.
+ {\hfuzz\maxdimen\hbadness\@M\relax#4}%
+ \global\setbox\tempbox@TP=\lastbox% ... and assign \tempbox@TP to it.
+ }%
+ \setlength{\tempdima@TP}{\ht\tempbox@TP+\dp\tempbox@TP}% Measure total height.
+ \ifthenelse{\lengthtest{\tempdima@TP>\tempdimb@TP}}% If it exceeds the maximum height given, the box isn't
+ {}% acceptable anyway.
+ {%
+ \calcmaxbadness@TP{\maxbadness@TP}{\tempbox@TP}% Calculate `worst badness' of any hbox appearing in parbox.
+ \ifthenelse{\not\maxbadness@TP>\optwidthlinetolerance}% Below Threshold?
+ {% Yes. Accept this width.
+ \edef\best@cnt@TP{\thetmpcnta@TP}% Store this probe number.
+ \setboolean{carryon@TP}{false}% Break loop.
+ }
+ {% No. Carry on.
+ \ifthenelse{\maxbadness@TP<\bestbadness@TP}% Below lowest badness found so far?
+ {% Yes. Store probe number.
+ \edef\bestbadness@TP{\number\maxbadness@TP}% Store badness value.
+ \edef\best@cnt@TP{\thetmpcnta@TP}% Store probe number.
+ }
+ {}% No. Try next probe.
+ }% matches second argument of \ifthenelse{\not\maxbadness@TP>\optwidthlinetolerance}%
+ }% matches second argument of \ifthenelse{\lengthtest{\tempdima@TP>\tempdimb@TP}}%
+ }% matches \whiledo{\value{tmpcnta@TP}<\optwidthsteps\and\boolean{carryon@TP}}{%
+ \ifx\best@cnt@TP\empty% Was _any_ badness below the initialization value found?
+ \mklength@TP{#1}{#3}% No; return max width.
+ \else
+ \mklength@TP{#1}{(#3)/\optwidthsteps*\best@cnt@TP}% Yes; return width of best probe.
+ \fi
+ }% matches \newcommand{\optwidth@TP}[4]{%
+% \end{macrocode}
+%
+% Calculate maximal badness of any hbox occurring in a vbox.
+% \begin{macrocode}
+\newcommand{\calcmaxbadness@TP}[2]
+{%
+ \let\@resultcnt@TP=#1% Here we store the result.
+ \global\@resultcnt@TP=\z@\relax% Just in case no hbox occurs...
+ \setlength{\@tempdima}{\wd#2}% This is the width to which every hbox is stretched for finding its badness.
+ \setbox\@tempboxa=\vbox% A dummy vbox for recursively analysing the vbox contents using \lastbox
+ {%
+ \hfuzz\maxdimen\hbadness\@M
+ \unvbox#2% `free' the contents of the vbox.
+ \measureboxes@TP% Analyse `tail to head' using \lastbox.
+ }%
+ }
+% \end{macrocode}
+%
+% Recursively analyse vertical list using |\lastbox|, to find maximum badness of any contained hbox.
+% \begin{macrocode}
+\newcommand{\measureboxes@TP}%
+{%
+ \unskip\unpenalty\unkern% This is a kluge for TeX, because there is no certain way of finding out whether there's a
+ \unskip\unpenalty\unkern% penalty, glue or kern on the vertical list. \lastpenalty will give its value, but a
+ \unskip\unpenalty\unkern% value of 0 might mean there was none or there was one of value 0.
+ \unskip\unpenalty\unkern% This is different in eTeX. I might make a switch to a smarter solution.
+ \unskip\unpenalty\unkern
+ \unskip\unpenalty\unkern
+ \unskip\unpenalty\unkern
+ \unskip\unpenalty\unkern
+ \unskip\unpenalty\unkern
+ \unskip\unpenalty\unkern
+ \setbox\@tempboxa=\lastbox% Grab last box.
+ \ifhbox\@tempboxa% Was this an hbox?
+ \setbox0=\hb@xt@\@tempdima{\unhbox\@tempboxa}% Yes. Reformat with given width.
+ \ifnum\badness>\@resultcnt@TP% Badness larger than largest recorded badness?
+ \global\@resultcnt@TP=\badness% Yes. Memorize.
+ \fi
+ \expandafter\measureboxes@TP% Recursive call.
+ \else
+ \ifvbox\@tempboxa% Was this a vbox?
+ \expandafter\expandafter\expandafter\measureboxes@TP% Ignore, but execute recursive call.
+ \fi
+ \fi
+ }
+% \end{macrocode}
+%
+%
+% \subsubsection{Actually typeset panels}
+% \begin{macrocode}
+\newcommand{\mk@toppanel@TP}% top panel
+{%
+ \ifx\toppanelcontents@TP\empty% top panel specified?
+ \else% Yes; create box with appropriate dimensions, background color and contents.
+ \@mk@panel@TP{\toppanelwidth}{\toppanelheight}{toppaneltextcolor}{\toppanelcontents@TP}%
+ \fi
+ }
+
+\newcommand{\mk@bottompanel@TP}% bottom panel
+{%
+ \ifx\bottompanelcontents@TP\empty% bottom panel specified?
+ \else% Yes; create box with appropriate dimensions, background color and contents.
+ \@mk@panel@TP{\bottompanelwidth}{\bottompanelheight}{bottompaneltextcolor}{\bottompanelcontents@TP}%
+ \fi
+ }
+
+\newcommand{\mk@leftpanel@TP}% left panel
+{%
+ \ifx\leftpanelcontents@TP\empty% left panel specified?
+ \else% Yes; create box with appropriate dimensions, background color and contents.
+ \@mk@panel@TP{\leftpanelwidth}{\leftpanelheight}{leftpaneltextcolor}{\leftpanelcontents@TP}%
+ \fi
+ }
+
+\newcommand{\mk@rightpanel@TP}% right panel
+{%
+ \ifx\rightpanelcontents@TP\empty% right panel specified?
+ \else% Yes; create box with appropriate dimensions, text color and contents.
+ \@mk@panel@TP{\rightpanelwidth}{\rightpanelheight}{rightpaneltextcolor}{\rightpanelcontents@TP}%
+ \fi
+ }
+
+
+\newcommand{\@mk@panel@TP}[2]% Generate `standard' parbox parameters for panels.
+{%
+ \@@mk@panel@TP{#1}{[#2-\panelmargin*2][s]}%
+ }
+
+
+\@ifclassloaded{powersem}
+{%
+ \newcommand{\panelalignment}{\sem@ptsize{\slide@ptsize}\large\normalsize}%
+}
+{%
+ \newcommand{\panelalignment}% Justification for panels. This setting allows a certain amount of
+ {\setlength{\rightskip}{0pt plus 20pt}}% `right-raggedness'. Leave empty for standard parbox formatting.
+}
+
+% Make a panel box.
+\newcommand{\@@mk@panel@TP}[4]
+{%
+ \vbox
+ {%
+ \offinterlineskip
+ \kern\panelmargin% Top margin.
+ \hbox
+ {{%
+ \ifthenelse{\boolean{instepwise@TP}}% Inside \stepwise, colors mat have been dimmed, leaking out to panels.
+ {\usecolorset{stwcolors}}{}% Restore them, just in case.
+ \color{#3}% Set panel text color.
+ \kern\panelmargin% Left margin.
+ \parbox[b]#2{#1-\panelmargin*2}% The parbox with the main panel contents.
+ {%
+ \normalfont
+ \panelalignment#4%
+ \hrule\@height\z@% The hrule makes sure the total height of this box can be measured appropriately.
+ }%
+ \kern\panelmargin% Right margin.
+ }}%
+ \kern\panelmargin% Bottom margin.
+ }%
+ }
+% \end{macrocode}
+%
+% \subsection{Navigation helpers}
+%
+% The following code is rather preliminary and provides only the very basics for making navigation buttons and such. If
+% you're using a package which allows to do this, don't even consider using the following.
+%
+% Some configurable button parameters.
+%
+% Space between button label and border.
+% \begin{macrocode}
+\newcommand{\buttonsep}{\fboxsep}
+% \end{macrocode}
+% Width of button frame.
+% \begin{macrocode}
+\newcommand{\buttonrule}{0pt}
+% \end{macrocode}
+% Horizontal displacement of button shadow.
+% \begin{macrocode}
+\newcommand{\buttonshadowhshift}{.3\fboxsep}
+% \end{macrocode}
+% Vertical displacement of button shadow.
+% \begin{macrocode}
+\newcommand{\buttonshadowvshift}{-.3\fboxsep}
+% \end{macrocode}
+%
+% Button-specific user level commands.
+%
+% \begin{macro}{\button}
+% |\button[<width>][<height>][<depth>][<alignment>]{<navcommand>}{<text>}| creates a button labelled |<text>| which executes
+% |<navcommand>| when pressed.
+% |<navcommand>| can be for instance |\Acrobatmenu{<command>}| or |\hyperlink{<target>}| (note that <navcommand> should take
+% one (more) argument specifying the sensitive area which is provided by |\button|).
+% If given, the optional parameters |<width>|, |<height>|, and |<depth>| give the width, height and depth, respectively, of
+% the framed area comprising the button (excluding the shadow, but including the frame). Default are the `real' width,
+% height and depth, respectively, of |<text>|, plus allowance for the frame.
+% If given, the optional parameter |<alignment>| (one of l,c,r) gives the alignment of |<text>| inside the button box (makes
+% sense only if |<width>| is given).
+% \begin{macrocode}
+\newcommand{\button}[1][0pt]% Collect first optional parameter.
+{%
+ \mklength@TP\bt@width@TP{#1}% Store optional argument.
+ \button@TP
+}
+
+\newcommand{\button@TP}[1][0pt]% Collect second optional parameter.
+{%
+ \mklength@TP\bt@height@TP{#1}% Store optional argument.
+ \@button@TP
+}
+
+\newcommand{\@button@TP}[1][0pt]% Collect third optional parameter.
+{%
+ \mklength@TP\bt@depth@TP{#1}% Store optional argument.
+ \@@button@TP
+}
+
+\newcommand{\@@button@TP}[3][c]% Collect fourth optional and two mandatory parameters and proceed.
+{%
+ \ifthenelse{\lengthtest{\bt@width@TP=0pt}}% <width> given?
+ {\mklength@TP{\bt@width@TP}{\widthof{#3}}}% No. Calculate width of <text>.
+ {\mklength@TP{\bt@width@TP}{\bt@width@TP-\buttonsep*2-\buttonrule*2}}% Yes. Calculate area left for <text>.
+ \ifthenelse{\lengthtest{\bt@height@TP=0pt}}% <height> given?
+ {\mklength@TP{\bt@height@TP}{\heightof{#3}}}% No. Calculate height of <text>.
+ {\mklength@TP{\bt@height@TP}{\bt@height@TP-\buttonsep-\buttonrule}}% Yes. Calculate area left for <text>.
+ \ifthenelse{\lengthtest{\bt@depth@TP=0pt}}% <depth> given?
+ {\mklength@TP{\bt@depth@TP}{\depthof{#3}}}% No. Calculate depth of <text>.
+ {\mklength@TP{\bt@depth@TP}{\bt@depth@TP-\buttonsep-\buttonrule}}% Yes. Calculate area left for <text>.
+ \leavevmode% \rlap creates a `raw' hbox. So we get into horizontal mode.
+ \rlap% Make shadow.
+ {%
+ \hspace*{\buttonshadowhshift}% Horizontal displacement.
+ \raisebox{\buttonshadowvshift}% Vertical displacement.
+ {%
+ {% Inner group for correct color handling.
+ \setcolor@TP{buttonshadowcolor}% Button shadow color.
+ \rule% Create colored rectangular patch of appropriate dimensions.
+ [-\bt@depth@TP-\buttonsep-\buttonrule]
+ {\bt@width@TP+\buttonsep*2+\buttonrule*2}
+ {\bt@height@TP+\bt@depth@TP+\buttonsep*2+\buttonrule*2}%
+ }% matches inner group
+ }% matches \raisebox{\buttonshadowvshift}{%
+ }% matches \rlap{%
+ \edef\o@fboxrule@TP{\the\fboxrule}% Preserve original definitions of \fbox parameters.
+ \edef\o@fboxsep@TP{\the\fboxsep}%
+ #2% Execute <navcommand>.
+ {%
+ \setlength{\fboxrule}{\buttonrule}% Set \fbox parameters for button frame.
+ \setlength{\fboxsep}{\buttonsep}%
+ \fcolorbox{buttonframecolor}{buttoncolor}% Create button frame with the right colors.
+ {%
+ \makebox[\bt@width@TP][#1]% Create box of correct width to contain <text>.
+ {%
+ \raisebox{0pt}[\bt@height@TP][\bt@depth@TP]% Create box of correct height and depth.
+ {%
+ \setlength{\fboxrule}{\o@fboxrule@TP}\setlength{\fboxsep}{\o@fboxsep@TP}% Restore fbox parameters.
+ \setcolor@TP{buttontextcolor}#3% Produce <text>.
+ }% matches \raisebox{0pt}[\bt@height@TP][\bt@depth@TP]{%
+ }% matches \makebox[\bt@width@TP][#1]{%
+ }% matches \fcolorbox{buttonframecolor}{buttoncolor}{%
+ }% matches argument of <navcommand>.
+ }% matches \newcommand{\@@button@TP}[3][c]{%
+% \end{macrocode}
+% \end{macro}
+%
+% Some predefined buttons.
+%
+% Size of predefined button symbols.
+% \begin{macrocode}
+\newcommand{\buttonsymbolsize}{\footnotesize}
+% \end{macrocode}
+% Define predefined button symbols.
+% \begin{macrocode}
+\@ifpackageloaded{amssymb}% AMS symbols available?
+{% Yes. Use `black' symbols.
+ \newcommand{\buttonleftarrowsymbol}{{\buttonsymbolsize\boldmath\origmath{\blacktriangleleft}}}% `left' arrow.
+ \newcommand{\buttonrightarrowsymbol}{{\buttonsymbolsize\boldmath\origmath{\blacktriangleright}}}% `right' arrow.
+ \newcommand{\buttonbackarrowsymbol}{{\buttonsymbolsize\boldmath\origmath{\vartriangleleft}}}% `back' arrow.
+}
+{% No. Use replacements from standard set.
+ \newcommand{\buttonleftarrowsymbol}{{\buttonsymbolsize\boldmath\origmath{\lhd}}}% `left' arrow.
+ \newcommand{\buttonrightarrowsymbol}{{\buttonsymbolsize\boldmath\origmath{\rhd}}}% `right' arrow.
+ \newcommand{\buttonbackarrowsymbol}{{\buttonsymbolsize\boldmath\origmath{\leftarrow}}}% `back' arrow.
+}
+% \end{macrocode}
+% Width of predefined buttons.
+% \begin{macrocode}
+\newcommand{\stdbuttonwidth}{\widthof{\buttonrightarrowsymbol\buttonrightarrowsymbol\buttonrightarrowsymbol}+4pt}
+% \end{macrocode}
+% Customizeable default: How to find the number of the current page?
+% \begin{macrocode}
+\newcommand{\currentpagevalue}{\value{page}}
+% \end{macrocode}
+%
+% Predefined button: last subpage of previous page.
+% \begin{macrocode}
+\newcommand{\backpagebutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\setcounter{tmpcnta@TP}{\currentpagevalue-1}\hyperlink{page.\thetmpcnta@TP}}
+ {\buttonleftarrowsymbol\buttonleftarrowsymbol}%
+ }
+% \end{macrocode}
+% Predefined button: previous step.
+% \begin{macrocode}
+\newcommand{\backstepbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{PrevPage}}
+ {\buttonleftarrowsymbol}%
+ }
+% \end{macrocode}
+% Predefined button: `undo action' (go back to whatever was before last action).
+% \begin{macrocode}
+\newcommand{\gobackbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{GoBack}}
+ {\buttonbackarrowsymbol}%
+ }
+% \end{macrocode}
+% Predefined button: next step.
+% \begin{macrocode}
+\newcommand{\nextstepbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{NextPage}}
+ {\buttonrightarrowsymbol}%
+ }
+% \end{macrocode}
+% Predefined button: first subpage of next page.
+% \begin{macrocode}
+\newcommand{\nextpagebutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\setcounter{tmpcnta@TP}{\currentpagevalue+1}\hyperlink{firstpage.\thetmpcnta@TP}}
+ {\buttonrightarrowsymbol\buttonrightarrowsymbol}%
+ }
+% \end{macrocode}
+% Predefined button: last subpage of next page.
+% \begin{macrocode}
+\newcommand{\nextfullpagebutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\setcounter{tmpcnta@TP}{\currentpagevalue+1}\hyperlink{page.\thetmpcnta@TP}}
+ {\buttonrightarrowsymbol\buttonrightarrowsymbol\buttonrightarrowsymbol}%
+ }
+% \end{macrocode}
+% Predefined button: toggle fullscreen mode.
+% \begin{macrocode}
+\newcommand{\fullscreenbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{FullScreen}}
+ {\buttonrightarrowsymbol\buttonleftarrowsymbol}%
+ }
+% \end{macrocode}
+%
+% \subsection{Set acrobat reader's page transition mode}
+%
+% Most of the following is snarfed from an email message of Marc van Dongen to the ppower4 mailing list on Thu, 7 Oct
+% 1999.
+% Thanks to Marc for his permission to include his code into this package.
+% \begin{macro}{\pagetransition}
+% |\pagetransition{<setting>}| is a generic command for setting the page transition with hyperref's |\hypersetup|. The
+% command is defined to a noop in case hyperref is not loaded.
+% \begin{macrocode}
+\ifthenelse{\boolean{display}}% Are dynamic features enabled?
+{% Yes.
+ \newcommand{\pagetransition}[1]% Definition for preamble.
+ {%
+ \@ifpackageloaded{hyperref}% Can we use \hypersetup?
+ {% Yes.
+ \hypersetup{pdfpagetransition={#1}}% Set page transition with \hypersetup.
+ }
+ {% No. In this case, we can't set the page transition.
+ \PackageWarning{texpower}
+ {Package hyperref not loaded.\MessageBreak Page transition not set}%
+ }%
+ }% matches \newcommand{\pagetransition}[1]{%
+ \AtBeginDocument% Definition for document body.
+ {%
+ \@ifpackageloaded{hyperref}% Can we use \hypersetup?
+ {% Yes.
+ \hypersetup{pdfpagetransition={}}% Make pagetransition setting (consistently) local to groups.
+ \renewcommand{\pagetransition}[1]{\hypersetup{pdfpagetransition={#1}}}%
+ }
+ {% No. Disable page transitions.
+ \PackageWarning{texpower}
+ {Package hyperref not loaded.\MessageBreak Page transitions disabled}%
+ \let\pagetransition=\@gobble
+ }%
+ }% matches \AtBeginDocument{%
+ }% matches \ifthenelse{\boolean{display}}{%
+{\let\pagetransition=\@gobble}% No. Disable page transitions.
+% \end{macrocode}
+% \end{macro}
+% Some standard page transitions.
+% \begin{macrocode}
+\newcommand{\pageTransitionSplitHO}{\pagetransition{Split /Dm /H /M /O}}% Split Horizontally to the outside.
+
+\newcommand{\pageTransitionSplitHI}{\pagetransition{Split /Dm /H /M /I}}% Split Horizontally to the inside.
+
+\newcommand{\pageTransitionSplitVO}{\pagetransition{Split /Dm /V /M /O}}% Split Vertically to the outside.
+
+\newcommand{\pageTransitionSplitVI}{\pagetransition{Split /Dm /V /M /I}}% Split Vertically to the inside.
+
+\newcommand{\pageTransitionBlindsH}{\pagetransition{Blinds /Dm /H}}% Horizontal Blinds.
+
+\newcommand{\pageTransitionBlindsV}{\pagetransition{Blinds /Dm /V}}% Vertical Blinds.
+
+\newcommand{\pageTransitionBoxO}{\pagetransition{Box /M /O}}% Growing Box.
+
+\newcommand{\pageTransitionBoxI}{\pagetransition{Box /M /I}}% Shrinking Box.
+
+% argument must be number fom 0 to 360
+\newcommand{\pageTransitionWipe}[1]{\pagetransition{Wipe /Di #1}}% Wipe from one edge of the page to the facing edge.
+
+\newcommand{\pageTransitionDissolve}{\pagetransition{Dissolve}}% Dissolve.
+
+% argument must be number fom 0 to 360
+\newcommand{\pageTransitionGlitter}[1]{\pagetransition{Glitter /Di #1}}% Glitter from one edge to the facing edge.
+
+\newcommand{\pageTransitionReplace}{\pagetransition{Replace}}% Simple Replace (the default).
+% \end{macrocode}
+%
+% \subsection{Set acrobat reader's automatic page advancing feature}
+%
+% |\pageDuration{<d>}| will force pages to be advanced automatically after |<d>| seconds when in full screen mode. The
+% effect starts on the current page and is undone by a group end or the command |\stopAdvancing|. |<d>| should be a
+% (fixed-point) number.
+%
+% Note a very strange behaviour of acrobat and acroread v4.05 and onwards: Automatic advancing is disabled unless
+% explicitly enabled by the ``advance every n seconds'' setting in the full screen dialogue. But in this case, all
+% pages not having any page duration setting will be advanced after |<n>| seconds. As another trap, at least in some
+% versions of acroread and acrobat, the maximum for |<n>| when set in the dialogue is 60 seconds. To make matters even
+% worse, there seems to be a (quite arbitrary) even for duration setting of pages: 546 seconds (about nine minutes).
+% This leaves you with the following options if you want to use automated advancing in your presentations (for animation
+% effects, say):
+%
+% \begin{enumerate}
+% \item You're using a version of acrobat or acroread predating 4.05 (or any other version where this misbehaviour
+% miraculously isn't present): All is well, nothing to do.
+%
+% \item You're using a `buggy' version where more than 60 seconds can be set as a value for |<n>| in the full screen dialogue
+% (I'm not sure whether such a beast exists; maybe both `features' coincide): Just activate automatic advancing in the
+% full screen dialogue and set an `infinite' number of seconds (3600, say). This value is masked by an explicit setting
+% using |\pageDuration|, so animations will still work.
+%
+% \item You're using a `buggy' version with a maximum dialogue setting of 60, but you're comfortable with your presentation
+% always advancing automatically at least every 60 seconds: Set |<n>| to 60 and proceed as above.
+%
+% \item You're using a `buggy' version with a maximum dialogue setting of 60 and you're comfortable with your presentation
+% always advancing automatically at least every 546 seconds (9.1 minutes): Give the package option ``nineminutes'' to
+% texpower. This will put an explicit duration setting of 546 seconds on every page (overridden by explicit settings
+% using |\pageDuration|). Set the advancing time in the full screen dialogue to anything; it will be ignored because every
+% page has an explicit setting.
+%
+% \item You're using a `buggy' version with a maximum dialogue setting of 60, you'd like your presentation to advance more
+% slowly than every 546 seconds and your version of acroread or acrobat miraculously doesn't have the upper bound of 546
+% seconds (which I've empirically discovered with acrobat 5.0 on Win NT): Put |\renewcommand{\infinitepageduration}{3600}|
+% in your preamble and see what happens. If the value is too high, acroread will go into fast forward mode or do other
+% strange things. Otherwise: Lucky you.
+%
+% \item You're using a `buggy' version with a maximum dialogue setting of 60, you'd like your presentation to advance more
+% slowly than every 546 seconds and your version of acroread or acrobat also has the upper bound of 546 seconds: In this
+% case you're out of luck. Of course you can try to get the guys at adobe to clean up this whole mess. Good luck with
+% that!
+% \end{enumerate}
+%
+% If |\infinitepageduration| is set to empty, then a page duration setting will appear only where |\pageDuration| was
+% used. Otherwise, every page without explicit setting gets a page duration of |\infinitepageduration|.
+% \begin{macrocode}
+\newcommand{\infinitepageduration}{}% Default: No page duration setting on every page.
+
+\ifthenelse{\boolean{nineminutes@TP}}% If the option nineminutes is given, every page without explicit setting
+{\renewcommand{\infinitepageduration}{546}}{}% gets a setting of 546 seconds (9.1 minutes).
+% \end{macrocode}
+% Implementation of |\pageDuration|.
+% \begin{macrocode}
+\ifthenelse{\boolean{display}}% Are dynamic features enabled?
+{% Yes.
+ \newcommand{\pageDuration}[1]% Definition for preamble.
+ {%
+ \@ifpackageloaded{hyperref}% Can we use \hypersetup?
+ {% Yes.
+ \hypersetup{pdfpageduration={#1}}% Set page duration with \hypersetup.
+ }%
+ {% No. In this case, we can't set the page duration.
+ \PackageWarning{texpower}
+ {Package hyperref not loaded.\MessageBreak Page duration not set}%
+ }%
+ }% matches \newcommand{\pageDuration}[1]{%
+ \AtBeginDocument% Make sure this also works if texpower is loaded before hyperref.
+ {%
+ \@ifpackageloaded{hyperref}% Can we use \hypersetup?
+ {% Yes.
+ \edef\next{\noexpand\hypersetup{pdfpageduration={\infinitepageduration}}}%
+ \next% Set default page duration.
+ \renewcommand{\pageDuration}[1]{\hypersetup{pdfpageduration={#1}}}% Set page duration with \hypersetup.
+ }%
+ {% No. In this case, we can't set the page duration.
+ \PackageWarning{texpower}
+ {Package hyperref not loaded.\MessageBreak Page duration disabled}%
+ \let\pageDuration=\@gobble
+ }%
+ }% matches \AtBeginDocument{%
+ }% matches \ifthenelse{\boolean{display}}{%
+{\let\pageDuration=\@gobble}% No. Disable page duration.
+% \end{macrocode}
+% |\stopAdvancing| undoes any setting effected by |\pageDuration|.
+% \begin{macrocode}
+\newcommand{\stopAdvancing}
+{\edef\next{\noexpand\pageDuration{\infinitepageduration}}\next}% Reset to default page duration.
+% \end{macrocode}
+%
+% \subsection{TeXPower kernel}
+%
+% This area contains the `low level' implementation of TeXPowers central functions. Mainly, (La)TeX's |\shipout| and
+% |\output| routines are overloaded, adding some necessary functionality (duplication of page contents for incremental
+% page building; display of backgrounds and panels).
+% Also, the user command |\pause| is implemented here, using the kernel functions for saving and restoring page contents.
+%
+% The code for overloading the output routine is derived from Klaus Guntermanns texpause package which can be obtained
+% from the PPower4 Web site
+%
+% |http://www-sp.iti.informatik.tu-darmstadt.de/software/ppower4/|
+%
+% Thanks to Heiko Oberdiek for his suggestion how |\leaders| can be used to disable processing of whatsits in the
+% duplicated text.
+%
+% The code for overloading |\shipout| is derived from everyshi.sty with permission by Martin Schroeder.
+%
+% \subsubsection{Overload \textbackslash shipout}
+%
+% Overloading is done at the beginning of the document just in case some other package messes with |\shipout|.
+% \begin{macrocode}
+\AtBeginDocument{\shipoutinit@TP}%
+% \end{macrocode}
+% Replace |\shipout| by own definition.
+% \begin{macrocode}
+\newcommand*{\shipoutinit@TP}
+{%
+ \let\o@shipout@TP=\shipout% Memorize previous definition.
+ \let\shipout\shipout@TP% Replace by own one.
+ }%
+% \end{macrocode}
+% Our own version of |\shipout| takes the offered box and passes it to another routine for further inspection.
+% \begin{macrocode}
+\newcommand{\shipout@TP}
+{%
+ \afterassignment\shipout@test@TP
+ \global\setbox\@cclv= %
+ }%
+% \end{macrocode}
+% If |\shipout| is called with an argument of the form |\box<n>|, then the box will have indeed been assigned to |\@cclv| at
+% the time |\shipout@test@TP| is called. In this case, |\shipout@output@TP| is called immediately. If |\shipout| is called
+% with an argument of the form |\vbox{...}|, then |\shipout@test@TP| is called at the beginning of the box definition,
+% \textbf{before} the box is assigned (this is a feature of |\afterassignment|). In this case, the call of
+% |\shipout@output@TP| is moved \textbf{after} the box definition using |\afetrgroup|, so that |\@cclv| is correctly
+% defined at the time |\shipout@output@TP| is executed.
+% \begin{macrocode}
+\newcommand{\shipout@test@TP}
+{%
+ \ifvoid\@cclv\relax% Is the box assigned yet?
+ \aftergroup\shipout@output@TP% No; defer execution of \shipout@output@TP.
+ \else
+ \shipout@output@TP% Yes; execute \shipout@output@TP immediately.
+ \fi%
+ }%
+% \end{macrocode}
+% The main part of our redefinition of |\shipout|.
+% \begin{macrocode}
+\newcommand{\shipout@output@TP}
+{%
+ \shipout@hook@TP% Here, our own stuff is executed, manipulating \@cclv.
+ \o@shipout@TP\box\@cclv% Execute original shipout routine.
+ }%
+% \end{macrocode}
+%
+% \subsubsection{The kernel functions to be executed at \textbackslash shipout}
+%
+% |\AtShipout{<code>}| will save |<code>| in a special place where it is executed at the time of the next |\shipout| (and
+% then deleted). Needless to say it should not produce any output. This is mainly for placing anchors in a controlled way
+% even inside incremental builds.
+% \begin{macrocode}
+\newcommand{\AtShipout}[1]
+{\expandafter\gdef\expandafter\at@shipout@once@TP\expandafter{\at@shipout@once@TP#1}}% Add argument to container.
+% \end{macrocode}
+% The container for |<code>| stored away by |\AtShipout|. This is placed on the page by the next |\shipout| and then deleted.
+% \begin{macrocode}
+\newcommand{\at@shipout@once@TP}{}
+% \end{macrocode}
+% Save the original definition of |\hyper@@anchor|.
+% \begin{macrocode}
+\AtBeginDocument{\global\let\o@hyper@@anchor\hyper@@anchor}
+% \end{macrocode}
+% The following makes sure that a hyper target |firstpage.<n>| is placed on the \textbf{first} subpage of every page.
+% \begin{macrocode}
+\@ifpackageloaded{hyperref}% Is hyperref loaded?
+{% Yes. Prepare hook.
+ \newcommand{\do@insert@firstanchor@TP}% This is executed on the first subpage of every page.
+ {\hypertarget{firstpage.\number\currentpagevalue}{}}% Create target.
+ }
+{\newcommand{\do@insert@firstanchor@TP}{}}% No. Leave hook empty.
+% \end{macrocode}
+% This is executed on every subpage which is \textbf{not} the first one.
+% \begin{macrocode}
+\newcommand{\dont@insert@firstanchor@TP}{}%
+% \end{macrocode}
+% This is the hook itself which is executed on every page.
+% \begin{macrocode}
+\newcommand{\insert@firstanchor@TP}{\do@insert@firstanchor@TP}%
+% \end{macrocode}
+%
+% The hook executed at every call of |\shipout|. It executes the following tasks:
+% \begin{enumerate}
+% \item Filter out whatsits on duplicate pages.
+% \item Put page background at the `lowest' layer.
+% \item Put panels at the `second lowest' layer.
+% \item Execute |\AtShipout| code and place hypertarget |firstpage.<n>|.
+% \item Put |\box\@cclv| at `top' layer.
+% \end{enumerate}
+% \begin{macrocode}
+\newcommand{\shipout@hook@TP}
+{%
+ \filterpage@TP% Filter out whatsits on duplicate pages.
+ \setbox\@cclv=% Create `real' page box (which is later shipped out).
+ \hbox{%
+ \set@typeset@protect
+ \raise\ht\@cclv\rlap% Place background box.
+ {%
+ \vtop to \TPpageheight
+ {%
+ \offinterlineskip
+ \hrule\@height\z@\relax
+ \kern -1truein\relax
+ \kern -\voffset\relax
+ \moveleft 1truein\hbox{\kern-\hoffset\copy\bgndbox@TP}%
+ \vss
+ \kern 1truein\relax
+ \kern\voffset\relax
+ }%
+ }%
+ \raise\ht\@cclv\rlap% Place `vertical' panels.
+ {%
+ \vtop to \TPpageheight
+ {%
+ \offinterlineskip
+ \hrule\@height\z@\relax
+ \kern -1truein\relax
+ \kern -\voffset\relax
+ \moveleft 1truein\hb@xt@\TPpagewidth
+ {%
+ \kern-\hoffset\raise\leftpanelraise\hbox{\mk@leftpanel@TP}%
+ \hfill
+ \raise\rightpanelraise\hbox{\mk@rightpanel@TP}%
+ \kern\hoffset
+ }%
+ \vss
+ \kern 1truein\relax
+ \kern\voffset\relax
+ }%
+ }%
+ \raise\ht\@cclv\rlap% Place `horizontal' panels.
+ {%
+ \vtop to \TPpageheight
+ {%
+ \offinterlineskip
+ \hrule\@height\z@\relax
+ \kern -1truein\relax
+ \kern -\voffset\relax
+ \moveleft 1truein\hbox{\kern-\hoffset\kern\toppanelshift\mk@toppanel@TP}%
+ \vfill
+ \moveleft 1truein\hbox{\kern-\hoffset\kern\bottompanelshift\mk@bottompanel@TP}%
+ \kern 1truein\relax
+ \kern\voffset\relax
+ }%
+ }%
+ \raise\ht\@cclv\rlap
+ {%
+ \let\hyper@@anchor\o@hyper@@anchor% Reactivate hyper anchors.
+ \insert@firstanchor@TP% Execute hook for creating target firstpage.<n>
+ \ifshippingduplicate% Will further subpages follow?
+ \global\let\insert@firstanchor@TP=\dont@insert@firstanchor@TP% Deactivate hook for next page.
+ \else
+ \global\let\insert@firstanchor@TP=\do@insert@firstanchor@TP% Reactivate hook for next page.
+ \fi
+ \at@shipout@once@TP% Execute code stored away by \AtShipout.
+ }%
+ \global\let\at@shipout@once@TP=\empty% Clear \AtShipout container.
+ \box\@cclv
+ }%
+ }
+% \end{macrocode}
+%
+% \subsubsection{Implementation of `fixcolorstack' option}
+%
+% The problem is this: dvips (and some other tools) maintains a color stack when converting dvi to ps. Its function is
+% to always be able to correctly switch back to the previously used color even if there is a page break (and according
+% typesetting of headers etc) inbetween switching to another color and switching back.
+% This has many advantages (pdftex, for instance, which doesn't maintain a color stack, always has problems to restore
+% the correct text color after a page break).
+% In connection with TeXPower, however, this leads to problems. For controlling the color stack, push and pop commands
+% are inserted into the dvi using specials. At typesetting time, these specials are stored in the vertical list. When
+% page contents are copied, it might be that the copy contains an unequal number of push and pop commands, which will
+% make dvips's color stack go out of sync.
+% To remedy this, texpower maintains a `counter stack' which should contain all color stack commands issued on the
+% current page. Whenever a copied page is shipped out, appropriate color stack correction commands are issued to balance
+% the stack.
+% As this is necessary only for drivers implementing a color stack, the option is disabled for some drivers.
+% \begin{macrocode}
+\def\colorcorrections@TP{\relax}% The `counter stack' of color correction codes, reset at every \shipout.
+
+\AtBeginDocument% Make sure to catch color.sty even if it's loaded after texpower.
+{%
+ \ifthenelse{\boolean{fixcolorstack@TP}}% Was the fixcolorstack option given?
+ {%
+ \@ifundefined{VTeXversion}% Using vtex?
+ {% No. Go on.
+ \ifthenelse{\boolean{pdf}}% Producing pdf with pdftex?
+ {% Yes. Color stack fixing unnecessary.
+ \PackageWarning{texpower}
+ {pdftex doesn't need color stack correction.\MessageBreak Option fixcolorstack disabled.}%
+ }
+ {% No. We need to add corrections for the color stack...
+ \@ifpackageloaded{color}% ... but only if color.sty is loaded at all.
+ {%
+ \expandafter\def\expandafter\shipout@hook@TP\expandafter% Extend \shipout hook ...
+ {\shipout@hook@TP\clearcolorcorrections@TP}% ... by a command to clear counter stack.
+ %
+ \newcommand{\clearcolorcorrections@TP}% The counter stack is cleared...
+ {% ... on all `final' shipouts.
+ \ifshippingduplicate
+ \else
+ \gdef\colorcorrections@TP{\relax}%
+ \fi
+ }
+% \end{macrocode}
+% Pray to god all drivers will support the following hacks...
+%
+% Save `original' definition of |\set@color|. Our redefinition of |\reset@color| needs to know which color is
+% being reset, so we add this as an argument. As it would be inconvenient to add a lot of tokens with
+% |\aftergroup|, we wrap everything in a control sequence.
+% \begin{macrocode}
+ \expandafter\def\expandafter\o@set@color@TP\expandafter%
+ {%
+ \set@color% This is the `real' original definition.
+ \expandafter\aftergroup\csname\current@color\endcsname% Add definition of \current@color.
+ }%
+
+ \let\o@reset@color@TP=\reset@color% Save original definition of \reset@color.
+% \end{macrocode}
+% We need one command to `just push' a color on the stack. Pushing is done by |\set@color| in a driver-specific
+% way. But |\set@color| also creates an instance of |\reset@color| using |\aftergroup|. This instance is gobbled by
+% this hack, hopefully leaving only the driver-specific code to push a color. Of course, this will break
+% spectacularly if |\set@color| doesn't have the form |{<do something>\aftergroup\reset@color}|.
+% \begin{macrocode}
+ \def\remove@resetcolor@TP#1\aftergroup\reset@color%
+ {\def\pushcolor@TP##1{{\def\current@color{##1}#1}}}%
+ %
+ \expandafter\remove@resetcolor@TP\set@color
+% \end{macrocode}
+% |\reset@color| gets the color definition in the form of a control sequence (because of |\aftergroup|, see
+% above). We have to `unwrap' it before pushing.
+% \begin{macrocode}
+ \def\pushcolorname@TP#1%
+ {%
+ \begingroup \escapechar\m@ne\xdef\@gtempa{\string#1}\endgroup% Get the coded tokens back (without \ ).
+ \expandafter\pushcolor@TP\expandafter{\@gtempa}% ... and execute push.
+ }%
+% \end{macrocode}
+% Our own definition of |\set@color| adds a |\reset@color| command for the color just set to |\colorcorrections@TP|.
+% \begin{macrocode}
+ \def\set@color%
+ {%
+ \o@set@color@TP% `Original' definition of \set@color.
+ \expandafter\@temptokena\expandafter{\colorcorrections@TP}% Add \o@reset@color@TP command at the front
+ \xdef\colorcorrections@TP{\noexpand\o@reset@color@TP\the\@temptokena}% ... of \colorcorrections@TP.
+ }
+
+ \def\reset@color#1% \reset@color now receives the name of the color.
+ {%
+ \expandafter\addpushtoccor@TP\colorcorrections@TP\@nil{#1}% Add a push command for this color to the front
+ % of \colorcorrections@TP.
+ \o@reset@color@TP% `Original' definition of \reset@color.
+ }%
+
+ \def\addpushtoccor@TP#1#2\@nil#3% Add a push command for some color to the front of \colorcorrections@TP.
+ {%
+ \ifx\o@reset@color@TP#1% For efficiency, a push immediately followed by a reset cancel out.
+ \gdef\colorcorrections@TP{#2}%
+ \else
+ \gdef\colorcorrections@TP{\pushcolorname@TP{#3}#1#2}% Otherwise, add the push to \colorcorrections@TP.
+ \fi
+ }%
+ }% matches \@ifpackageloaded{color}
+ {}% No changes needed if color.sty is not loaded.
+ }% matches second argument of \ifthenelse{\boolean{pdf}}
+ }% matches \@ifundefined{VTeXversion}
+ {% Yes. Color stack fixing unnecessary.
+ \PackageWarning{texpower}
+ {vtex doesn't need color stack correction.\MessageBreak Option fixcolorstack disabled.}%
+ }%
+ }% matches \ifthenelse{\boolean{fixcolorstack@TP}}
+ {}%
+ }% matches \AtBeginDocument
+% \end{macrocode}
+%
+% \subsubsection{Kernel functions for overloading \textbackslash output}
+%
+% This is the `inner kernel' which lies behind all dynamic effects.
+%
+% Some user level parameters.
+%
+% This flag can be evaluated at |\output| (resp. |\shipout|) time and tells whether the page being shipped out is a
+% duplicate page.
+% \begin{macrocode}
+\newif\ifshippingduplicate
+% \end{macrocode}
+% The command used to shipout a duplicate page.
+% \begin{macrocode}
+\providecommand{\TPeject}{\newpage}
+% \end{macrocode}
+%
+% Some internal registers to store away things.
+%
+% Contents of the page so far. These have to be duplicated on every subpage.
+% \begin{macrocode}
+\newbox\mempageconts@TP
+% \end{macrocode}
+% Footnotes on the page being duplicated. These have to be duplicated also.
+% \begin{macrocode}
+\newinsert\memfootins@TP
+% \end{macrocode}
+% Original definition of output routine.
+% \begin{macrocode}
+\newtoks\memoutput@TP
+% \end{macrocode}
+%
+% Save current page contents to a box.
+%
+% Which counters are to be restored to their original value after |\pause|?
+% \begin{macrocode}
+\def\cl@@ckptpause@TP{\@elt{page}}
+% \end{macrocode}
+% Save values of counters from |\cl@@ckptpause@TP| so that they can be restored with |\restorepausecounters@TP|.
+% \begin{macrocode}
+\def\savepausecounters@TP{%
+ \begingroup
+ \def\@elt##1{\global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
+ \xdef\restorepausecounters@TP{\cl@@ckptpause@TP}%
+ \endgroup
+ }
+% \end{macrocode}
+% User-level command to add a counter name to |\cl@@ckptpause@TP|.
+% \begin{macrocode}
+\newcommand{\pausesafecounter}[1]%
+{\expandafter\def\expandafter\cl@@ckptpause@TP\expandafter{\cl@@ckptpause@TP\@elt{#1}}}
+% \end{macrocode}
+% Setting |\pausesafecounter| for common classes
+% \begin{macrocode}
+\@ifclassloaded{seminar}{\pausesafecounter{slide}}{}
+% \end{macrocode}
+% Save the current page contents to the box |\mempageconts@TP| by overloading and triggering |\output|. Footnotes are also
+% saved. The saved page contents are used by |\pause| and all |\stepwise| variants for making duplicates of page contents.
+% \begin{macrocode}
+\def\save@TP
+{%
+ \par% Always end current paragraph.
+ \global\setbox\mempageconts@TP=\copy\voidb@x% Initialise \mempageconts@TP (suggested by Ross Moore).
+ \savepausecounters@TP% Save counters.
+ \memoutput@TP=\output% Make backup copy of output routine.
+ \output={\global\setbox\mempageconts@TP=\box\@cclv}% Copy current page contents.
+ \eject% Trigger now.
+ \global\setbox\memfootins@TP=\copy\footins% Save footnotes.
+ \global\skip\memfootins@TP=\skip\footins
+ \global\count\memfootins@TP=\count\footins
+ \global\dimen\memfootins@TP=\dimen\footins
+ \output=\memoutput@TP% Restore output routine.
+ }
+% \end{macrocode}
+%
+% \subsection{Kernel functions for re-inserting page contents}
+%
+% Used by |\pause| and also by variants of |\stepwise|.
+%
+% Filter file and anchor whatsits out of a duplicate page. Called by |\shipout@hook@TP|. Does nothing by default.
+% \begin{macrocode}
+\let\filterpage@TP\relax
+% \end{macrocode}
+% Interpretation of |\filterpage@TP| for duplicate pages. Assigned by |\outputduplicate@TP|.
+% \begin{macrocode}
+\newcommand{\filterwhatsits@TP}{\global\setbox\@cclv=\hbox{\leaders\copy\@cclv\hskip\wd\@cclv}}
+% \end{macrocode}
+% Insert saved page contents for the first time.
+% \begin{macrocode}
+\newcommand{\insertfirstduplicate@TP}
+{\unvcopy\mempageconts@TP}% Just output the vbox's contents.
+% \end{macrocode}
+%
+% Execute color correction stack accumulated when the fixcolor option is given.
+% \begin{macrocode}
+\newcommand{\do@colorcorrections@TP}
+{%
+ {%
+ \colorcorrections@TP% Execute color correction stack.
+ \gdef\colorcorrections@TP{\relax}% Re-initialize for next round.
+ }%
+ }
+% \end{macrocode}
+%
+% Insert saved page contents for the second time (and all further times).
+% \begin{macrocode}
+\newcommand{\insertsecondduplicate@TP}
+{%
+ \do@colorcorrections@TP% Execute color correction stack.
+ \global\setbox\footins=\copy\memfootins@TP% Restore footnotes.
+ \global\skip\footins=\skip\memfootins@TP
+ \global\count\footins=\count\memfootins@TP
+ \global\dimen\footins=\dimen\memfootins@TP
+ \unvcopy\mempageconts@TP% Output the vbox's contents.
+ }
+% \end{macrocode}
+%
+% Ship out a duplicated page.
+% \begin{macrocode}
+\newcommand{\outputduplicate@TP}
+{%
+ \shippingduplicatetrue% This switch can be evaluated in panels or headers/footers.
+ \global\let\filterpage@TP\filterwhatsits@TP% Filter out file whatsits when shipping out.
+ \global\let\o@hyper@@anchor@TP\hyper@@anchor% Save definition of hyperref command for hyper anchors.
+ \global\let\hyper@@anchor\@gobble% Disable hyper anchors on duplicate pages to avoid duplicate page anchors.
+ \TPeject% Shipout page.
+ \global\let\hyper@@anchor\o@hyper@@anchor@TP% Restore definition of hyperref command for hyper anchors.
+ \global\let\filterpage@TP\relax% Disable whatsit filtering.
+ \shippingduplicatefalse% Unset switch.
+ }%
+% \end{macrocode}
+%
+% \subsubsection{Implementation of \textbackslash pause}
+%
+% |\pause| ends the current paragraph, ships out the current page, starts a new page and copies whatever was on the
+% current page onto the new page, where typesetting is resumed. This will create the effect of a `pause' in the
+% presentation, i.e. the presentation stops because the current page ends at the point where the |\pause| command occurred
+% and is resumed at this point when the presenter switches to the next page.
+%
+% \begin{macrocode}
+\providecommand\pause% If pause.sty is loaded, the existing definition of \pause is not overwritten.
+{%
+ \save@TP% Save contents of the page...
+ \insertfirstduplicate@TP% ... and insert again.
+ \ifthenelse{\boolean{display}}% Are dynamic features enabled?
+ {% Yes.
+ \outputduplicate@TP% Output page.
+ \restorepausecounters@TP% Restore counters (page number).
+ \insertsecondduplicate@TP% Reinsert saved contents.
+ }
+ {}%
+ }%
+% \end{macrocode}
+%
+% \subsection{Implementing \cs{stepwise} and all functions surrounding it}
+%
+% General usage: |\stepwise{<contents>}|
+%
+% As of itself, |\stepwise| doesn't do very much. If |<contents>| contains one or more constructs of the form
+% |\step{<stepcontents>}|, the following happens:
+% \begin{enumerate}
+% \item The current paragraph is ended.
+%
+% \item The current contents of the page are saved (as with |\pause|).
+%
+% \item As many pages as there are |\step| commands in |<contents>| are produced.
+% Every page starts with what was on the current page when |\stepwise| started.
+% The first page also contains everything in |<contents>| which is not in |<stepcontents>| for any |\step| command.
+% The second page additionally contains the |<stepcontents>| for the first |\step| command, and so on, until all
+% |<stepcontents>| are displayed.
+%
+% \item When all |<stepcontents>| are displayed, |\stepwise| ends and typesetting is resumed (still on the current page).
+% \end{enumerate}
+%
+% This will create the effect that the |\step| commands are executed `step by step'.
+%
+% For a more detailed description of |\stepwise|, |\step| and their options, see below.
+%
+% Most of the registers, macros and environments defined in the following are part of the user interface, so no @s.
+%
+% \subsubsection{Command administration}
+%
+% \begin{macrocode}
+\newcommand{\@onlyinstepwise@TP}[1]
+{%
+ \providecommand#1%
+ {%
+ \PackageError{texpower}%
+ {Command \string#1 can be used only inside \string\stepwise}
+ {%
+ Commands like \string\step, \string\switch,
+ \string\multistep\space or \string\overlays\MessageBreak
+ can be used only inside the argument of a \string\stepwise\space variant.
+ }%
+ }%
+}
+% \end{macrocode}
+%
+% \subsubsection{Registers}
+%
+% The total number of |\step| commands occurring in |<contents>|.
+% \begin{macrocode}
+\newcounter{totalsteps}
+% \end{macrocode}
+% The number at which the counter step starts counting. Can be set in the optional argument of |\stepwise|.
+% \begin{macrocode}
+\newcounter{firststep}
+% \end{macrocode}
+% The number of the step currently being performed.
+% \begin{macrocode}
+\newcounter{step}
+% \end{macrocode}
+% The number of the current |\step| command (only useful inside |<stepcontents>|).
+% \begin{macrocode}
+\newcounter{stepcommand}
+% \end{macrocode}
+% The total number of |\step| commands which have been activated so far (this can differ from
+% |\value{step}| if the order of |\step| commands is changed via the optional argument of |\step|).
+% \begin{macrocode}
+\newcounter{stepsperformed}
+% \end{macrocode}
+% Is this |\step| command currently active for the first time? (only useful inside |<stepcontents>|).
+% \begin{macrocode}
+\newboolean{firstactivation}
+% \end{macrocode}
+% Is this |\step| command currently active? (only useful inside |<stepcontents>|).
+% \begin{macrocode}
+\newboolean{active}
+% \end{macrocode}
+%
+% \subsubsection{Custom commands for displaying step contents}
+% Some of them are selected by the switches |\boxedsteps| and |\nonboxedsteps|.
+%
+% Display |<stepcontents>| in a box.
+% \begin{macrocode}
+\newcommand{\displayboxed}
+{%
+ \ifmmode % We need to distinguish between math and text mode.
+ \expandafter\mathpalette\expandafter\math@db@TP % In math mode, the style has to be respected.
+ \else
+ \expandafter\text@db@TP
+ \fi
+}
+\newcommand{\text@db@TP}[1]{\mbox{#1}} % In text mode, we just use an \mbox.
+\newcommand{\math@db@TP}[2]{\mbox{$\m@th#1{#2}$}} % In math mode, the style (#1) is inserted by \mathpalette.
+% \end{macrocode}
+%
+% Display |<stepcontents>| `as is'.
+% \begin{macrocode}
+\let\displayidentical=\@iden
+% \end{macrocode}
+%
+% \subsubsection[Custom commands for `hiding' \textbackslash stepcontents ...]%
+% {Custom commands for `hiding' \textbackslash stepcontents at the time
+% the corresponding \textbackslash step is not active.}
+% Hiding stuff is not as easy as it seems...
+% Often, it is desirable that an appropriate amount of `space' is left where something is hidden, in case something
+% visible follows or the hidden stuff is part of an alignment structure. Even if this is not the case, completely
+% ignoring hidden text containing further |\step|'s can disturb the accounting of |\stepwise|, because |\step| numbers become
+% unaligned.
+% On the other hand, a lot of things which might be hidden (solitary |&|'s if the hidden text is part of an alignment
+% structure, for instance) execute an implicit group closing and don't like it at all to be enclosed in boxes, for
+% instance.
+% Because of these conflicting constraints, several methods for hiding content are provided. It is up to the user to
+% select the one most appropriate for each type of content, or to use the suggestions below as inspiration for own
+% definitions.
+%
+% Hide |<stepcontents>|, but display an appropriate amount of white space in the form of an appropriately dimensioned,
+% empty box.
+% \begin{macrocode}
+\newcommand{\hidephantom}[1]
+{%
+ {% a group makes redefinitions local
+ \leavevmode\phantom{#1}%
+% \end{macrocode}
+% |\phantom| normally produces an |\hbox|. |\leavevmode| makes it behave like |\mbox|.
+% \begin{macrocode}
+ }%
+ }
+% \end{macrocode}
+% Ignore |<stepcontents>| completely.
+% \begin{macrocode}
+\newcommand{\hideignore}[1]{}
+% \end{macrocode}
+%
+% Sometimes, ignoring |<stepcontents>| completely can lead to confusion of |\stepwise|'s accounting when |<stepcontents>|
+% contains further |\step| commands. |\hidesmartignore| produces no output, but executes |<stepcontents>| (in a box). Note
+% that this will lead to errors if for instance |<stepcontents>| contains a tabular character |&| from an alignment
+% structure.
+% \begin{macrocode}
+\newcommand{\hidesmartignore}[1]{\setbox\tempbox@TP=\vbox{#1}}
+% \end{macrocode}
+%
+% The command |\hidetext| makes its argument `invisible', but without putting it into a box, thus preserving line
+% breaks.
+% |\hidetext| needs the soul package to work. If it is not loaded, |\hidetext| is defined to be equal to |\hideboxed|.
+% Because of restrictions implied by the soul package, |\hidetext| is quite picky about the `regularity' of its
+% argument. That is, a lot of things will break when in the argument of |\hidetext|. See the documentation of the
+% soul package for hints how to prevent this.
+%
+% To allow soul to be loaded after texpower, we use |\AtBeginDocument|.
+% \begin{macrocode}
+\AtBeginDocument%
+{%
+ \@ifpackageloaded{soul}% Can we use the soul package?
+ {%
+ \@ifpackagelater{soul}{2002/05/28}% Correct version?
+ {% Yes. Let's define the necessary macros.
+ \DeclareRobustCommand*\hidetext
+ {%
+ \leavevmode% To prevent \phantom from inserting an hbox into the vertical list.
+ \SOUL@setup
+ \def\SOUL@everytoken{\phantom{\the\SOUL@token\SOUL@setkern\SOUL@charkern}}% Make current token `invisible'.
+ \def\SOUL@everyhyphen
+ {%
+ \discretionary
+ {%
+ \unkern
+ \phantom{\SOUL@setkern\SOUL@hyphkern\char\hyphenchar\font}% Output an `invisible' hyphen if needed.
+ }{}{}%
+ }%
+ \SOUL@%
+ }%
+ }%
+ {% No. Encourage people to update.
+ \PackageInfo{texpower}
+ {Package soul too old.\MessageBreak Command \string\hidetext\space disabled}%
+ \let\hidetext=\hidephantom% \hidephantom is a sorry excuse for \hidetext...
+ }%
+ }%
+ {% No. In this case, there is no useful definition for \hidetext.
+ \PackageInfo{texpower}
+ {Package soul not loaded.\MessageBreak Command \string\hidetext\space disabled}%
+ \let\hidetext=\hidephantom% \hidephantom is a sorry excuse for \hidetext...
+ }%
+}
+% \end{macrocode}
+%
+% Helper command to switch to `dimmed' textcolor or mathcolor (if in math mode and colormath option is set).
+% \begin{macrocode}
+\ifthenelse{\boolean{colormath@TP}}% Should we color math?
+{% Yes.
+ \newcommand{\commitcolor@TP}
+% \end{macrocode}
+% Switch to mathcolor if in math mode, to textcolor otherwise.
+% \begin{macrocode}
+ {\textcolor{\ifmmode mathcolor\else textcolor\fi}}
+ }
+{% No.
+ \newcommand{\commitcolor@TP}{\textcolor{textcolor}}% Switch to textcolor.
+}
+% \end{macrocode}
+%
+% The command |\hidedimmed| doesn't really make its argument `invisible'. Instead, it dims all colors so the argument
+% `fades' into the background.
+% \begin{macrocode}
+\ifthenelse{\boolean{TPcolor}}% Can we use colors at all?
+{% Yes.
+ \newcommand{\hidedimmed}[1]% Make argument appear in `dimmed' colors.
+ {%
+ {% A group makes the color changes local.
+ \ifthenelse{\boolean{instepwise@TP}}{\usecolorset{stwcolors}}{}% Just in case we currently are in dimmed mode...
+ \dimcolors% Dim colors.
+ \commitcolor@TP{#1}% Switch on dimmed color.
+ }%
+ }%
+ }
+{\let\hidedimmed=\displayidentical}% No. Disable this command.
+% \end{macrocode}
+%
+% The command |\hidevanish| makes its argument `invisible' by switching to the background color. Of course, this only
+% works if the background is uniformly colored.
+% \begin{macrocode}
+\ifthenelse{\boolean{TPcolor}}% Can we use colors at all?
+{% Yes.
+ \newcommand{\hidevanish}[1]% Make argument `vanish' by changing colors.
+ {\textcolor{\vanishcolor}{\vanishcolors#1}}
+ }
+{\let\hidevanish=\hidephantom}% No. Use \hidephantom instead.
+% \end{macrocode}
+%
+% \subsubsection{Displaying and hiding of step contents}
+%
+% The displaying and hiding of |<stepcontents>| is controlled by the commands |\displaystepcontents| and
+% |\hidestepcontents|. The following switches define these to be either the boxed or the `as is' versions defined above.
+% \begin{macrocode}
+\newcommand{\boxedsteps} % Use boxed versions.
+{\let\displaystepcontents=\displayboxed\let\hidestepcontents=\hidephantom}
+
+\newcommand{\nonboxedsteps} % Use nonboxed versions.
+{\let\displaystepcontents=\displayidentical\let\hidestepcontents=\hideignore}
+% \end{macrocode}
+% The default is to use the nonboxed versions. This can be changed in the optional argument of |\stepwise|.
+% \begin{macrocode}
+\nonboxedsteps
+% \end{macrocode}
+%
+% There is another command named |\activatestep| which controls what happens when a |\step| command is activated for the
+% first time. This is defined to do nothing by default.
+% \begin{macrocode}
+\let\activatestep=\displayidentical
+% \end{macrocode}
+%
+% The length |\highlightboxsep| gives the width of the frame around the box created by |\highlightboxed|.
+% \begin{macrocode}
+\newlength{\highlightboxsep}
+\setlength{\highlightboxsep}{.5\fboxsep}
+% \end{macrocode}
+%
+% |\highlightboxed{<text>}| puts |<text>| into an |\mbox| with coloured background if the colorhighlight option is set, and
+% into an |\fbox| otherwise. As this is meant as an interpretation of |\activatestep|, it is made sure that the resulting
+% box has the same dimensions as the argument (the outer frame may overlap surrounding text).
+% \begin{macrocode}
+\DeclareRobustCommand{\highlightboxed}
+{%
+ \ifmmode% Check for math mode.
+ \expandafter\mathpalette\expandafter\math@hb@TP% Math mode version needs to respect current style.
+ \else
+ \expandafter\text@hb@TP% Text mode version.
+ \fi
+}
+% \end{macrocode}
+% Math mode version of |\highlightboxed|.
+% \begin{macrocode}
+\newcommand{\math@hb@TP}[2]{\text@hb@TP{$\m@th#1{#2}$}}
+% \end{macrocode}
+% The text mode version of |\highlightboxed| does the `real' work.
+% \begin{macrocode}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes; use a box with colored background.
+ \newcommand{\text@hb@TP}[1]
+ {%
+ \makebox[\width-2\highlightboxsep]% Make the frame stick out at the sides.
+ {%
+ \setlength{\fboxsep}{\highlightboxsep}% Set frame size.
+ \raisebox{0pt}[\height-\fboxsep][\depth-\fboxsep]% Make the frame stick out above and below.
+ {\colorbox{highlightcolor}{#1}}% Make colored box containing <text>.
+ }%
+ }%
+ }% matches \ifthenelse{\boolean{colorhighlight@TP}}
+{% No; use an \fbox.
+ \newcommand{\text@hb@TP}[1]
+ {%
+ \makebox[\width-2\highlightboxsep-2\fboxrule]% Make the frame stick out at the sides.
+ {%
+ \setlength{\fboxsep}{\highlightboxsep}% Set frame size.
+ \raisebox{0pt}[\height-\fboxsep-\fboxrule][\depth-\fboxsep-\fboxrule]% Make the frame stick out above and below.
+ {\fbox{#1}}%% Make an fbox containing <text>.
+ }%
+ }%
+ }% matches second argument of \ifthenelse{\boolean{colorhighlight@TP}}
+% \end{macrocode}
+%
+% |\highlighttext| is the counterpart of |\highlightboxed| for arbitrary text. It puts its argument on a colored background
+% without putting it into a box (i.e. line breaks and hyphenation still work) if the colorhighlight option is set, and
+% underlines otherwise. As this is meant as an interpretation of |\activatestep|, it is made sure that the resulting text
+% has the same dimensions as the argument (the outer frame may overlap surrounding text).
+% |\highlighttext| needs the soul package to work. If it is not loaded, |\highlighttext| is defined to do nothing.
+% Because of restrictions implied by the soul package, |\highlighttext| is quite picky about the `regularity' of its
+% argument. That is, a lot of things will break when in the argument of |\highlighttext|. See the documentation of the
+% soul package for hints how to prevent this.
+%
+% To allow soul to be loaded after texpower, we use |\AtBeginDocument|.
+% \begin{macrocode}
+\AtBeginDocument%
+ {%
+ \@ifpackageloaded{soul}% Can we use the soul package?
+ {%
+ \@ifpackagelater{soul}{2002/05/28}% Correct version?
+ {% Yes. Let's define the necessary macros.
+ \ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+ {% Yes; use a colored background.
+ % This is implemented as an application of soul (modifying the code for underline). See the documentation of the
+ % soul package for details on soul.
+ \newlength{\SOUL@boxheight@TP}% Height of colored patch.
+ \newlength{\SOUL@boxtotalheight@TP}% Total height of colored patch.
+ \newlength{\SOUL@boxdepth@TP}% Depth of colored patch.
+ \DeclareRobustCommand*\highlighttext
+ {%
+ \leavevmode% To prevent \smash from inserting an hbox into the vertical list.
+ \SOUL@ulsetup% Underline initialization.
+ \def\SOUL@preamble
+ {%
+ \setlength{\SOUL@boxdepth@TP}% \SOUL@uldepth is below the depth of any letter.
+ {\SOUL@uldepth+\highlightboxsep}%
+ \def\SOUL@uldepth{-\SOUL@boxheight@TP}% For correctly positioning the rule.
+ \setlength{\SOUL@boxheight@TP}{\heightof{/}+\highlightboxsep}% Calculate `good' height.
+ \setlength{\SOUL@boxtotalheight@TP}{\SOUL@boxdepth@TP+\SOUL@boxheight@TP}% Calculate total height.
+ \def\SOUL@ulthickness{\SOUL@boxtotalheight@TP}% The thickness of the rule is the total height of the box.
+ \smash% Make the left border of the colored patch.
+ {%
+ \llap{\color{highlightcolor}\rule[-\SOUL@boxdepth@TP]{\highlightboxsep}{\SOUL@boxtotalheight@TP}}%
+ }%
+ \SOUL@ulpreamble% Underline preamble.
+ }%
+ \def\SOUL@everytoken
+ {%
+ {%
+ \setbox\tempbox@TP\hbox{\the\SOUL@token\SOUL@setkern\SOUL@charkern}%
+ \dimen@ii\wd\tempbox@TP
+ \smash{\rlap{\color{highlightcolor}\SOUL@ulleaders\hskip\dimen@ii}}%
+ \unhbox\tempbox@TP%
+ \smash{\rlap{\color{highlightcolor}\rule[-\SOUL@boxdepth@TP]{\highlightboxsep}{\SOUL@boxtotalheight@TP}}}%
+ }%
+ }%
+ \def\SOUL@everyspace
+ {%
+ \cleaders\hbox{\smash{\color{highlightcolor}\rule[-\SOUL@boxdepth@TP]{1pt}{\SOUL@boxtotalheight@TP}}}%
+ \hskip\spaceskip
+ \smash{\llap{\color{highlightcolor}\rule[-\SOUL@boxdepth@TP]{\highlightboxsep}{\SOUL@boxtotalheight@TP}}}%
+ }%
+ \def\SOUL@everyhyphen
+ {%
+ \discretionary
+ {\unkern
+ \setbox4\hbox{\SOUL@setkern\SOUL@hyphkern\char\hyphenchar\font}%
+ \smash{\rlap{\color{highlightcolor}\SOUL@ulleaders\hskip\wd4}}%
+ \box4%
+ \smash{\rlap{\color{highlightcolor}\rule[-\SOUL@boxdepth@TP]{\highlightboxsep}{\SOUL@boxtotalheight@TP}}}%
+ }%
+ {\smash{\llap{\color{highlightcolor}\rule[-\SOUL@boxdepth@TP]{\highlightboxsep}{\SOUL@boxtotalheight@TP}}}}%
+ {}%
+ }%
+ \let\SOUL@everysyllable\empty
+ \SOUL@%
+ }%
+ }% matches \ifthenelse{\boolean{colorhighlight@TP}}%
+ {% No. Underline.
+ \DeclareRobustCommand*\highlighttext
+ {%
+ \SOUL@ulsetup% We modify SOUL's standard definition of underlining, making sure
+ \def\SOUL@everysyllable% the result uses no more space than the non-underlined text.
+ {%
+ {%
+ \let\o@rlap@TP=\rlap
+ \def\rlap####1{\setbox\@tempboxa\box\z@\smash{\o@rlap@TP{####1}}\setbox\z@\box\@tempboxa}%
+ \SOUL@uleverysyllable
+ }%
+ }%
+ \def\SOUL@everyspace
+ {\cleaders\hbox{\smash{\vrule\@depth\SOUL@uldp\@height\SOUL@ulht\@width.5pt}}\hskip\spaceskip}%
+ \def\SOUL@everyhyphen{\discretionary
+ {\unkern
+ \setbox4\hbox{\SOUL@setkern\SOUL@hyphkern\char\hyphenchar\font}%
+ \smash{\rlap{\SOUL@ulleaders\hskip\wd4}\box4}}{}%
+ {}}%
+ \SOUL@%
+ }%
+ }% matches second argument of \ifthenelse{\boolean{colorhighlight@TP}}%
+ }%
+ {% No. Encourage people to update.
+ \PackageInfo{texpower}
+ {Package soul too old.\MessageBreak Command \string\highlighttext\space disabled}%
+ \let\highlighttext=\@iden%
+ }%
+ }% matches \@ifpackageloaded{soul}
+ {% No. In this case, there is no useful definition for \highlighttext.
+ \PackageInfo{texpower}
+ {Package soul not loaded.\MessageBreak Command \string\highlighttext\space disabled}%
+ \let\highlighttext=\@iden
+ }% matches second argument of \@ifpackageloaded{soul}
+ }% matches \AtBeginDocument%
+% \end{macrocode}
+%
+% The command |\highlightenhanced| enhances all colors so the argument `stands out'.
+% \begin{macrocode}
+\ifthenelse{\boolean{TPcolor}}% Can we use colors at all?
+{% Yes.
+ \newcommand{\highlightenhanced}[1]% Make argument appear in `enhanced' colors.
+ {%
+ {% A group makes the color changes local.
+ \ifthenelse{\boolean{instepwise@TP}}{\usecolorset{stwcolors}}{}% Just in case we currently are in enhanced mode...
+ \enhancecolors% Enhance colors.
+ \commitcolor@TP{#1}% Switch on enhanced color.
+ }%
+ }%
+ }
+{\let\highlightenhanced=\displayidentical}% No. Disable this command.
+% \end{macrocode}
+%
+% \subsubsection{Implementation of \textbackslash step, \textbackslash switch and relatives}
+%
+% |\step| takes two optional arguments for influencing the mode of activation, like this:
+%
+% |\step[<activatefirst>][<whenactive>]{<stepcontents>}|
+%
+% Both |<activatefirst>| and |<whenactive>| should be conditions in the syntax of the |\ifthenelse| command.
+%
+% |<activatefirst>| checks whether this |\step| is to be activated for the first time. The default value is
+% |\value{step}=\value{stepcommand}|. By using |\value{step}=<n>|, this |\step| can be forced to appear as the n'th one.
+%
+% |<whenactive>| checks whether this |\step| is to be considered active at all. The default behaviour is to check whether
+% this |\step| has been activated before (this is saved internally for every step).
+%
+% Both optional arguments allow two syntctical forms:
+% \begin{enumerate}
+% \item enclosed in square brackets |[...]| like explained above.
+%
+% \item enclosed in braces |(...)|.
+% In this case, |<activatefirst>| and |<whenactive>| are not treated as conditions in the sense
+% of |\ifthenelse|, but as conditionals like those used internally by \LaTeX. That means, |<activatefirst>| (when enclosed
+% in braces) can contain arbitrary \TeX code which then takes two arguments and expands to one of them, depending on
+% whether the condition is fulfilled or not fulfilled. For instance, |\step[<activatefirst>]{<stepcontents>}| could be
+% replaced by |\step(\ifthenelse{<activatefirst>}){<stepcontents>}|.
+% \end{enumerate}
+%
+% Internally, the default for the treatment of |<whenactive>| is |(\if@first@TP@true)|, where |\if@first@TP@true| is an
+% internal condition checking whether this |\step| has been activated before.
+%
+% If you wish to give the second optional argument but not the first, just write |\step[][<whenactive>]...|
+%
+% There are the following variants of |\step|. In all cases, the treatment of optional arguments for controlling
+% activation are the same as for |\step|:
+%
+% |\bstep[<activatefirst>][<whenactive>]{<stepcontents>}| Like |\step|, but is always boxed.
+%
+% |\switch[<activatefirst>][<whenactive>]{<from>}{<to>}| Instead of hiding and displaying |<stepcontents>|, switch from
+% |<from>| to |<to>|.
+%
+% |\vstep[<activatefirst>][<whenactive>]| Doesn't take an argument, but switches to `invisible' color.
+%
+% |\dstep[<activatefirst>][<whenactive>]| Doesn't take an argument, but switches to dimmed colors.
+%
+% |\steponce[<activatefirst>]{<stepcontents>}| Like |\step|, but goes inactive again in the subsequent step.
+%
+% The following variants act like their counterparts, but appear at the same time as the previous |\step| (or variant).
+%
+% |\restep[<activatefirst>][<whenactive>]{<stepcontents>}|
+%
+% |\rebstep[<activatefirst>][<whenactive>]{<stepcontents>}|
+%
+% |\reswitch[<activatefirst>][<whenactive>]{<from>}{<to>}|
+%
+% |\revstep[<activatefirst>][<whenactive>]|
+%
+% |\redstep[<activatefirst>][<whenactive>]|
+%
+% Optional argument handling.
+%
+% |\pickup@s@optargs@TP| reads the optional arguments of |\step| (or |\switch|, or relatives) and then calls |\@do@s@TP|.
+% \begin{macrocode}
+\newcommand{\pickup@s@optargs@TP}
+{%
+ \@ifnextchar[%] Check for first optional argument in [...] syntax.
+ {\f@brackstep@TP}%
+ {%
+ \@ifnextchar(%) Check for first optional argument in (...) syntax.
+ {\f@parenstep@TP}
+ {\f@brackstep@TP[]}% No optional argument given; call with empty argument in [...] syntax (default).
+ }%
+}
+
+\def\f@brackstep@TP[#1]% First optional argument was given in [...] syntax.
+{%
+ \def\tmp@TP{#1}%
+ \ifx\tmp@TP\empty% Optional argument empty?
+ \def\f@step@TPcheck{\ifthenelse{\value{step}=\value{stepcommand}}}% Yes; use default.
+ \else
+ \def\f@step@TPcheck{\ifthenelse{#1}}% No; condition is defined via \ifthenelse.
+ \fi
+ \f@step@TP% Go on and check for second optional argument.
+}
+
+\def\f@parenstep@TP(#1)% First optional argument was given in (...) syntax.
+{%
+ \def\f@step@TPcheck{#1}% Save condition (given as argument).
+ \f@step@TP% Go on and check for second optional argument.
+ }
+
+\newcommand{\f@step@TP}% Pick up the second optional argument.
+{%
+ \@ifnextchar[%] Check for second optional argument in [...] syntax.
+ {\s@brackstep@TP}
+ {%
+ \@ifnextchar(%) Check for second optional argument in (...) syntax.
+ {\s@parenstep@TP}
+ {\s@parenstep@TP(\if@first@TP@true)}% No second optional argument given;
+ }% call with \if@first@TP@true in (...) syntax (default).
+}
+
+\def\s@brackstep@TP[#1]% Second optional argument was given in [...] syntax.
+{%
+ \def\s@step@TPcheck{\ifthenelse{#1}}% Condition is defined via \ifthenelse.
+ \@do@s@TP% Go on.
+ }
+
+\def\s@parenstep@TP(#1)% Second optional argument was given in (...) syntax.
+{%
+ \def\s@step@TPcheck{#1}% Save condition (given as argument).
+ \@do@s@TP% Go on.
+ }
+% \end{macrocode}
+%
+% The following are needed to switch between the `switch behaviour' and the `step behaviour' of |\@@switch@TP|, which
+% implements the functionality of both |\switch| and |\step|.
+% \begin{macrocode}
+\newcommand{\deactivate@inner@TP}% \switch behaviour.
+{%
+% \end{macrocode}
+% Both |\inner@display@TP| and |\inner@hide@TP| just expand to their argument.
+% \begin{macrocode}
+ \let\inner@display@TP=\displayidentical%
+ \let\inner@hide@TP=\displayidentical%
+ }
+
+\newcommand{\activate@inner@TP}% \step behaviour.
+{%
+% \end{macrocode}
+% Use the user interface macros |\displaystepcontents| and |\hidestepcontents|.
+% \begin{macrocode}
+ \let\inner@display@TP=\displaystepcontents%
+ \let\inner@hide@TP=\hidestepcontents%
+ }
+% \end{macrocode}
+%
+% Implementation of |\step|.
+%
+% \begin{macrocode}
+\@onlyinstepwise@TP\step
+% \end{macrocode}
+% |\proper@step@TP| is the `real' implementation of |\step|. Most of the time, |\step| is defined to execute
+% |\proper@step@TP|.
+% \begin{macrocode}
+\newcommand{\proper@step@TP}{\let\@do@s@TP=\@step@TP\pickup@s@optargs@TP}
+% \end{macrocode}
+% |\@step@TP| implements the functionality of |\step| by calling |\@@switch@TP|, which points to |\@switch@TP| most
+% of the time.
+% \begin{macrocode}
+\newcommand{\@step@TP}[1]{\activate@inner@TP\@@switch@TP{#1}{#1}}
+% \end{macrocode}
+% Inside, |\@step@TP| executes |\@@switch@TP|, which is the implementation of the |\switch| command (see below).
+%
+% Implementation of |\switch|.
+%
+% \begin{macrocode}
+\@onlyinstepwise@TP\switch
+% \end{macrocode}
+% |\switch| works exactly like |\step|, but it takes \textbf{two} mandatory arguments and selects the first
+% if `not active', the second if `active'.
+%
+% |\proper@switch@TP| is the `real' implementation of |\switch|. Most of the time, |\switch| is defined to execute
+% |\proper@switch@TP|.
+% \begin{macrocode}
+\newcommand{\proper@switch@TP}{\deactivate@inner@TP\let\@do@s@TP=\@@switch@TP\pickup@s@optargs@TP}
+% \end{macrocode}
+%
+% |\if@first@TP@true| checks whether the |\switch| command number |\value{stepcommand}| has already been activated in this
+% |\stepwise| session and selects one of its arguments accordingly.
+% \begin{macrocode}
+\newcommand{\if@first@TP@true}[2]%
+{%
+ \expandafter % \first@TP@<n> is set to \@undefined if \switch command number <n> has not yet been
+ \ifx\csname first@TP@\the\c@stepcommand\endcsname\empty% activated and \empty otherwise.
+ #1%
+ \else
+ #2%
+ \fi
+ }
+% \end{macrocode}
+%
+% |\switch| shouldn't change the status quo in AMSLaTeX's measuring pass in typesetting aligned formulae. To guarantee
+% this, we check whether AMSLaTeX is measuring with AMSLaTeX's |\ifmeasuring@|. When AMSLaTeX is not loaded, we provide
+% this check ourselves.
+% \begin{macrocode}
+\@ifundefined{ifmeasuring@}{\newif\ifmeasuring@}{}
+% \end{macrocode}
+%
+% |\@switch@TP| implements the functionality of |\switch|. Most of the time, |\@@switch@TP| (which is called after checking
+% for optional arguments) is defined to execute |\@switch@TP|.
+% \begin{macrocode}
+\newcommand{\@switch@TP}[2]
+{%
+ \global\advance\c@stepcommand by 1\relax% This execution of \switch is counted.
+ %
+ % If the verbose option is set, type out some accounting information which can be used for debugging.
+ \ifthenelse{\boolean{verbose@TP}}
+ {%
+ \PackageInfo{texpower}
+ {Step: \the\c@step, Stepcommand: \the\c@stepcommand,\MessageBreak Stepsperformed: \the\c@stepsperformed}%
+ }
+ {}%
+ %
+ \f@step@TPcheck% Is this step to be activated? \f@step@TPcheck is defined by the first optional argument of \switch.
+ {% Yes.
+ \if@first@TP@true{}% For non-unique conditions given as optional argument or when \reswitch is used, it might happen
+ {% that \first@TP@\value{stepcommand} is already set. In this case, don't advance the counter stepsperformed.
+ \ifmeasuring@\else% Do nothing in AMSLaTeX's measuring pass for aligned equations.
+ \global\expandafter\let\csname first@TP@\the\c@stepcommand\endcsname=\empty% Set \first@TP@\value{stepcommand}
+ \fi
+ \global\advance\c@stepsperformed by 1\relax% Advance the counter for `real' first activations.
+ \gdef\current@step@TP{#2}%
+ }%
+ \setboolean{firstactivation}{true}% This switch can be tested in <stepcontents>, but also in <whenactive>.
+ }
+ {% No.
+ \setboolean{firstactivation}{false}% This switch can be tested in <stepcontents>, but also in <whenactive>.
+ }% End of \f@step@TPcheck
+ %
+ \let\o@afterstep@TP=\afterstep% We need to save the current definition of \afterstep.
+ %
+ \s@step@TPcheck% Is this step active? \s@step@TPcheck is defined by the second optional argument of \switch.
+ {% Yes.
+ \setboolean{active}{true}% Make this fact known to the user.
+ \ifthenelse{\boolean{firstactivation}}
+ {\inner@display@TP{\activatestep{#2}}}% `First' display of <stepcontents>.
+ {\inner@display@TP{#2}}% Display <stepcontents>.
+ }
+ {% No.
+ \setboolean{active}{false}% Make this fact known to the user.
+ \let\afterstep=\@gobble% Don't execute \afterstep here.
+ \ifthenelse{\boolean{firstactivation}}
+ {\inner@hide@TP{\activatestep{#1}}}% Hide <stepcontents>, but with `first activation'.
+ {\inner@hide@TP{#1}}% Hide <stepcontents>.
+ }% End of \s@step@TPcheck
+ %
+ \let\afterstep=\o@afterstep@TP% Restore the definition of \afterstep.
+ }% End of the definition of \@switch@TP.
+% \end{macrocode}
+%
+% |\restep| is identical with |\step|, but is displayed at the same time as the previous |\step|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\restep
+
+\newcommand{\proper@restep@TP}
+{%
+ \global\advance\c@stepcommand by -1% This is done by simply counting \value{stepcommand} backwards.
+ \proper@step@TP% Go on with \step.
+ }
+% \end{macrocode}
+%
+% |\reswitch| is identical with |\switch|, but is displayed at the same time as the previous |\switch|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\reswitch
+
+\newcommand{\proper@reswitch@TP}
+{%
+ \global\advance\c@stepcommand by -1% This is done by simply counting \value{stepcommand} backwards.
+ \proper@switch@TP% Go on with \switch.
+ }
+% \end{macrocode}
+%
+% |\bstep| is a variant of |\step| which is always boxed.
+% \begin{macrocode}
+\@onlyinstepwise@TP\bstep
+
+\newcommand{\proper@bstep@TP}{\let\@do@s@TP=\@bstep@TP\pickup@s@optargs@TP}
+% \end{macrocode}
+% |\@bstep@TP| implements the functionality of |\bstep| by calling |\boxedsteps| and |\@step@TP|.
+% \begin{macrocode}
+\newcommand{\@bstep@TP}[1]{{\boxedsteps\@step@TP{#1}}}
+% \end{macrocode}
+%
+% |\rebstep| is identical with |\bstep|, but is displayed at the same time as the previous |\bstep|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\rebstep
+
+\newcommand{\proper@rebstep@TP}
+{%
+ \global\advance\c@stepcommand by -1% This is done by simply counting \value{stepcommand} backwards.
+ \proper@bstep@TP% Go on with \bstep.
+ }
+% \end{macrocode}
+%
+% |\dstep| is a variant of |\step| which takes \textbf{no} argument, but switches colors to `dimmed'.
+%
+% Helper command to switch to `dimmed' textcolor or mathcolor (if in math mode and colormath option is set).
+% \begin{macrocode}
+\ifthenelse{\boolean{colormath@TP}}% Should we color math?
+{% Yes.
+ \newcommand{\commitcolors@TP}
+ {\color{\ifmmode mathcolor\else textcolor\fi}}% Switch to mathcolor if in math mode, to textcolor otherwise.
+ }
+{% No.
+ \newcommand{\commitcolors@TP}{\color{textcolor}}% Switch to textcolor.
+}
+
+\@onlyinstepwise@TP\dstep
+
+\newcommand{\proper@dstep@TP}{\deactivate@inner@TP\let\@do@s@TP=\@dstep@TP\pickup@s@optargs@TP}
+
+\ifthenelse{\boolean{TPcolor}}% Can we use colors at all?
+{% Yes.
+ \newcommand{\@dstep@TP}{\@@switch@TP{\dimcolors\commitcolors@TP}{\set@color}}
+ }
+{\newcommand{\@dstep@TP}{\@@switch@TP{}{}}}% No. Disable this command.
+% \end{macrocode}
+%
+% |\redstep| is identical with |\dstep|, but is displayed at the same time as the previous |\dstep|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\redstep
+
+\newcommand{\proper@redstep@TP}
+{%
+ \global\advance\c@stepcommand by -1% This is done by simply counting \value{stepcommand} backwards.
+ \proper@dstep@TP% Go on with \dstep.
+ }
+% \end{macrocode}
+%
+% |\vstep| is a variant of |\step| which takes \textbf{no} argument, but switches all colors to |\vanishcolor|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\vstep
+
+\newcommand{\proper@vstep@TP}{\deactivate@inner@TP\let\@do@s@TP=\@vstep@TP\pickup@s@optargs@TP}
+
+\ifthenelse{\boolean{TPcolor}}% Can we use colors at all?
+{% Yes.
+ \newcommand{\@vstep@TP}{\@@switch@TP{\vanishcolors\color{textcolor}}{\set@color}}
+ }
+{\newcommand{\@vstep@TP}{\@@switch@TP{}{}}}% No. Disable this command.
+% \end{macrocode}
+%
+% |\revstep| is identical with |\vstep|, but is displayed at the same time as the previous |\vstep|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\revstep
+
+\newcommand{\proper@revstep@TP}
+{%
+ \global\advance\c@stepcommand by -1% This is done by simply counting \value{stepcommand} backwards.
+ \proper@vstep@TP% Go on with \vstep.
+ }
+% \end{macrocode}
+%
+% |\steponce[<activatefirst>]{<stepcontents>}| is a variant of |\step| which is active only at the time of activation and
+% goes inactive again in the subsequent step.
+% \begin{macrocode}
+\@onlyinstepwise@TP\steponce
+
+\newcommand{\proper@steponce@TP}
+{\@ifnextchar[{\brack@steponce@TP}{\@steponce@TP}}% Optional argument in square brackets?
+
+\newcommand{\@steponce@TP}
+{%
+ \@ifnextchar(%% Optional argument in parentheses?
+ {\paren@steponce@TP}%
+ {\brack@steponce@TP[]}% [] is the default if no optional argument is given.
+ }
+
+\def\brack@steponce@TP[#1]%
+{%
+ \def\optarg@so@TP{[#1]}% Store optional argument for later re-insertion.
+ \@@steponce@TP% Proceed.
+ }%
+
+\def\paren@steponce@TP(#1){\def\optarg@so@TP{(#1)}\@@steponce@TP}
+% \end{macrocode}
+% Main body of |\steponce|.
+% \begin{macrocode}
+\newcommand{\@@steponce@TP}[1]{\expandafter\step\optarg@so@TP[\boolean{firstactivation}]{#1}}
+% \end{macrocode}
+%
+% |\multistep*[<activatefirst>]{<n>}{<stepcontents>}| is a shorthand macro for executing several steps successively. In
+% fact, it would better be called |\multiswitch|, because its functionality is based on |\switch|, it only acts like a
+% (simplified) |\step| command which is executed `several times'.
+% |\multistep[<activatefirst>]{<n>}{<stepcontents>}| expands to a sequence of |<n>| commands of the form
+% |\switch[<activatefirst>][\boolean{firstactivation}]{}{<stepcontents>}|
+% with the effect that |<stepcontents>| is executed |<n>| times at different iterations of |\stepwise|. Note that
+% |[<activatefirst>]| can also have the form |(<activatefirst>)|, as usual for |\switch|.
+% Because of the second optional argument |[\boolean{firstactivation}]|, only one instance of |<stepcontents>| is displayed
+% at a time.
+% Inside |<stepcontents>|, a counter substep can be evaluated which tells the number of the current instance.
+% In the starred form, the optional argument |[\boolean{firstactivation}]| is left out for the very last instance, so the
+% last instance of |<stepcontents>| stays visible.
+%
+% New counter for the number of the current substep.
+% \begin{macrocode}
+\newcounter{substep}
+% \end{macrocode}
+% User interface for |\multistep|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\multistep
+
+\newcommand{\proper@multistep@TP}
+{%
+ \let\ns@ms@TP=\normalstep@ms@TP% Placeholder for `every step but the last one'.
+ \let\nshook@ms@TP=\relax% These hooks are used by \movie.
+ \let\lshook@ms@TP=\relax
+ \@ifstar% Starred version?
+ {%
+ \let\ls@ms@TP=\laststep@ms@TP% Last step acts differently.
+ \multistep@TP% Collect optional argument and proceed.
+ }
+ {%
+ \let\ls@ms@TP=\normalstep@ms@TP% Last step acts like all other steps.
+ \multistep@TP% Collect optional argument and proceed.
+ }%
+ }
+
+\newcommand{\multistep@TP}% Collect optional argument.
+{\@ifnextchar[{\brack@multistep@TP}{\@multistep@TP}}% Optional argument in square brackets?
+
+\newcommand{\@multistep@TP}
+{%
+ \@ifnextchar(%% Optional argument in parentheses?
+ {\paren@multistep@TP}%
+ {\brack@multistep@TP[]}% [] is the default if no optional argument is given.
+ }
+
+\def\brack@multistep@TP[#1]%
+{%
+ \def\optarg@ms@TP{[#1]}% Store optional argument for later re-insertion.
+ \@@multistep@TP% Proceed.
+ }%
+
+\def\paren@multistep@TP(#1){\def\optarg@ms@TP{(#1)}\@@multistep@TP}
+
+% \end{macrocode}
+% Execute one step.
+% \begin{macrocode}
+\newcommand{\normalstep@ms@TP}[1]
+{%
+ \expandafter\switch\optarg@ms@TP% Re-insert optional argument.
+ [\boolean{firstactivation}]{}{#1}% `normal' steps appear only once.
+ }
+
+\newcommand{\laststep@ms@TP}[1]
+{\expandafter\switch\optarg@ms@TP{}{#1}}% In the starred version, the last step doesn't disappear.
+% \end{macrocode}
+% Main body of |\multistep|.
+% \begin{macrocode}
+\newcommand{\@@multistep@TP}[2]
+{%
+ \setcounter{substep}{0}% Initialize substep counter.
+ \whiledo{\value{substep}<#1}% Iterate <n> times.
+ {%
+ \stepcounter{substep}%
+ \ifthenelse{\value{substep}=#1}% Last step?
+ {\ls@ms@TP{\lshook@ms@TP#2}}% Execute single step (together with \movie hooks).
+ {\ns@ms@TP{\nshook@ms@TP#2}}%
+ }%
+ }
+% \end{macrocode}
+%
+% |\movie*[<activatefirst>]{<n>}{<dur>}[<stop>]{<stepcontents>}| works like |\multistep|, but between |\steps|, pages are
+% advanced automatically every |<dur>| seconds.
+% The additional optional argument |<stop>| gives the code (default: |\stopAdvancing|) which stops the animation.
+% User interface for |\movie|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\movie
+
+\newcommand{\proper@movie@TP}
+{%
+ \let\ns@ms@TP=\normalstep@ms@TP% Placeholder for `every step but the last one'.
+ \def\nshook@ms@TP{\afterstep{\pageDuration{\dur@ms@TP}}}% Page duration to be used between steps.
+ \def\lshook@ms@TP{\afterstep{\end@ms@TP}}% Page duration setting after last step.
+ \@ifstar% Starred version?
+ {%
+ \let\ls@ms@TP=\laststep@ms@TP% Last step acts differently.
+ \movie@TP% Collect optional argument and proceed.
+ }
+ {%
+ \let\ls@ms@TP=\normalstep@ms@TP% Last step acts like all other steps.
+ \movie@TP% Collect optional argument and proceed.
+ }%
+ }
+
+\newcommand{\movie@TP}% Collect optional argument.
+{\@ifnextchar[{\brack@movie@TP}{\@movie@TP}}% Optional argument in square brackets?
+
+\newcommand{\@movie@TP}
+{\@ifnextchar({\paren@movie@TP}{\brack@movie@TP[]}}% Optional argument in parentheses?
+
+\def\brack@movie@TP[#1]{\def\optarg@ms@TP{[#1]}\@@movie@TP}% Store optional argument and proceed.
+\def\paren@movie@TP(#1){\def\optarg@ms@TP{(#1)}\@@movie@TP}
+
+\newcommand{\@@movie@TP}[2]% Collect <n> and <dur> arguments.
+{\gdef\dur@ms@TP{#2}\gdef\nosteps@ms@TP{#1}\@@@movie@TP}
+
+\newcommand{\@@@movie@TP}[1][\stopAdvancing]% Collect second optional argument and call body of \multistep.
+{\gdef\end@ms@TP{#1}\@@multistep@TP{\nosteps@ms@TP}}
+% \end{macrocode}
+%
+% |\overlays[<activatefirst>]{<n>}{<stepcontents>}| is another shorthand macro for executing several steps
+% successively. In contrast to |\multistep|, it doesn't print things \textbf{after} each other, but \textbf{over}
+% each other. Obviously, there is no need for a starred version.
+% |\overlays[<activatefirst>]{<n>}{<stepcontents>}| expands to a sequence of |<n>| commands of the form
+% |\switch[<activatefirst>]{}{\rlap{<stepcontents>}}|
+% with the effect that |<stepcontents>| is executed |<n>| times at different iterations of |\stepwise|, and all results are
+% overlaid over each other. Note that |[<activatefirst>]| can also have the form |(<activatefirst>)|, as usual for |\switch|.
+% Inside |<stepcontents>|, a counter substep can be evaluated which tells the number of the current instance.
+% User interface for |\overlays|.
+% \begin{macrocode}
+\@onlyinstepwise@TP\overlays
+
+\providecommand{\proper@overlays@TP}
+{\@ifnextchar[{\brack@overlays@TP}{\@overlays@TP}}% Optional argument in square brackets?
+
+\newcommand{\@overlays@TP}
+{%
+ \@ifnextchar(%% Optional argument in parentheses?
+ {\paren@overlays@TP}%
+ {\brack@overlays@TP[]}% [] is the default if no optional argument is given.
+ }
+
+\def\brack@overlays@TP[#1]%
+{%
+ \def\optarg@ov@TP{[#1]}% Store optional argument for later re-insertion.
+ \@@overlays@TP% Proceed.
+ }%
+
+\def\paren@overlays@TP(#1){\def\optarg@ov@TP{(#1)}\@@overlays@TP}
+% \end{macrocode}
+% Main body of |\overlays|.
+% \begin{macrocode}
+\newcommand{\@@overlays@TP}[2]
+{%
+ \setcounter{substep}{0}% Initialize substep counter.
+ \leavevmode% Make sure that \rlap doesn't insert anything in the vertical list.
+ \whiledo{\value{substep}<#1}% Iterate <n> times.
+ {%
+ \stepcounter{substep}%
+ \expandafter\switch\optarg@ov@TP{}{\ifthenelse{\boolean{firstactivation}}{\mbox{#2}}{\rlap{#2}}}%
+ }%
+}
+% \end{macrocode}
+%
+% \subsubsection{Implementation of \textbackslash stepwise}
+%
+% Every variant of |\stepwise| takes an optional argument, like this
+%
+% |\stepwise[<settings>]{<contents>}|
+%
+% |<settings>| will be placed right before the internal loop which produces the sequence of pages. It can contain
+% settings of parameters which modify the behaviour of |\stepwise| or |\step|. |<settings>| is placed inside a group so all
+% changes are local to this call of |\stepwise|.
+%
+% Usually, the first page of a sequence produced contains only material which is not part of any |<stepcontents>|. The
+% first |<stepcontents>| are displayed on the second page of the sequence.
+%
+% For special effects, it might be desirable to have the first |<stepcontents>| active even on the first page of the
+% sequence.
+%
+% All variants of |\stepwise| have a starred version (e.\,g.\ |\stepwise*|) which does exactly that.
+%
+% When |\stepwise| is executed, for every page of the sequence generated, |<contents>| is wrapped in the environment
+% stepcapsule (but not grouped by default). This is empty by default for minimum intrusion. Redefine stepcapsule in the
+% optional argument of |\stepwise| to change this (as is done for instance by |\liststepwise|).
+% \begin{macrocode}
+\newenvironment{stepcapsule}{}{}
+% \end{macrocode}
+%
+% Because |\step| commands usually occur deep in some nested structure, it is difficult to set local parameters (like page
+% transitions) only for certain steps (local settings executed in |<stepcontents>| would be undone by closing groups).
+%
+% |\afterstep{<setting>}| has the effect that |<setting>| will be performed \textbf{after} the current execution of
+% |<contents>|, right before the page break for this page of the sequence generated.
+% \begin{macrocode}
+\newcommand{\afterstep}[1]
+{%
+ \gdef\@afterstep@TP{#1}% The argument is simply stored in \@afterstep@TP, which is executed in \stepwise.
+ }
+% \end{macrocode}
+%
+% One new counter for saving the value of firststep.
+% \begin{macrocode}
+\newcounter{o@fs@TP}
+% \end{macrocode}
+%
+% |\stepwise| user interface.
+% \begin{macrocode}
+\newcommand{\stepwise}
+{%
+ \global\c@o@fs@TP=\c@firststep\relax% Save the default value of counter firststep.
+ \@ifstar% Using the starred version?
+ {% Yes.
+ \c@firststep=1\relax% Start with counter step at number 1.
+ \@stepwise@TP% Collect optional argument and proceed.
+ }
+ {% No.
+ \@stepwise@TP% Use the default.
+ }% End of \@ifstar.
+ }%
+% \end{macrocode}
+%
+% Sometimes, it might happen that vertical spacing is different on every page of a sequence generated by |\stepwise|,
+% making lines `wobble'.
+% There are two custom versions |\liststepwise|, |\parstepwise| of |\stepwise| which produce better vertical spacing by
+% putting an invisible rule before |<contents>|. This will almost certainly lead to `consistent' spacing which might
+% nevertheless be different from the spacing if |\liststepwise| wasn't present.
+%
+% |\liststepwise{<contents>}| works exactly like |\stepwise|, but |<contents>| is delimited by a rule of height zero. Use for
+% list environments and aligned equations.
+%
+% |\parstepwise{<contents>}| works like |\liststepwise|, but |\boxedsteps| is turned on by default. Use for texts where
+% steps are to be filled into blank spaces.
+%
+% Command to activate special stepcapsule for |\liststepwise|.
+% \begin{macrocode}
+\newcommand{\list@stepcapsule}
+{%
+ \renewenvironment{stepcapsule}% stepcapsule is to put an invisible rule on the vertical list.
+ {\vspace*{\parskip}\hrule \@height\z@\relax}{}
+ }%
+
+\let\par@stepcapsule=\list@stepcapsule% Identical for \parstepwise.
+% \end{macrocode}
+% User interface for |\liststepwise|.
+% \begin{macrocode}
+\newcommand{\liststepwise}
+{%
+ \@ifstar% Starred version?
+ {\def\star@TP{*}\@liststepwise@TP}% Save star in \star@TP, collect optional argument and proceed.
+ {\def\star@TP{}\@liststepwise@TP}% Collect optional argument and proceed (non-starred version).
+ }
+
+\newcommand{\@liststepwise@TP}[1][]% Collect optional argument.
+{%
+ \expandafter\stepwise\star@TP% Re-insert the star (if given).
+ [%
+ \list@stepcapsule% Activate special stepcapsule.
+ #1% Insert optional argument of \liststepwise.
+ ]%
+ }
+% \end{macrocode}
+% User interface for |\parstepwise|.
+% \begin{macrocode}
+\newcommand{\parstepwise}
+{%
+ \@ifstar% Starred version?
+ {\def\star@TP{*}\@parstepwise@TP}% Save star in \star@TP, collect optional argument and proceed.
+ {\def\star@TP{}\@parstepwise@TP}% Collect optional argument and proceed (non-starred version).
+ }
+
+\newcommand{\@parstepwise@TP}[1][]% Collect optional argument.
+{%
+ \expandafter\stepwise\star@TP% Re-insert the star (if given).
+ [%
+ \boxedsteps% Activate \boxedsteps.
+ \par@stepcapsule% Activate special stepcapsule.
+ #1% Insert optional argument of \parstepwise.
+ ]%
+ }
+% \end{macrocode}
+%
+% |\count@em@TP| is used by |\stepwise| as a redefinition of |\@@switch@TP| for counting |\step| commands.
+% \begin{macrocode}
+\newcommand{\count@em@TP}[2]
+{%
+ \global\advance\c@stepcommand by 1\relax% We simply advance the number of \step commands...
+ #2% ... and execute the second argument (to find nested uses of \step).
+}
+% \end{macrocode}
+%
+% |\savecounters@TP| saves the values of all counters that have ever been defined by |\newcounter| in the macro
+% |\restorecounters@TP|, which can be used later to restore the saved values. The code is snarfed from amsmath.sty.
+% During execution of |\stepwise|, this is used to restore the values of all counters between steps so that things counted
+% in the argument of |\stepwise| (like equation numbers) do not `run wild'.
+% \begin{macrocode}
+\def\@nb@TPfalse{\global\let\if@nb@TP\iffalse}
+\def\@nb@TPtrue{\global\let\if@nb@TP\iftrue}
+\newtoks\ep@TP
+\def\savecounters@TP{%
+ \begingroup
+ \def\@elt##1{\global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
+ \xdef\restorecounters@TP{\cl@@ckpt}%
+ \endgroup
+ \if@nobreak\@nb@TPtrue\else\@nb@TPfalse\fi
+ \global\ep@TP\everypar
+ }
+% \end{macrocode}
+%
+% |\saveTPcounters@TP| saves the values of all `stepwise-specific' counters in the macro |\restoreTPcounters@TP|.
+% This is used to `counteract' |\restorecounters@TP|, leaving the values of `stepwise-specific' counters intact.
+% \begin{macrocode}
+\def\saveTPcounters@TP{%
+ \begingroup
+ \def\@elt##1{\global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
+ \xdef\restoreTPcounters@TP{\cl@@ckpt@TP}%
+ \endgroup
+ }
+% \end{macrocode}
+%
+% This list gives the names of all `stepwise-specific' counters.
+% \begin{macrocode}
+\def\cl@@ckpt@TP{\@elt{totalsteps}\@elt{firststep}\@elt{step}\@elt{stepcommand}\@elt{stepsperformed}\@elt{o@fs@TP}}
+% \end{macrocode}
+%
+% |\releasecounter{<name>}| inserts |<name>| into the list |\cl@@ckpt@TP|. This way, the counter |<name>| is not restored
+% between steps.
+% \begin{macrocode}
+\newcommand{\releasecounter}[1]%
+{\expandafter\def\expandafter\cl@@ckpt@TP\expandafter{\cl@@ckpt@TP\@elt{#1}}}
+% \end{macrocode}
+%
+% |\disable@counting@TP| is executed when counting |\step| commands. Everything the execution of which would be harmful
+% during counting, or which needs much computing resources, can be disabled here.
+% \begin{macrocode}
+\newcommand{\disable@counting@TP}
+{%
+ \let\afterstep=\@gobble
+ \renewcommand{\backgroundstyle}[2][]{}%
+ \renewcommand{\@@vgradrule@TP}[3][0pt]{}%
+ \renewcommand{\@@@@dblvgradrule@TP}[3][0pt]{}%
+ \renewcommand{\@@hgradrule@TP}[3][0pt]{}%
+ \renewcommand{\@@@@dblhgradrule@TP}[3][0pt]{}%
+}
+% \end{macrocode}
+%
+% The boolean |instepwise@TP| indicates whether the execution of |\stepwise| is currently going on.
+% \begin{macrocode}
+\newboolean{instepwise@TP}
+% \end{macrocode}
+% |\@stepwise@TP| implements the functionality of |\stepwise|. It is called by |\stepwise| after checking for the star.
+% \begin{macrocode}
+\newcommand{\@stepwise@TP}[2][]
+{%
+ \save@TP% Save the current contents of the page.
+ \savecounters@TP% Save the values of all counters.
+ \dumpcolorset{stwcolors}% Make a copy of all color definitions.
+ \begingroup% A group makes redefinitions local.
+ \setboolean{instepwise@TP}{true}% Set indicatior.
+ \let\step\proper@step@TP% By default, \step executes \proper@step@TP.
+ \let\restep\proper@restep@TP%
+ \let\bstep\proper@bstep@TP%
+ \let\rebstep\proper@rebstep@TP%
+ \let\dstep\proper@dstep@TP%
+ \let\redstep\proper@redstep@TP%
+ \let\vstep\proper@vstep@TP%
+ \let\revstep\proper@revstep@TP%
+ \let\steponce\proper@steponce@TP%
+ \let\multistep\proper@multistep@TP%
+ \let\movie\proper@movie@TP%
+ \let\overlays\proper@overlays@TP%
+ \let\switch\proper@switch@TP% By default, \switch executes \proper@switch@TP.
+ \let\reswitch\proper@reswitch@TP%
+% \end{macrocode}
+% One big problem with math is that |\mathchoice| typesets its argument four times. If |\step| commands are inside the
+% argument of |\mathchoice|, counters (which are advanced globally by |\step|) go astray. So far, I don't know any
+% remedy for this apart from (locally) hacking |\mathchoice|. I know this is a very fragile and non-recommended
+% method, but it works for the examples and will hopefully do until someone helps me find a better solution.
+% \begin{macrocode}
+ \let\orig@mathchoice@TP=\mathchoice% Save the current definition of \mathchoice...
+ \def\mathchoice##1##2##3##4% ... and redefine.
+ {%
+ \orig@mathchoice@TP% The original definition of \mathchoice is called...
+ {##1}% ... with the first argument untouched and in all other arguments, \step ...
+ {\let\step\restep\let\bstep\rebstep\let\dstep\redstep\let\vstep\revstep\let\switch\reswitch##2}% ... redefined ...
+ {\let\step\restep\let\bstep\rebstep\let\dstep\redstep\let\vstep\revstep\let\switch\reswitch##3}% ... to execute ...
+ {\let\step\restep\let\bstep\rebstep\let\dstep\redstep\let\vstep\revstep\let\switch\reswitch##4}% ... \restep.
+ }%
+ %
+ \c@stepcommand=0\relax% Initialize the counter for \step commands.
+ \let\@@switch@TP=\count@em@TP% Next, we count the \step commands in <contents>...
+ \setbox\tempbox@TP% ... by putting <contents> into a \vbox (which is then discarded).
+ =\vbox
+ {%
+ \hfuzz\maxdimen\hbadness\@M\relax% No bogus `overfull \hbox' warnings.
+ \disable@counting@TP#2% Inside the \vbox, some commands are redefined for safety and efficiency.
+ }%
+ \c@totalsteps=\c@stepcommand% Now, we know the total number of \step commands.
+ %
+ % Next, we have to reset \first@TP@<n> for <n>=0...\value{totalsteps}.
+ \c@step=0\relax
+ \loop
+ \ifnum\c@step<\c@totalsteps
+ \advance\c@step by 1\relax
+ \expandafter\let\csname first@TP@\the\c@step\endcsname=\@undefined% \first@TP@<n>=\@undefined means step <n>
+ % hasn't yet been activated.
+ \repeat
+% \end{macrocode}
+% Next, the optional argument of |\stepwise| is executed. At this point, |\value{totalsteps}| already has its final
+% value and |\value{step}| has not yet been set to |\value{firststep}|, so both totalsteps and firststep can
+% meaningfully be modified in |<settings>|.
+% \begin{macrocode}
+ #1%
+ %
+ \c@step=\c@firststep% Set the counter for the current step to its starting value...
+ \c@stepsperformed=0\relax% ... and also the counter for the \step commands which are already activated.
+ \let\@@switch@TP=\@switch@TP% \step will now act normally.
+ \ifthenelse{\boolean{verbose@TP}}% Some accounting info (if verbose option is set).
+ {\PackageInfo{texpower}{Total number of step commands: \the\c@totalsteps}}
+ {}%
+ %
+ \ifthenelse{\boolean{display}}% Are dynamic features enabled?
+ {}% Yes.
+ {% No. Do only one loop.
+ \c@stepsperformed=\c@totalsteps% Set everything up for the last loop.
+ \c@step=0\relax% Set \first@TP@<n> for <n>=0...\value{totalsteps}.
+ \loop
+ \ifnum\c@step<\c@totalsteps
+ \advance\c@step by 1\relax
+ \expandafter\let\csname first@TP@\the\c@step\endcsname=\@empty% \first@TP@<n>=\@empty means step <n>
+ % has already been activated.
+ \repeat
+ \advance\c@step by 1\relax% This way, the last step won't think it's `first activated'.
+ }%
+ \let\insertdup@TP=\insertfirstduplicate@TP% Setup command to restore page contents for the first time.
+ \loop% This is the central loop.
+ \c@stepcommand=0\relax% Initialize the counter for the current \step command.
+ \saveTPcounters@TP% Save the `stepwise-specific' counters.
+ \restorecounters@TP% Restore the `original' values of all counters...
+ \restoreTPcounters@TP% ... and the current values of the `stepwise-specific' counters.
+ \let\@afterstep@TP=\relax% Reset the container for \afterstep.
+ %
+ \insertdup@TP% Insert saved page contents.
+ \begin{stepcapsule}% This is usually empty, but may start a minipage (or whatever).
+ \usecolorset{stwcolors}% Restore colors to state at the beginning of \stepwise.
+ \if@nb@TP\@nobreaktrue\else\@nobreakfalse\fi
+ \global\everypar\ep@TP
+ #2% Execute <contents>
+ \end{stepcapsule}%
+ %
+ \@afterstep@TP% Whatever has been saved with \afterstep is now executed.
+ \ifnum\c@stepsperformed<\c@totalsteps% Doing one more round?
+ \outputduplicate@TP% Shipout this page and round we go again.
+ \let\insertdup@TP=\insertsecondduplicate@TP% Setup command to restore page contents for subsequent times.
+ \advance\c@step by 1\relax% Round we go again
+ \repeat
+ \endgroup
+ \global\c@firststep=\c@o@fs@TP\relax% Restore default value of counter firststep.
+}% End of the definition of \@stepwise@TP
+% \end{macrocode}
+%
+% Input system-specific settings (if existing).
+% \begin{macrocode}
+\InputIfFileExists{tpsettings.cfg}{}{}
+% \end{macrocode}
+% \Finale
+\endinput
diff --git a/Master/texmf-dist/source/latex/texpower/tpbundle.ins b/Master/texmf-dist/source/latex/texpower/tpbundle.ins
new file mode 100644
index 00000000000..6478aeee52c
--- /dev/null
+++ b/Master/texmf-dist/source/latex/texpower/tpbundle.ins
@@ -0,0 +1,127 @@
+%%
+%% --------------------------------------------------------------
+%% TeXPower bundle - dynamic online presentations with LaTeX
+%% Copyright (C) 1999-2004 Stephan Lehmke
+%%
+%% 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.
+%% --------------------------------------------------------------
+%%
+%% tpbundle.ins,v 1.2 2004/07/27 11:38:08 hansfn Exp
+%%
+%% --------------- start of docstrip commands ------------------
+%%
+
+\input docstrip
+
+\preamble
+
+--------------------------------------------------------------
+TeXPower bundle - dynamic online presentations with LaTeX
+Copyright (C) 1999-2004 Stephan Lehmke
+
+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.
+--------------------------------------------------------------
+
+The list of all files belonging to the TeXPower bundle is
+given in the file `00readme.txt'.
+
+\endpreamble
+
+\keepsilent
+\usedir{tex/latex/texpower}
+\askonceonly
+
+\generate{%
+ \file{texpower.sty}{\from{texpower.dtx}{texpower}}
+ \file{tpcolors.cfg}{\from{texpower-cfg.dtx}{tpcolors}}
+ \file{tpoptions.cfg}{\from{texpower-cfg.dtx}{tpoptions}}
+ \file{tpsettings.cfg}{\from{texpower-cfg.dtx}{tpsettings}}
+ \file{powersem.cls}{\from{powersem.dtx}{powersem}}
+ %
+ \file{automata.sty}{\from{texpower-addons.dtx}{automata}}
+ \file{fixseminar.sty}{\from{texpower-addons.dtx}{fixseminar}}
+ \file{tplists.sty}{\from{texpower-addons.dtx}{tplists}}
+ \file{tppstcol.sty}{\from{texpower-addons.dtx}{tppstcol}}
+ \file{tpsem-a4.sty}{\from{texpower-addons.dtx}{tpsem-a4}}
+ %
+ \file{FAQ-display.tex}{\from{texpower-doc.dtx}{faq-disp,faq,end}}
+ \file{FAQ-printout.tex}{\from{texpower-doc.dtx}{faq-print,faq,enddoc}}
+ %
+ \file{manual.tex}{\from{texpower-doc.dtx}{manual,docu,enddoc}}
+ \file{fulldemo.tex}{\from{texpower-doc.dtx}{fulldemo}
+ \from{texpower-doc.dtx}{picexample-src}
+ \from{texpower-doc.dtx}{tabexample-src}
+ \from{texpower-doc.dtx}{mathexample-src}
+ \from{texpower-doc.dtx}{parexample-src}
+ \from{texpower-doc.dtx}{bckwrdexample-src}
+ \from{texpower-doc.dtx}{hilitexample-src}
+ \from{texpower-doc.dtx}{divexample-src}
+ \from{texpower-doc.dtx}{fulldemo-middle,docu,end}}
+ %
+ \file{bckwrdexample.tex}{\from{texpower-doc.dtx}{bckwrdexample,bckwrdexample-src,end}}
+ \file{bgndexample.tex}{\from{texpower-doc.dtx}{bgndexample,bgndexample-src,end}}
+ \file{divexample.tex}{\from{texpower-doc.dtx}{divexample,divexample-src,end}}
+ \file{fancystep.tex}{\from{texpower-doc.dtx}{fancystep}}
+ \file{foilsdemo.tex}{\from{texpower-doc.dtx}{foilsdemo}}
+ \file{hilitexample.tex}{\from{texpower-doc.dtx}{hilitexample,hilitexample-src,end}}
+ \file{ifmslidemo.tex}{\from{texpower-doc.dtx}{ifmslidemo}}
+ \file{mathexample.tex}{\from{texpower-doc.dtx}{mathexample,mathexample-src,end}}
+ \file{panelexample.tex}{\from{texpower-doc.dtx}{panelexample}}
+ \file{parexample.tex}{\from{texpower-doc.dtx}{parexample,parexample-src,end}}
+ \file{pdfscrdemo.tex}{\from{texpower-doc.dtx}{pdfscrdemo}}
+ \file{pdfslidemo.tex}{\from{texpower-doc.dtx}{pdfslidemo}}
+ \file{picexample.tex}{\from{texpower-doc.dtx}{picexample,picexample-src,end}}
+ \file{picltxexample.tex}{\from{texpower-doc.dtx}{picltxexample}}
+ \file{picpsexample.tex}{\from{texpower-doc.dtx}{picpsexample}}
+ \file{pp4sldemo.tex}{\from{texpower-doc.dtx}{pp4sldemo}}
+ \file{prosperdemo.tex}{\from{texpower-doc.dtx}{prosperdemo}}
+ \file{seminardemo.tex}{\from{texpower-doc.dtx}{seminardemo}}
+ \file{simpledemo.tex}{\from{texpower-doc.dtx}{simpledemo}}
+ \file{slidesdemo.tex}{\from{texpower-doc.dtx}{slidesdemo}}
+ \file{spanelexample.tex}{\from{texpower-doc.dtx}{spanelexample}}
+ \file{tabexample.tex}{\from{texpower-doc.dtx}{tabexample,tabexample-src,end}}
+ %
+ \file{__TPcfg.tex}{\from{texpower-doc.dtx}{config}}
+ \file{__TPpreamble.tex}{\from{texpower-doc.dtx}{preamble}}
+ \file{__TPindexing.tex}{\from{texpower-doc.dtx}{indexing}}
+}
+
+\nopreamble
+\nopostamble
+\generate{%
+ \file{fig-1.mps}{\from{texpower-doc.dtx}{fig-1}}
+ \file{fig-2.mps}{\from{texpower-doc.dtx}{fig-2}}
+ \file{fig-3.mps}{\from{texpower-doc.dtx}{fig-3}}
+}
+
+\ifToplevel{
+\Msg{***********************************************************}
+\Msg{*}
+\Msg{* To finish the installation you have to move the following}
+\Msg{* files into a directory searched by TeX:}
+\Msg{*}
+\Msg{* \space\space *.cls, *.sty and *.cfg}
+\Msg{*}
+\Msg{* Happy TeXing}
+\Msg{*}
+\Msg{***********************************************************}
+}
+
+\endbatchfile
+