summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/texpower/texpower.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/texpower/texpower.sty')
-rw-r--r--Master/texmf-dist/tex/latex/texpower/texpower.sty3150
1 files changed, 3150 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/texpower/texpower.sty b/Master/texmf-dist/tex/latex/texpower/texpower.sty
new file mode 100644
index 00000000000..a46f177abb7
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/texpower/texpower.sty
@@ -0,0 +1,3150 @@
+%%
+%% This is file `texpower.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% texpower.dtx (with options: `texpower')
+%%
+%% --------------------------------------------------------------
+%% 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'.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{texpower}
+ [2004/07/27 v0.1b Create Dynamic Presentations with LaTeX.]
+
+\RequirePackage{ifthen}
+\RequirePackage{calc}
+\RequirePackage{keyval}
+\newboolean{verbose@TP}
+\DeclareOption{verbose}{\setboolean{verbose@TP}{true}}
+\provideboolean{display}
+\DeclareOption{display}{\setboolean{display}{true}}
+\DeclareOption{printout}{\setboolean{display}{false}}
+\newboolean{fixcolorstack@TP}
+\DeclareOption{fixcolorstack}{\setboolean{fixcolorstack@TP}{true}}
+\newboolean{nineminutes@TP}
+\DeclareOption{nineminutes}{\setboolean{nineminutes@TP}{true}}
+\newboolean{TPcolor}
+\newboolean{coloremph@TP}
+\DeclareOption{coloremph}
+{\setboolean{TPcolor}{true}\setboolean{coloremph@TP}{true}}
+\newboolean{colormath@TP}
+\DeclareOption{colormath}
+{\setboolean{TPcolor}{true}\setboolean{colormath@TP}{true}}
+\newboolean{colorhighlight@TP}
+\DeclareOption{colorhighlight}
+{\setboolean{TPcolor}{true}\setboolean{colorhighlight@TP}{true}}
+\newboolean{whitebackground@TP}
+\setboolean{whitebackground@TP}{true}% This is the default.
+\DeclareOption{whitebackground}
+{\setboolean{TPcolor}{true}\setboolean{whitebackground@TP}{true}}
+\newboolean{lightbackground@TP}
+\DeclareOption{lightbackground}
+{\setboolean{TPcolor}{true}\setboolean{lightbackground@TP}{true}}
+\newboolean{blackbackground@TP}
+\DeclareOption{blackbackground}
+{\setboolean{TPcolor}{true}\setboolean{blackbackground@TP}{true}}
+\newboolean{darkbackground@TP}
+\DeclareOption{darkbackground}
+{\setboolean{TPcolor}{true}\setboolean{darkbackground@TP}{true}}
+\InputIfFileExists{tpoptions.cfg}{}{}
+\ProcessOptions
+
+\ifthenelse{\boolean{display}}
+{\PackageInfo{texpower}{Producing display version. Dynamic features activated.}}
+{\PackageInfo{texpower}{Producing printout version. Dynamic features inactive.}}
+\ifthenelse{\boolean{verbose@TP}}{\setcounter{errorcontextlines}{10000}}{}
+\newboolean{psspecialsallowed}
+\setboolean{psspecialsallowed}{true} % optimistic default
+\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
+\@ifclassloaded{slides}%
+{%
+ \ifthenelse{\boolean{display}}%
+ {\let\@topfil\relax}%
+ {}%
+ }
+{}
+\newcounter{tmpcnta@TP}
+\newcounter{tmpcntb@TP}
+
+\newlength{\tempdima@TP}
+\newlength{\tempdimb@TP}
+
+\newbox\tempbox@TP
+
+\newboolean{carryon@TP}
+\newcommand{\TPpagewidth}{\strip@pt\paperwidth truept}
+\newcommand{\TPpageheight}{\strip@pt\paperheight truept}
+\newcommand{\mkfactor}[2]%
+{\setlength{\tempdima@TP}{1pt*#2}\edef#1{\strip@pt\tempdima@TP}}
+\newcommand{\mklength@TP}[2]
+{\setlength{\tempdima@TP}{#2}\edef#1{\the\tempdima@TP}}
+
+\newcommand{\mklength}{}
+\let\mklength\mklength@TP
+\ifthenelse{\boolean{TPcolor}}{\RequirePackage{color}}{}%
+\ifthenelse{\boolean{TPcolor}}{% Yes.
+ \let\setcolor@TP=\color%
+ \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}}%
+ }%
+ \@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
+ \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}%
+ }
+ \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.
+ }
+ \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.
+ }
+ \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}%
+ }%
+ \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.
+ }
+ \def\convert@RGBvalue@rgbvalue@TP#1%
+ {%
+ \setlength{\tempdima@TP}{#1pt/255}%
+ \edef\result@TP{\strip@pt\tempdima@TP}%
+ }%
+ \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.
+ }
+ \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}
+ \newcommand{\complement@TP}[1]%
+ {%
+ \setlength{\tempdima@TP}{1pt-#1pt}%
+ \edef\result@TP{\strip@pt\tempdima@TP}%
+ }
+ \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.
+ }
+ \def\grabfourth@TP#1,#2,#3,#4;%
+ {%
+ \def\mem@TP{#4}% Store fourth element.
+ \def\result@TP{#1,#2,#3;}% Store first three elements.
+ }
+ \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.
+ }
+\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.
+ }%
+\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.
+ }%
+ }%
+ \newcommand{\colors@TP}{}
+ \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.
+ }
+ \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.
+ }
+ \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.
+ }
+ \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
+ }
+ \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.
+ }%
+ \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.
+ }%
+ \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
+ }
+ \newcommand{\dimlevel}{.7}
+ \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.
+ }
+ \newcommand{\dimcolors}[1][\dimlevel]
+ {%
+ \def\processme@TP##1{\dimcolor[#1]{##1}}%
+ \colors@TP
+ }%
+ \newcommand{\enhancelevel}{.5}
+ \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.
+ }%
+ {}%
+ }%
+ \newcommand{\enhancecolors}[1][\enhancelevel]
+ {%
+ \def\processme@TP##1{\enhancecolor[#1]{##1}}%
+ \colors@TP
+ }%
+ \newcommand{\replacecolorsbyone@TP}[2]%
+ {%
+ \def\processme@TP##1{\replacecolor{#1##1}{#2}}%
+ \colors@TP
+ }
+ \newcommand{\vanishcolor}{pagecolor}
+ \newcommand{\vanishcolors}[1][\vanishcolor]{\replacecolorsbyone@TP{}{#1}}
+ \input{tpcolors.cfg}
+ \newcommand{\whitebackground}%
+ {%
+ \usecolorset{whitebg}%
+ }
+ \ifthenelse{\boolean{whitebackground@TP}}
+ {\AtEndOfPackage{\whitebackground}}
+ {}
+ \newcommand{\lightbackground}%
+ {%
+ \usecolorset{lightbg}%
+ }
+ \ifthenelse{\boolean{lightbackground@TP}}{\AtEndOfPackage{\lightbackground}}{}
+ \newcommand{\darkbackground}%
+ {%
+ \usecolorset{darkbg}%
+ }
+ \ifthenelse{\boolean{darkbackground@TP}}{\AtEndOfPackage{\darkbackground}}{}
+ \newcommand{\blackbackground}%
+ {%
+ \usecolorset{blackbg}%
+ }
+ \ifthenelse{\boolean{blackbackground@TP}}{\AtEndOfPackage{\blackbackground}}{}
+ \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}}
+ \AtEndOfPackage{\color{textcolor}\let\default@color\current@color}
+ \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}}%
+ }%
+ {}%
+ }%
+ }
+ {}
+ \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][]{}
+ }
+\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.
+\ifthenelse{\boolean{colormath@TP}}% Should we color math?
+{% Yes.
+ \AtBeginDocument
+ {%
+ \expandafter\everymath\expandafter{\the\everymath\color{mathcolor}}%
+ \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{
+ \newcommand{\origmath}[1]{{\everymath{}\ensuremath{\everymath{\color{mathcolor}}#1}}}%
+ \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.
+}
+\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}%
+ }
+\newcommand{\macroname}[1]{\code{\textbackslash#1}}
+\newcommand{\commandapp}[3][]{\code{\macroname{#2}\ifthenelse{\equal{#1}{}}{}{[#1]}\{#3\}}}
+\newcommand{\carg}[1]{\code{\origmath{\left<\code{#1}\right>}}}
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes;
+ \DeclareRobustCommand{\underl}{\textcolor{underlcolor}}% Use color to highlight.
+ }
+{% No;
+ \DeclareRobustCommand{\underl}{\textbf}% Use bold face.
+ }
+\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
+{% Yes;
+ \DeclareRobustCommand{\concept}{\textcolor{conceptcolor}}% Use color to highlight.
+ }
+{% No;
+ \DeclareRobustCommand{\concept}{\textbf}% Use bold face.
+ }
+\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.
+\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}}%
+ }
+\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
+ }
+\newcommand{\rulestripes}{10}
+\newcommand{\stripeoverlap}{.15pt}
+\newcommand{\rulefirstgradprogression}{1}
+\newcommand{\rulesecondgradprogression}{1}
+\newcommand{\rulegradmidpoint}{.5}
+\newcounter{stripe@TP}
+
+\newcounter{stripes@TP}
+
+\newcommand{\firstgradprogression@TP}{1}
+
+\newcommand{\secondgradprogression@TP}{1}
+
+\newcounter{gradprogression@TP}
+
+\newcommand{\gradmidpoint@TP}{.5}
+\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.
+ }
+ {}%
+ }%
+}
+\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.
+}
+\newcommand{\hstripe@TP}[4]%
+{\hbox{{\setcolor@TP{stripecolor@TP}\rule{#2}{#3}}}#4}
+\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]{%
+\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]%
+\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]{%
+
+\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]{%
+
+\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
+\newcommand{\dgradslope}{1,1}
+
+\newcounter{dgradhslope@TP}
+
+\newcounter{dgradvslope@TP}
+
+\def\setdgradslope(#1,#2){\setcounter{dgradhslope@TP}{#1}\setcounter{dgradvslope@TP}{#2}}
+\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}%
+ }%
+ }%
+ }%
+\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.
+ }%
+\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
+}
+\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
+}
+\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
+}
+\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.
+ }
+\newcommand{\bgndstripes}{10}
+\newcommand{\bgndgradmidpoint}{.5}
+\newcommand{\bgndfirstgradprogression}{1}
+\newcommand{\bgndsecondgradprogression}{1}
+\newcommand{\bgndtoppanelheight}{0pt}
+
+\newcommand{\bgndbottompanelheight}{0pt}
+
+\newcommand{\bgndleftpanelwidth}{0pt}
+
+\newcommand{\bgndrightpanelwidth}{0pt}
+\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}
+\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}}
+\newbox\bgndbox@TP
+\setbox\bgndbox@TP\null% Default: Empty.
+\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]{%
+\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]{
+\newcommand{\phantomrule@TP}[2]{\rule{0pt}{#2}\rule{#1}{0pt}}
+\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.
+ }
+\providecommand{\hpagecolor}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\colorbetween{ppendcolor}{#2}{white}\backgroundstyle[startcolor=#2,endcolor=ppendcolor]{hgradient}}
+ {\backgroundstyle[startcolor=#1,endcolor=#2]{hgradient}}%
+ }
+\providecommand{\vpagecolor}[2][]
+{%
+ \ifthenelse{\equal{#1}{}}
+ {\colorbetween{ppendcolor}{#2}{white}\backgroundstyle[startcolor=#2,endcolor=ppendcolor]{vgradient}}
+ {\backgroundstyle[startcolor=#1,endcolor=#2]{vgradient}}%
+ }
+\mklength@TP{\panelmargin}{\fboxsep}
+\newcommand{\toppanelwidth}{\TPpagewidth}% Width.
+\newcommand{\toppanelheight}{\TPpageheight/5}% Height.
+\newcommand{\toppanelshift}{0pt}% Space between left screen edge and left edge of top panel.
+\newcommand{\bottompanelwidth}{\TPpagewidth}% Width.
+\newcommand{\bottompanelheight}{\TPpageheight/5}% Height.
+\newcommand{\bottompanelshift}{0pt}% Space between left screen edge and left edge of bottom panel.
+\newcommand{\leftpanelwidth}{\TPpagewidth/5}% Width.
+\newcommand{\leftpanelheight}{\TPpageheight}% Height.
+\newcommand{\leftpanelraise}{0pt}% Space between bottom screen edge and bottom edge of left panel.
+\newcommand{\rightpanelwidth}{\TPpagewidth/5}% Width.
+\newcommand{\rightpanelheight}{\TPpageheight}% Height.
+\newcommand{\rightpanelraise}{0pt}% Space between bottom screen edge and bottom edge of left panel.
+\newcommand*{\toppanelcontents@TP}{}
+\newcommand*{\bottompanelcontents@TP}{}
+\newcommand*{\leftpanelcontents@TP}{}
+\newcommand*{\rightpanelcontents@TP}{}
+\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.
+ }%
+
+\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.
+}
+
+\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%
+}
+
+\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%
+}
+
+\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.
+
+\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
+ }%
+}
+\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}}%
+\newcommand{\panel@sanitize@TP}
+{%
+ \let\hyperlink=\@secondoftwo
+ \let\Acrobatmenu=\@secondoftwo
+}
+\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.
+}
+\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}%
+ }
+\newcommand{\optwidthsteps}{100}
+\newcommand{\optwidthlinetolerance}{200}
+\let\maxbadness@TP=\@tempcnta
+\def\optwidthdisablecommands@TP
+{%
+ \let\Hy@colorlink\@firstofone
+ \let\Hy@endcolorlink\relax
+ }
+\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]{%
+\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.
+ }%
+ }
+\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
+ }
+\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.
+}
+
+\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.
+ }%
+ }
+\newcommand{\buttonsep}{\fboxsep}
+\newcommand{\buttonrule}{0pt}
+\newcommand{\buttonshadowhshift}{.3\fboxsep}
+\newcommand{\buttonshadowvshift}{-.3\fboxsep}
+\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]{%
+\newcommand{\buttonsymbolsize}{\footnotesize}
+\@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.
+}
+\newcommand{\stdbuttonwidth}{\widthof{\buttonrightarrowsymbol\buttonrightarrowsymbol\buttonrightarrowsymbol}+4pt}
+\newcommand{\currentpagevalue}{\value{page}}
+\newcommand{\backpagebutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\setcounter{tmpcnta@TP}{\currentpagevalue-1}\hyperlink{page.\thetmpcnta@TP}}
+ {\buttonleftarrowsymbol\buttonleftarrowsymbol}%
+ }
+\newcommand{\backstepbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{PrevPage}}
+ {\buttonleftarrowsymbol}%
+ }
+\newcommand{\gobackbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{GoBack}}
+ {\buttonbackarrowsymbol}%
+ }
+\newcommand{\nextstepbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{NextPage}}
+ {\buttonrightarrowsymbol}%
+ }
+\newcommand{\nextpagebutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\setcounter{tmpcnta@TP}{\currentpagevalue+1}\hyperlink{firstpage.\thetmpcnta@TP}}
+ {\buttonrightarrowsymbol\buttonrightarrowsymbol}%
+ }
+\newcommand{\nextfullpagebutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\setcounter{tmpcnta@TP}{\currentpagevalue+1}\hyperlink{page.\thetmpcnta@TP}}
+ {\buttonrightarrowsymbol\buttonrightarrowsymbol\buttonrightarrowsymbol}%
+ }
+\newcommand{\fullscreenbutton}[1][\stdbuttonwidth]
+{%
+ \button[#1]{\Acrobatmenu{FullScreen}}
+ {\buttonrightarrowsymbol\buttonleftarrowsymbol}%
+ }
+\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.
+\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.
+
+\newcommand{\pageTransitionWipe}[1]{\pagetransition{Wipe /Di #1}}% Wipe from one edge of the page to the facing edge.
+
+\newcommand{\pageTransitionDissolve}{\pagetransition{Dissolve}}% Dissolve.
+
+\newcommand{\pageTransitionGlitter}[1]{\pagetransition{Glitter /Di #1}}% Glitter from one edge to the facing edge.
+
+\newcommand{\pageTransitionReplace}{\pagetransition{Replace}}% Simple Replace (the default).
+\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).
+\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.
+\newcommand{\stopAdvancing}
+{\edef\next{\noexpand\pageDuration{\infinitepageduration}}\next}% Reset to default page duration.
+\AtBeginDocument{\shipoutinit@TP}%
+\newcommand*{\shipoutinit@TP}
+{%
+ \let\o@shipout@TP=\shipout% Memorize previous definition.
+ \let\shipout\shipout@TP% Replace by own one.
+ }%
+\newcommand{\shipout@TP}
+{%
+ \afterassignment\shipout@test@TP
+ \global\setbox\@cclv= %
+ }%
+\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%
+ }%
+\newcommand{\shipout@output@TP}
+{%
+ \shipout@hook@TP% Here, our own stuff is executed, manipulating \@cclv.
+ \o@shipout@TP\box\@cclv% Execute original shipout routine.
+ }%
+\newcommand{\AtShipout}[1]
+{\expandafter\gdef\expandafter\at@shipout@once@TP\expandafter{\at@shipout@once@TP#1}}% Add argument to container.
+\newcommand{\at@shipout@once@TP}{}
+\AtBeginDocument{\global\let\o@hyper@@anchor\hyper@@anchor}
+\@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.
+\newcommand{\dont@insert@firstanchor@TP}{}%
+\newcommand{\insert@firstanchor@TP}{\do@insert@firstanchor@TP}%
+\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
+ }%
+ }
+\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
+ }
+ \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.
+ \def\remove@resetcolor@TP#1\aftergroup\reset@color%
+ {\def\pushcolor@TP##1{{\def\current@color{##1}#1}}}%
+ %
+ \expandafter\remove@resetcolor@TP\set@color
+ \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.
+ }%
+ \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
+\newif\ifshippingduplicate
+\providecommand{\TPeject}{\newpage}
+\newbox\mempageconts@TP
+\newinsert\memfootins@TP
+\newtoks\memoutput@TP
+\def\cl@@ckptpause@TP{\@elt{page}}
+\def\savepausecounters@TP{%
+ \begingroup
+ \def\@elt##1{\global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
+ \xdef\restorepausecounters@TP{\cl@@ckptpause@TP}%
+ \endgroup
+ }
+\newcommand{\pausesafecounter}[1]%
+{\expandafter\def\expandafter\cl@@ckptpause@TP\expandafter{\cl@@ckptpause@TP\@elt{#1}}}
+\@ifclassloaded{seminar}{\pausesafecounter{slide}}{}
+\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.
+ }
+\let\filterpage@TP\relax
+\newcommand{\filterwhatsits@TP}{\global\setbox\@cclv=\hbox{\leaders\copy\@cclv\hskip\wd\@cclv}}
+\newcommand{\insertfirstduplicate@TP}
+{\unvcopy\mempageconts@TP}% Just output the vbox's contents.
+\newcommand{\do@colorcorrections@TP}
+{%
+ {%
+ \colorcorrections@TP% Execute color correction stack.
+ \gdef\colorcorrections@TP{\relax}% Re-initialize for next round.
+ }%
+ }
+\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.
+ }
+\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.
+ }%
+\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.
+ }
+ {}%
+ }%
+\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.
+ }%
+ }%
+}
+\newcounter{totalsteps}
+\newcounter{firststep}
+\newcounter{step}
+\newcounter{stepcommand}
+\newcounter{stepsperformed}
+\newboolean{firstactivation}
+\newboolean{active}
+\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.
+\let\displayidentical=\@iden
+\newcommand{\hidephantom}[1]
+{%
+ {% a group makes redefinitions local
+ \leavevmode\phantom{#1}%
+ }%
+ }
+\newcommand{\hideignore}[1]{}
+\newcommand{\hidesmartignore}[1]{\setbox\tempbox@TP=\vbox{#1}}
+\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...
+ }%
+}
+\ifthenelse{\boolean{colormath@TP}}% Should we color math?
+{% Yes.
+ \newcommand{\commitcolor@TP}
+ {\textcolor{\ifmmode mathcolor\else textcolor\fi}}
+ }
+{% No.
+ \newcommand{\commitcolor@TP}{\textcolor{textcolor}}% Switch to textcolor.
+}
+\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.
+\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.
+\newcommand{\boxedsteps} % Use boxed versions.
+{\let\displaystepcontents=\displayboxed\let\hidestepcontents=\hidephantom}
+
+\newcommand{\nonboxedsteps} % Use nonboxed versions.
+{\let\displaystepcontents=\displayidentical\let\hidestepcontents=\hideignore}
+\nonboxedsteps
+\let\activatestep=\displayidentical
+\newlength{\highlightboxsep}
+\setlength{\highlightboxsep}{.5\fboxsep}
+\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
+}
+\newcommand{\math@hb@TP}[2]{\text@hb@TP{$\m@th#1{#2}$}}
+\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}}
+\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%
+\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.
+\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.
+ }
+\newcommand{\deactivate@inner@TP}% \switch behaviour.
+{%
+ \let\inner@display@TP=\displayidentical%
+ \let\inner@hide@TP=\displayidentical%
+ }
+
+\newcommand{\activate@inner@TP}% \step behaviour.
+{%
+ \let\inner@display@TP=\displaystepcontents%
+ \let\inner@hide@TP=\hidestepcontents%
+ }
+\@onlyinstepwise@TP\step
+\newcommand{\proper@step@TP}{\let\@do@s@TP=\@step@TP\pickup@s@optargs@TP}
+\newcommand{\@step@TP}[1]{\activate@inner@TP\@@switch@TP{#1}{#1}}
+\@onlyinstepwise@TP\switch
+\newcommand{\proper@switch@TP}{\deactivate@inner@TP\let\@do@s@TP=\@@switch@TP\pickup@s@optargs@TP}
+\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
+ }
+\@ifundefined{ifmeasuring@}{\newif\ifmeasuring@}{}
+\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.
+\@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.
+ }
+\@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.
+ }
+\@onlyinstepwise@TP\bstep
+
+\newcommand{\proper@bstep@TP}{\let\@do@s@TP=\@bstep@TP\pickup@s@optargs@TP}
+\newcommand{\@bstep@TP}[1]{{\boxedsteps\@step@TP{#1}}}
+\@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.
+ }
+\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.
+\@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.
+ }
+\@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.
+\@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.
+ }
+\@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}
+\newcommand{\@@steponce@TP}[1]{\expandafter\step\optarg@so@TP[\boolean{firstactivation}]{#1}}
+\newcounter{substep}
+\@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}
+
+\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.
+\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}}%
+ }%
+ }
+\@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}}
+\@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}
+\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}}}%
+ }%
+}
+\newenvironment{stepcapsule}{}{}
+\newcommand{\afterstep}[1]
+{%
+ \gdef\@afterstep@TP{#1}% The argument is simply stored in \@afterstep@TP, which is executed in \stepwise.
+ }
+\newcounter{o@fs@TP}
+\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.
+ }%
+\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.
+\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.
+ ]%
+ }
+\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.
+ ]%
+ }
+\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).
+}
+\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
+ }
+\def\saveTPcounters@TP{%
+ \begingroup
+ \def\@elt##1{\global\csname c@##1\endcsname\the\csname c@##1\endcsname}%
+ \xdef\restoreTPcounters@TP{\cl@@ckpt@TP}%
+ \endgroup
+ }
+\def\cl@@ckpt@TP{\@elt{totalsteps}\@elt{firststep}\@elt{step}\@elt{stepcommand}\@elt{stepsperformed}\@elt{o@fs@TP}}
+\newcommand{\releasecounter}[1]%
+{\expandafter\def\expandafter\cl@@ckpt@TP\expandafter{\cl@@ckpt@TP\@elt{#1}}}
+\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]{}%
+}
+\newboolean{instepwise@TP}
+\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%
+ \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
+ #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
+\InputIfFileExists{tpsettings.cfg}{}{}
+\endinput
+%%
+%% End of file `texpower.sty'.