diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:08:54 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:08:54 +0000 |
commit | 54b085e6104e56908ac781c93c7582a12c67a67a (patch) | |
tree | fee7fc79f0c293008bea49dcc2835430de4fff0a /Master | |
parent | 84f6459a27effe7fec2d3d379761b56fb959d34e (diff) |
texpower
git-svn-id: svn://tug.org/texlive/trunk@1380 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/automata.sty | 1089 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/fixseminar.sty | 168 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/powersem.cls | 234 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/texpower.sty | 3150 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/tpcolors.cfg | 383 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/tplists.sty | 514 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/tpoptions.cfg | 40 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/tppstcol.sty | 99 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/tpsem-a4.sty | 36 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/texpower/tpsettings.cfg | 37 |
10 files changed, 5750 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/texpower/automata.sty b/Master/texmf-dist/tex/latex/texpower/automata.sty new file mode 100644 index 00000000000..dc5f856a3fc --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/automata.sty @@ -0,0 +1,1089 @@ +%% +%% This is file `automata.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-addons.dtx (with options: `automata') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +%======================================================================================================================= +% File: automata.sty +% +% Draw and animate `automata' as used in theoretical computer science, using PSTricks and TeXPower. +% +% This package is an addition to the TeXPower bundle, to be found at +% +% http://texpower.sourceforge.net/ +% +%======================================================================================================================= +% Author: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de> +% +% v0.2 Oct 05, 2001 First version for the pre-alpha release of texpower. +% Only deterministic FA and Mealy Automata yet. +% + +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage% +{automata}% +[2001/10/05 v0.2 Draw and animate automata.] + + +%======================================================================================================================= + +\RequirePackage{ifthen} + +\RequirePackage{relsize} + +\RequirePackage{texpower} + +\ifthenelse{\boolean{psspecialsallowed}}{\RequirePackage{tppstcol}}{} + + +%======================================================================================================================= +% Implementation of the functionality. + +%----------------------------------------------------------------------------------------------------------------------- +% Some definitions of general interest. + +\defineTPcolor{automatoncolor}{gray}{0.8} +\defineTPcolor{autoplatecolor}{gray}{0.95} +\defineTPcolor{currstatecolor}{rgb}{0.8,1,0.8} +\colorbetween{markstatecolor@TPATM}{pagecolor}{currstatecolor} +\replacecolor{cellcolor}{white} + + + +\newlength{\tapepos@TPATM} + +\newcounter{tapecells@TPATM} +\newcounter{inputlength@TPATM} +\newcounter{states@TPATM} +\newcounter{currstate@TPATM} +\newcounter{nextstate@TPATM} +\newcounter{currinputsymbol@TPATM} +\newcounter{currtapepos@TPATM} + +\newtoks\tabrows@TPATM +\newtoks\tabdecl@TPATM + +\newsavebox{\tabbox@TPATM} + +\newboolean{stategraph@TPATM} + +\newif\iffliplabel@TPATM + +\newcommand{\formatsymbol}[1]{\texttt{#1}} + + +%----------------------------------------------------------------------------------------------------------------------- +% Helper macros. + +% Make a fixed point number have exactly five decimal places, either by truncating or by filling up with trailing +% zeroes. +\newcommand{\filltofive@TPATM}[1]{\expandafter\@filltofive@TPATM#1000000\@nil#1} + +\def\@filltofive@TPATM#1.#2#3#4#5#6#7\@nil#8{\def#8{#1.#2#3#4#5#6}} + + +% Count the number of items in a comma-separated list. +\newcommand{\countsymbols@TPATM}[2]{\setcounter{#2}{1}\@countsymbols@TPATM#1,\@nil{#2}} + +\def\@countsymbols@TPATM#1,#2\@nil#3{\ifthenelse{\equal{#2}{}}{}{\stepcounter{#3}\@countsymbols@TPATM#2\@nil{#3}}} + + + +% Get a symbol from a (macro containing a) comma-separated list. +\newcommand{\getsymbol@TPATM}[2] +{% + \expandafter\@getsymbol@TPATM#1\@nil{#1}{#2}% +} + +\def\@getsymbol@TPATM#1,#2\@nil#3#4{\gdef#3{#2}\@@getsymbol@TPATM#1\@nil{#4}} + +\def\@@getsymbol@TPATM{\@ifnextchar({\@@@getsymbol@TPATM}{\@@@getsymbol@TPATM()}} + +\def\@@@getsymbol@TPATM(#1)#2\@nil#3{\def\statepos@TPATM{#1}\def#3{#2}} + + +% Get a state from a (macro containing a) comma-separated list of states and check whether it's accepting. + +\newif\ifacceptingstate@TPATM + +\newcommand{\getstate@TPATM}[4]{\expandafter\@getstate@TPATM#1\@nil{#1}{#2}{#3}{#4}} + +\def\@getstate@TPATM#1,#2\@nil#3#4#5#6{\gdef#3{#2}\@@getstate@TPATM#1\@nil{#4}{#5}{#6}} + +\def\@@getstate@TPATM{\@ifnextchar({\@@@getstate@TPATM}{\@@@getstate@TPATM()}} + +\def\@@@getstate@TPATM(#1)#2#3\@nil#4#5#6% +{% + \def\statepos@TPATM{#1}% + \def#6{#2#3}% + \ifx\accept#2% + \acceptingstate@TPATMtrue% + \def#5{#4}% + \else + \acceptingstate@TPATMfalse% + \let#5\empty + \fi + } + +% Get a state transition from a (macro containing a) comma-separated list of states. +\newcommand{\getdeltapair@TPATM}[3] +{% + \expandafter\@getdeltapair@TPATM#1\@nil{#1}{#2}{#3}% +} + +\def\@getdeltapair@TPATM{\@ifnextchar[{\@@getdeltapair@TPATM}{\@@getdeltapair@TPATM[\@nil]}} + +\def\@@getdeltapair@TPATM[#1]% +{% + \def\optarg@TPATM{#1}% + \@ifstar{\let\fliplabel@TPATM=\fliplabel@TPATMtrue\@@@getdeltapair@TPATM} + {\let\fliplabel@TPATM=\fliplabel@TPATMfalse\@@@getdeltapair@TPATM}% + } + +\def\@@@getdeltapair@TPATM{\@ifnextchar({\@@@@getdeltapair@TPATM}{\@@@@getdeltapair@TPATM(.5)}} + +\def\@@@@getdeltapair@TPATM(#1)% +{% + \def\labelpos@TPATM{#1}% + \@ifnextchar[{\@@@@@getdeltapair@TPATM}{\@@@@@getdeltapair@TPATM[\@nil]}% + } + +\def\@@@@@getdeltapair@TPATM[#1]#2->#3,#4\@nil#5#6#7{\def\labelopt@TPATM{#1}\protected@edef#6{#2}\protected@edef#7{#3}\gdef#5{#4}} + +% Decompose a comma-separated pair (without parentheses) into its components. +\def\decomposestpos@TPATM#1,#2\@nil#3#4{\def#3{#1}\def#4{#2}} + +% Remove trailing comma from a comma-separated list. +\def\gobblelastcomma@TPATM#1,\@nil#2{\gdef#2{#1}} + +% A first step towards internationalization - german only at the moment. +\newcommand{\automatonname}{Automatenmodell} +\newcommand{\inputname}{Eingabe} +\newcommand{\inputtapename}{Eingabeband} +\newcommand{\outputname}{Ausgabe} +\newcommand{\outputtapename}{Ausgabeband} +\newcommand{\acceptname}{Akzeptieren} +\newcommand{\statename}{Zustand} +\newcommand{\statesname}{Zust"ande} +\newcommand{\statetransname}{Zustands"uberg"ange} +\newcommand{\nextstatename}{Folgezust.} + +\newcommand{\statetransitiontablepreamble}{} + +\newcommand{\transitionarrayparameters} +{% + \renewcommand{\arraystretch}{.3}% + \setlength{\extrarowheight}{16pt}% + \setlength{\tabcolsep}{.5pt}% +} + +\let\accept\empty +\let\comma\empty + + +%----------------------------------------------------------------------------------------------------------------------- +% Finite Automata. + +% Generic macros for drawing deterministic finite automata. The difference between simple dfa and mealy automata is made +% by setting parameters. + +\def\finalisetabrows@TPATM#1\\\@nil#2{#2={#1\end{tabular}}}% + +\newcommand{\draw@outputtape@TPATM}[1]{}% +\newcommand{\getoutput@TPATM}[2]{} +\newcommand{\inittabrows@TPATM}[1]{} +\newcommand{\addtabrow@TPATM}[2]{} +\newcommand{\label@output@TPATM}{}% +\newcommand{\fix@nextstate@TPATM}{} +\newcommand{\mk@new@outputtape@TPATM}[1]{}% + + + +\newcommand{\genericdfa@TPATM}[8] +{% + \begin{pspicture}(1,1) + % Draw automaton body. + \psframe[fillstyle=solid,fillcolor=automatoncolor](0.05,0)(0.95,1) + \rput[b]{90}(0.05,0.5){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\automatonname}}% + % Draw input tape. + \rput[l](0.07,0.93){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\inputtapename}}% + \setlength{\tapepos@TPATM}{0.55pt-0.1pt*\real{#6}}% + \setcounter{currinputsymbol@TPATM}{1*\real{#6}}% + \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM}{1pt}}% + \setcounter{tapecells@TPATM}{6+\value{currinputsymbol@TPATM}}% + \countsymbols@TPATM{#5}{inputlength@TPATM}% + \ifthenelse{\value{tapecells@TPATM}>\value{inputlength@TPATM}} + {\setcounter{tapecells@TPATM}{\value{inputlength@TPATM}}} + {}% + \multips(\startx@TPATM,0.88)(0.1,0){\value{tapecells@TPATM}}{\psframe[fillstyle=solid,fillcolor=cellcolor](0.1,0.1)}% + \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM+0.05pt}{1pt}}% + \filltofive@TPATM{\startx@TPATM}% + \protected@edef\tapecontents@TPATM{#5,}% + \setcounter{currtapepos@TPATM}{0}% + \let\inputtapesymbol@TPATM\relax + \let\nextinputtapesymbol@TPATM\relax + \multido{\n=\startx@TPATM+0.10000}{\value{tapecells@TPATM}} + {% + \getsymbol@TPATM\tapecontents@TPATM\inputtapesymbol@TPATM + \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}\relax + \global\let\nextinputtapesymbol@TPATM\inputtapesymbol@TPATM + \fi + \stepcounter{currtapepos@TPATM}% + \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}\relax + \global\let\inputtapesymbol@TPATM\inputtapesymbol@TPATM + \fi + \rput(\n,0.93){\formatsymbol\inputtapesymbol@TPATM}% + }% + \psframe[linewidth=2pt,linecolor=conceptcolor](0.45,0.88)(0.55,0.98) + % Draw state transitions + \countsymbols@TPATM{#1}{states@TPATM}% + \mkfactor{\tapeadvancement@TPATM}{\real{#6}-\value{currinputsymbol@TPATM}pt}% + \def\defdelta@TPATM{#3,}% + \whiledo{\not\equal{\defdelta@TPATM}{}} + {% + \getdeltapair@TPATM\defdelta@TPATM\domainvalue@TPATM\rangevalue@TPATM + \expandafter\def\csname delta(\domainvalue@TPATM)@TPATM\expandafter\endcsname\expandafter{\rangevalue@TPATM}% + \expandafter\let\csname deltaopt(\domainvalue@TPATM)@TPATM\endcsname=\optarg@TPATM + \expandafter\let\csname deltalabelpos(\domainvalue@TPATM)@TPATM\endcsname=\labelpos@TPATM + \expandafter\let\csname deltalabelopt(\domainvalue@TPATM)@TPATM\endcsname=\labelopt@TPATM + \expandafter\let\csname deltaflag(\domainvalue@TPATM)@TPATM\endcsname=\empty + \expandafter\let\csname deltafliplabel(\domainvalue@TPATM)@TPATM\endcsname=\fliplabel@TPATM + }% + \ifthenelse{\boolean{stategraph@TPATM}}% Draw state transition diagram? + {% Yes. + \ifthenelse{\lengthtest{\tapeadvancement@TPATM pt=0pt}} + {% + \let\nextinputtapesymbol@TPATM\inputtapesymbol@TPATM + \ifthenelse{\value{nextstate@TPATM}>-1}{\def\tapeadvancement@TPATM{1}}{}% + }{}% + \colorbetween[\tapeadvancement@TPATM]{activetranscolor@TPATM}{currstatecolor}{pagecolor}% + \rput(0.5,0.5) + {% + \begingroup + % Make `subpicture' containing the state transition diagram. + \psset{xunit=.43\psxunit,yunit=.36\psyunit,labelsep=1pt}% + \begin{pspicture}(0,0) + \psframe[fillstyle=solid,fillcolor=cellcolor,dimen=inner](-1,-1)(1,1) + \rput[lt](-1,1){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\statetransname}}% + % First, the nodes representing states. + \mkfactor{\statedistance@TPATM}{2/\value{states@TPATM}}% + \mkfactor\startx@TPATM{-1+\statedistance@TPATM pt/2}% + \def\states@TPATM{#1,}% + \setcounter{currstate@TPATM}{0}% + \multido{\n=\startx@TPATM+\statedistance@TPATM}{\value{states@TPATM}} + {% + \stepcounter{currstate@TPATM}% + \getstate@TPATM{\states@TPATM}{,linewidth=2pt,linecolor=red}{\statetype@TPATM}{\state@TPATM}% + \ifnum\value{currstate@TPATM}=#7\relax + \ifacceptingstate@TPATM\global\acceptingstate@TPATMtrue\else\global\acceptingstate@TPATMfalse\fi + \fi + \edef\next + {% + \noexpand + \cnode + [% + fillstyle=solid,% + fillcolor=\ifnum\value{currstate@TPATM}=#7currstatecolor\else cellcolor\fi\statetype@TPATM + ]% + (\ifx\statepos@TPATM\empty\n,0\else\statepos@TPATM\fi)% + }% + \next{.4}{{state\state@TPATM}}% + \rput(\ifx\statepos@TPATM\empty\n,0\else\statepos@TPATM\fi){\let\comma,\state@TPATM}% + \ifthenelse{\value{currstate@TPATM}=#4} + {% + \ifx\statepos@TPATM\empty + \mkfactor{\stxpos@TPATM}{\real{\n}-.2pt}% + \def\stypos@TPATM{0}% + \else + \expandafter\decomposestpos@TPATM\statepos@TPATM\@nil{\stxpos@TPATM}{\stypos@TPATM}% + \mkfactor{\stxpos@TPATM}{\real{\stxpos@TPATM}-.2pt}% + \fi + \pnode(\stxpos@TPATM,\stypos@TPATM){start}% + \ncline{->}{start}{state\state@TPATM}% + }{}% + }% + % Next, the node connections. + \setcounter{currstate@TPATM}{0}% + \def\states@TPATM{#1,}% + \whiledo{\not\equal{\states@TPATM}{}} + {% + \stepcounter{currstate@TPATM}% + \getsymbol@TPATM\states@TPATM\state@TPATM + \protected@edef\state@TPATM{\state@TPATM}% + \def\inputalphabet@TPATM{#2,}% + \whiledo{\not\equal{\inputalphabet@TPATM}{}} + {% + \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM + \getoutput@TPATM\state@TPATM\inputsymbol@TPATM + \ifthenelse{\equal{\csname deltaflag(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname}{}} + {% + \let\currentnstate@TPATM=\nstate@TPATM + \let\currentia@TPATM=\inputalphabet@TPATM + \inittabrows@TPATM\tabrows@TPATM + \def\arrowparams@TPATM{border=1pt}% + \begingroup + \def\inputalphabet@TPATM{#2,}% + \whiledo{\not\equal{\inputalphabet@TPATM}{}} + {% + \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM + \getoutput@TPATM\state@TPATM\inputsymbol@TPATM + \ifx\currentnstate@TPATM\nstate@TPATM + \expandafter\global\expandafter\let + \csname deltaflag(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname=\relax + \ifthenelse + {% + \value{currstate@TPATM}=#7% + \and\equal\inputsymbol@TPATM\nextinputtapesymbol@TPATM + \and\lengthtest{\tapeadvancement@TPATM pt>0pt}% + } + {% + \xdef\arrowparams@TPATM + {% + doubleline=true,doublecolor=activetranscolor@TPATM,doublesep=\tapeadvancement@TPATM pt,% + arrowsize=1pt 1.5,border=1pt% + }% + \def\@hlinput@TPATM{\noexpand\rowcolor{activetranscolor@TPATM}}% + } + {\let\@hlinput@TPATM=\empty}% + \addtabrow@TPATM\tabrows@TPATM{\inputsymbol@TPATM}% + \ifnum\value{currstate@TPATM}=#7\relax + \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM + \fix@nextstate@TPATM% + \fi + \fi + \fi + }% + \expandafter\finalisetabrows@TPATM\the\tabrows@TPATM\@nil\tabrows@TPATM + \global\tabrows@TPATM=\tabrows@TPATM + \endgroup + \expandafter\gdef\expandafter\fullarrowparams@TPATM\expandafter{\expandafter[\arrowparams@TPATM]}% + \expandafter\gdef\expandafter\addarrowparams@TPATM\expandafter{\expandafter,\arrowparams@TPATM}% + \global\let\inputalphabet@TPATM=\currentia@TPATM + \transitionarrayparameters + \csname deltafliplabel(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname + \edef\mkcirclabel@TPATM + {% + \iffliplabel@TPATM\noexpand\aput\else\noexpand\bput\fi + \expandafter\ifx\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\@nnil + \else + [\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname]% + \fi + (\csname deltalabelpos(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname)% + }% + \edef\mklinelabel@TPATM + {% + \iffliplabel@TPATM\noexpand\bput\else\noexpand\aput\fi + \expandafter\ifx\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\@nnil + \else + [\csname deltalabelopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname]% + \fi + (\csname deltalabelpos(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname)% + }% + \expandafter + \ifx\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\@nnil + \ifx\state@TPATM\nstate@TPATM + \expandafter\nccircle\fullarrowparams@TPATM{->}{state\state@TPATM}{.35}% + \mkcirclabel@TPATM{\the\tabrows@TPATM}% + \else + \expandafter\ncline\fullarrowparams@TPATM{->}{state\state@TPATM}{state\nstate@TPATM}% + \mklinelabel@TPATM{\the\tabrows@TPATM}% + \fi + \else + \ifx\state@TPATM\nstate@TPATM + \edef\next + {% + \noexpand\nccircle + \expandafter + \ifx\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\empty + \fullarrowparams@TPATM + \else + [\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\addarrowparams@TPATM]% + \fi + }% + \next{->}{state\state@TPATM}{.35}% + \mkcirclabel@TPATM{\the\tabrows@TPATM}% + \else + \edef\next + {% + \noexpand\ncarc + \expandafter + \ifx\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\empty + \fullarrowparams@TPATM + \else + [\csname deltaopt(\state@TPATM;\inputsymbol@TPATM)@TPATM\endcsname\addarrowparams@TPATM]% + \fi + }% + \next{->}{state\state@TPATM}{state\nstate@TPATM}% + \mklinelabel@TPATM{\the\tabrows@TPATM}% + \fi + \fi + }% + {}% + }% + }% + \end{pspicture}% + \endgroup + }% + } + {% No; draw state transition table. + % First, the list of states. + \rput[l](0.07,0.81){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\statesname}}% + \mkfactor\startx@TPATM + {\ratio{\widthof{\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\statesname}}}{\psyunit}}% + \mkfactor{\statewidth@TPATM}{0+(0.88pt-\startx@TPATM pt)/\value{states@TPATM}}% + \ifthenelse{\lengthtest{\statewidth@TPATM pt>.1pt}}{\def\statewidth@TPATM{.1}}{}% + \filltofive@TPATM{\startx@TPATM}% + \filltofive@TPATM{\statewidth@TPATM}% + \def\states@TPATM{#1,}% + \setcounter{currstate@TPATM}{0}% + \multido{\n=\startx@TPATM+\statewidth@TPATM}{\value{states@TPATM}} + {% + \stepcounter{currstate@TPATM}% + \mkfactor{\endx@TPATM}{\real{\n}+\statewidth@TPATM pt}% + \getstate@TPATM{\states@TPATM}{,linewidth=2pt,linecolor=red}{\statetype@TPATM}{\state@TPATM}% + \ifnum\value{currstate@TPATM}=#7 + \ifacceptingstate@TPATM\global\acceptingstate@TPATMtrue\else\global\acceptingstate@TPATMfalse\fi + \fi + \edef\next + {% + \noexpand + \psframe + [% + fillstyle=solid,% + fillcolor=\ifnum\value{currstate@TPATM}=#7currstatecolor\else cellcolor\fi\statetype@TPATM + ]% + }% + \next(\n,0.76)(\endx@TPATM,0.86)% + \mkfactor{\charpos@TPATM}{\real{\n}+\statewidth@TPATM pt/2}% + \rput(\charpos@TPATM,0.81){\state@TPATM}% + \ifthenelse{\value{currstate@TPATM}=#4}{\psline{->}(\charpos@TPATM,0.74)(\charpos@TPATM,0.76)}{}% + }% + % Next, the state transition table itself. + \psframe[fillstyle=solid,fillcolor=cellcolor,dimen=inner](0.07,0.14)(0.93,0.74) + \rput[lt](0.07,0.74){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller\statetransname}}% + % Construct tabular declaration and first row. + \def\inputalphabet@TPATM{#2,}% + \tabrows@TPATM={}% + \tabdecl@TPATM={}% + \ifthenelse{\equal{\inputtapesymbol@TPATM}{\nextinputtapesymbol@TPATM}} + {% + \replacecolor{oldinputcolor@TPATM}{markstatecolor@TPATM}% + \replacecolor{newinputcolor@TPATM}{markstatecolor@TPATM}% + \replacecolor{oldoutputcolor@TPATM}{currstatecolor}% + \replacecolor{newoutputcolor@TPATM}{currstatecolor}% + } + {% + \colorbetween[\tapeadvancement@TPATM]{oldinputcolor@TPATM}{pagecolor}{markstatecolor@TPATM}% + \colorbetween[\tapeadvancement@TPATM]{newinputcolor@TPATM}{markstatecolor@TPATM}{pagecolor}% + \ifthenelse{\lengthtest{\tapeadvancement@TPATM pt>0.5pt}} + {% + \colorbetween[\tapeadvancement@TPATM]{newoutputcolor@TPATM}{currstatecolor}{pagecolor}% + \replacecolor{oldoutputcolor@TPATM}{markstatecolor@TPATM}% + } + {% + \colorbetween[\tapeadvancement@TPATM]{oldoutputcolor@TPATM}{pagecolor}{currstatecolor}% + \replacecolor{newoutputcolor@TPATM}{markstatecolor@TPATM}% + }% + }% + \whiledo{\not\equal{\inputalphabet@TPATM}{}} + {% + \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM + \protected@edef\newtabrows@TPATM{\the\tabrows@TPATM&\noexpand\formatsymbol{\inputsymbol@TPATM}}% + \expandafter\tabrows@TPATM\expandafter{\newtabrows@TPATM}% + \edef\newtabdecl@TPATM + {% + \the\tabdecl@TPATM + \ifx\inputsymbol@TPATM\nextinputtapesymbol@TPATM>{\noexpand\columncolor{newinputcolor@TPATM}}\fi + \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM>{\noexpand\columncolor{oldinputcolor@TPATM}}\fi + c% + }% + \expandafter\tabdecl@TPATM\expandafter{\newtabdecl@TPATM}% + }% + % Construct remaining rows. + \setcounter{currstate@TPATM}{0}% + \def\states@TPATM{#1,}% + \whiledo{\not\equal{\states@TPATM}{}} + {% + \stepcounter{currstate@TPATM}% + \getsymbol@TPATM\states@TPATM\state@TPATM + \protected@edef\newtabrows@TPATM + {% + \the\tabrows@TPATM\noexpand\\% + \ifnum\value{currstate@TPATM}=#7 \noexpand\rowcolor{markstatecolor@TPATM}\fi\state@TPATM + }% + \expandafter\tabrows@TPATM\expandafter{\newtabrows@TPATM}% + \def\inputalphabet@TPATM{#2,}% + \whiledo{\not\equal{\inputalphabet@TPATM}{}} + {% + \getsymbol@TPATM\inputalphabet@TPATM\inputsymbol@TPATM + \protected@edef\newtabrows@TPATM + {% + \the\tabrows@TPATM&% + \ifnum\value{currstate@TPATM}=#7 + \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM + \noexpand + \multicolumn{1}{>{\noexpand\columncolor{oldoutputcolor@TPATM}}c} + {\formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM}% + \else + \ifx\inputsymbol@TPATM\nextinputtapesymbol@TPATM + \noexpand + \multicolumn{1}{>{\noexpand\columncolor{newoutputcolor@TPATM}}c} + {\formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM}% + \else + \formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM + \fi + \fi + \else + \formatdfaoutput@TPATM\state@TPATM\inputsymbol@TPATM + \fi + }% + \expandafter\tabrows@TPATM\expandafter{\newtabrows@TPATM}% + % Set succeeding state (and output symbol). + \ifnum\value{currstate@TPATM}=#7\relax + \ifx\inputsymbol@TPATM\inputtapesymbol@TPATM + \getoutput@TPATM{\state@TPATM}{\inputsymbol@TPATM}% + \fix@nextstate@TPATM + \fi + \fi + }% + }% + % Save tabular into a box. + \savebox{\tabbox@TPATM} + {% + \raisebox{\depth} + {% + \setlength{\fboxsep}{0.4pt}% + \fbox + {% + \clipbox + {% + \edef\next{\noexpand\begin{tabular}[b]{c\the\tabdecl@TPATM}}% + \statetransitiontablepreamble + \next + \the\tabrows@TPATM + \end{tabular}% + }% + }% + }% + }% + % Print state transition table, with some decoration. + \rput(0.5,0.44) + {% + \raisebox{.5\tabcolsep} + {\rotatebox{90}{\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller \statename}}}% + \parbox[b]{\wd\tabbox@TPATM} + {% + \offinterlineskip\raggedleft + \psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller \inputname}\kern\tabcolsep\\% + \usebox{\tabbox@TPATM}% + }% + \raisebox{.5\tabcolsep} + {% + \rotatebox{90} + {\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller[2]\nextstatename}}% + }% + \label@output@TPATM + }% + }% + % Draw output tape, if mealy automaton. + \draw@outputtape@TPATM{#8}% + % Calculate number of succeeding state. + \setcounter{currstate@TPATM}{0}% + \def\states@TPATM{#1,}% + \whiledo{\not\equal{\states@TPATM}{}} + {% + \stepcounter{currstate@TPATM}% + \getsymbol@TPATM\states@TPATM\state@TPATM + \edef\state@TPATM{\state@TPATM}% + \ifx\state@TPATM\nextstate@TPATM + \setcounter{nextstate@TPATM}{\value{currstate@TPATM}}% + \fi + }% + % Calculate new output tape. + \mk@new@outputtape@TPATM{#8}% + \end{pspicture}% + \endgroup + } + + +% \dfa{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>} +% {<initial state>}{<input tape>}{<tape position>}{<current state>} +% draws a deterministic finite automaton. +% +% The parameters have the following meanings: +% <width> Width of the automaton to be drawn. +% <height> Height of the automaton to be drawn. +% <states> Comma-separated list (symbolically) specifying the set of states. +% <inputalphabet> Comma-separated list (symbolically) specifying the set of input symbols. +% <statetransitions> Comma-separated list (symbolically) specifying the state transition function (also giving the +% output symbols associated with state transitions). +% <initial state> Number of the initial state. +% <input tape> Comma-separated list (symbolically) specifying the contents of the input tape. +% <tape position> Fixed-point number (greater or equal 1) specifying the current position of the head reading input +% and output tape. The symbol currently read corresponds to the integer part of <tape position>. +% <current state> Number of the current state. +% +% The standard version of \dfa displays a state transition table, i.e. for every combination of state and +% input symbol, the successor state is displayed in a tabular. The current state, current input +% symbol and next input symbol (if <tape position> is not integer) are indicated by colored bars. +% +% There is a starred version \mealyautomaton* which displays a state transition graph where states are displayed as +% circles and state transitions as arrows between circles. The `active' transition (leading from the current to the next +% state) is highlighted. +% +% The <states> parameter looks like <state1>,<state2>,...,<staten>, where every single <state> has the following form: +% {(<x>,<y>)\accept <symbol>} +% where (<x>,<y>) and the special keyword \accept are optional and <symbol> is the symbolic name of the state. +% The optional parameter (<x>,<y>) is used only in the starred version \mealyautomaton*. If given, it specifies the +% position of the circle representing the state in the state transition graph, in PSTricks notation. The origin of the +% state transition graph is in the middle of the area reserved for it, stretching one unit in all directions, so that +% the corners of the area are at coordinates (-1,1), (1,1), (1,-1), (-1,-1). If not given in the starred version +% \mealyautomaton*, the position is calculated automatically in a `bead' style. +% The special keyword \accept flags this state as an accepting one. +% If the optional coordinates argument is not given, the outer curly braces may be left out, but otherwise leaving the +% curly braces out would disturb the parsing of the comma-separated list because of the comma between <x> and <y>. +% +% The <statetransitions> parameter looks like <trans1>,<trans2>,...,<transm>, where every single <trans> has the +% following form: +% [<opt>]<state>;<input>-><state'> +% where [<opt>] is optional. <state> and <input> are the arguments of the state transition function, and <state'> is the +% successor state. +% The optional parameter [<opt>] is used only in the starred version \mealyautomaton*. If given, it specifies additional +% optional parameters for the node connection command (\nccircle or \ncarc) drawing the arrow for this +% transition. \ncline is used for transitions from a state to itself. For transitions between states, \ncarc is used +% whenever the optional argument is given, otherwise \ncline is used. This is a seldom instance where giving an empty +% optional argument is different from giving no optional argument at all: Giving the optional argument [] switches +% between \ncline and \ncarc (useful if two transitions go `back and forth' between two states). +% + +\newcommand{\initializedfa@TPATM} +{% + \renewcommand{\draw@outputtape@TPATM}[1] + {% + \colorbetween{outercirclecolor@TPATM}{black}{automatoncolor}% + \pscircle[fillstyle=solid,fillcolor=outercirclecolor@TPATM,linewidth=.5\pslinewidth](0.5,0.07){0.25}% + \ifacceptingstate@TPATM + \replacecolor{acceptlampcolor@TPATM}{red}% + \else + \colorbetween[.1]{acceptlampcolor@TPATM}{red}{automatoncolor}% + \fi + \pscircle[fillstyle=solid,fillcolor=acceptlampcolor@TPATM,linewidth=.5\pslinewidth](0.5,0.07){0.15}% + \rput[l](0.53,0.07){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\acceptname}}% + }% + \renewcommand{\getoutput@TPATM}[2] + {% + \expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\nstate@TPATM + \expandafter\expandafter\expandafter{\csname delta(##1;##2)@TPATM\endcsname}% + }% + \renewcommand{\inittabrows@TPATM}[1]{##1={\smaller\begin{tabular}{@{}r@{}}}}% + \renewcommand{\addtabrow@TPATM}[2] + {% + \protected@edef\newtabrows@TPATM{\the##1\@hlinput@TPATM\formatsymbol{##2}\noexpand\\}% + \expandafter##1\expandafter{\newtabrows@TPATM}% + }% + \def\formatdfaoutput@TPATM##1##2{\csname delta(##1;##2)@TPATM\endcsname}% + \renewcommand{\label@output@TPATM}{}% + \renewcommand{\fix@nextstate@TPATM} + {% + \global\let\nextstate@TPATM=\nstate@TPATM + }% + \renewcommand{\mk@new@outputtape@TPATM}[1]{}% + }% + +\newcommand{\dfa} +{% + \initializedfa@TPATM + \dfa@TPATM + } + +\newcommand{\dfa@TPATM} +{% + \@ifstar + {\setboolean{stategraph@TPATM}{true}\@dfa@TPATM} + {\setboolean{stategraph@TPATM}{false}\@dfa@TPATM}% + } + +\newcommand{\@dfa@TPATM}[2] +{% + \ifthenelse{\boolean{psspecialsallowed}} + {% + \begingroup + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% + \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}% + \let\next=\@@dfa@TPATM + } + {% + \rule{#1}{#2}% + \let\next=\@@nodfa@TPATM + }% + \next +} + +\newcommand{\@@nodfa@TPATM}[7]{} + +\newcommand{\@@dfa@TPATM}[7]{\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{#6}{#7}{}} + + +% \simulatedfa{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>} +% {<initial state>}{<input tape>}{<number of steps>}{<tape move resolution>} +% simulates a deterministic finite automaton. +% +% The parameters <width>, <height>, <states>, <inputalphabet>, <statetransitions>, <initial state>, and <input tape> +% have the same meaning as for \dfa. +% <number of steps> gives the number of state transitions to perform (in fact, the first state transition occurs after +% the first step, so <number of steps>=1 means no state transition. +% The simulation starts with both tapes at the beginning, in the initial state. After this, the simulation proceeds in +% the following steps: +% 1) Change state. +% 2) Advance input tape and reiterate. +% The steps are realised with TeXPower's \step mechanism. This means the whole simulation will lead to the corresponding +% number of `subpages' each displaying the automaton in changing states. +% If <tape move resolution>=1, then step number 3 will just switch over the tape position. Otherwise, advancing the tape +% will take <tape move resolution> intermediate steps, which are automatically animated using hyperref's pdfpageduration +% mechanism, i.e. when displayed in acroread's full screen mode (with automatic advancing activated), a `smooth' tape +% movement will be seen. +% \simulatedfa comes in normal and starred versions, with the same semantics as for \dfa, i.e. the normal version +% displays a state transition table, the starred version displays a state transition graph. + +\newcommand{\simulatedfa} +{% + \initializedfa@TPATM + \@ifstar + {\setboolean{stategraph@TPATM}{true}\@simulatedfa@TPATM} + {\setboolean{stategraph@TPATM}{false}\@simulatedfa@TPATM}% + } + +\newcommand{\@simulatedfa@TPATM}[2] +{% + \ifthenelse{\boolean{psspecialsallowed}} + {% + \begingroup + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% + \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}% + \let\next=\@@simulatedfa@TPATM + } + {% + \rule{#1}{#2}% + \let\next=\@@nosimulatedfa@TPATM + }% + \next +} + +\newcommand{\@@nosimulatedfa@TPATM}[7]{} + +\newcounter{currentdfastate@TPATM} +\newcounter{currentsupstep@TPATM} +\newcounter{currentsubstep@TPATM} +\newboolean{beginautosim@TPATM} +\newcommand{\autosimduration}{0.04} +\releasecounter{currentdfastate@TPATM}\releasecounter{nextstate@TPATM} + +\newcommand{\@@simulatedfa@TPATM}[7] +{% + % Setup initial state. + \setcounter{currentsupstep@TPATM}{0}% + \setcounter{currentdfastate@TPATM}{#4}% + \setcounter{nextstate@TPATM}{0}% + \stepwise[\setcounter{currentdfastate@TPATM}{#4}\setcounter{nextstate@TPATM}{0}] + {% + \setboolean{beginautosim@TPATM}{true}% + % Main loop for state transitions. + \whiledo{\value{currentsupstep@TPATM}<#6} + {% + % At the beginning, the situation right before the state transition is displayed. This is effected by only + % displaying the last step of the tape movement. + \ifthenelse{\boolean{beginautosim@TPATM}} + {\setboolean{beginautosim@TPATM}{false}\setcounter{currentsubstep@TPATM}{#7-1}} + {\setcounter{currentsubstep@TPATM}{0}}% + % Inner loop for tape movement. + \whiledo{\value{currentsubstep@TPATM}<#7} + {% + \stepcounter{currentsubstep@TPATM}% + % Display sequence of steps while the tape gradually moves. + \mkfactor{\tapeposition@TPATM}{\value{currentsupstep@TPATM}+\arabic{currentsubstep@TPATM}pt/#7}% + \ifthenelse{\value{currentsubstep@TPATM}=#7} + {% + \setcounter{tmpcnta@TP}{\value{currentsupstep@TPATM}+1}% + \ifthenelse{\value{tmpcnta@TP}=#6}{\switch}{\switch[][\boolean{firstactivation}]}{} + {% + \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{}% + \afterstep{\stopAdvancing}% + \setcounter{currentdfastate@TPATM}{\value{nextstate@TPATM}}\setcounter{nextstate@TPATM}{-1}% + }% + } + {% + \switch[][\boolean{firstactivation}]{} + {% + \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{}% + \afterstep{\pageDuration{\autosimduration}}% + }% + }% + }% + \stepcounter{currentsupstep@TPATM}% + % After the tape is in the next (or initial) position, switch state and reiterate. + \ifthenelse{\value{currentsupstep@TPATM}=#6}{} + {% + \switch[][\boolean{firstactivation}]{}% + {% + \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{}% + }% + }% + }% + }% +\endgroup +} + + +%----------------------------------------------------------------------------------------------------------------------- +% Finite Automata with output. + +% \mealyautomaton{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>} +% {<initial state>}{<input tape>}{<tape position>}{<current state>}{<output tape>} +% draws a mealy automaton (deterministic finite automaton with output tape, output is triggered by state transitions). +% +% The parameters have the same meanings as for \dfa, with one addition: +% <output tape> Comma-separated list (symbolically) specifying the contents of the output tape. +% +% The standard version of \mealyautomaton displays a state transition table, i.e. for every combination of state and +% input symbol, the successor state and output symbol are displayed in a tabular. The current state, current input +% symbol and next input symbol (if <tape position> is not integer) are indicated by colored bars. +% +% There is a starred version \mealyautomaton* which displays a state transition graph where states are displayed as +% circles and state transitions as arrows between circles. The `active' transition (leading from the current to the next +% state) is highlighted. +% +% The <states> parameter has the same structure as for \dfa. +% +% The <statetransitions> parameter looks like <trans1>,<trans2>,...,<transm>, where every single <trans> has the +% following form: +% [<opt>]<state>;<input>-><state'>;<output> +% where [<opt>] is optional. <state> and <input> are the arguments of the state transition function, and <state'> and +% <output> are the successor state and output symbol, respectively. +% The optional parameter [<opt>] is used only in the starred version \mealyautomaton*. If given, it specifies additional +% optional parameters for the node connection command (\nccircle or \ncarc) drawing the arrow for this +% transition. \ncline is used for transitions from a state to itself. For transitions between states, \ncarc is used +% whenever the optional argument is given, otherwise \ncline is used. This is a seldom instance where giving an empty +% optional argument is different from giving no optional argument at all: Giving the optional argument [] switches +% between \ncline and \ncarc (useful if two transitions go `back and forth' between two states). +% + +\newcommand{\initializema@TPATM} +{% + \renewcommand{\draw@outputtape@TPATM}[1] + {% + \rput[l](0.07,0.07){\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\outputtapename}}% + \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM}{1pt}}% + \setcounter{tapecells@TPATM}{6+\value{currinputsymbol@TPATM}}% + \multips(\startx@TPATM,0.02)(0.1,0){\value{tapecells@TPATM}}{\psframe[fillstyle=solid,fillcolor=cellcolor](0.1,0.1)}% + \mkfactor{\startx@TPATM}{\ratio{\tapepos@TPATM+0.05pt}{1pt}}% + \filltofive@TPATM{\startx@TPATM}% + \protected@edef\tapecontents@TPATM{##1,}% + \setcounter{currtapepos@TPATM}{0}% + \multido{\n=\startx@TPATM+0.10000}{\value{tapecells@TPATM}} + {% + \ifx\tapecontents@TPATM\empty + \else + \stepcounter{currtapepos@TPATM}% + \getsymbol@TPATM\tapecontents@TPATM\outputtapesymbol@TPATM + \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}\relax + \global\let\outputtapesymbol@TPATM\outputtapesymbol@TPATM + \fi + \rput(\n,0.07){\formatsymbol\outputtapesymbol@TPATM}% + \fi + }% + \psframe[linewidth=2pt,linecolor=mathcolor](0.45,0.02)(0.55,0.12) + }% + \renewcommand{\getoutput@TPATM}[2] + {\expandafter\expandafter\expandafter\@getoutput@TPATM\csname delta(##1;##2)@TPATM\endcsname\@nil}% + \def\@getoutput@TPATM##1;##2\@nil{\def\nstate@TPATM{##1}\def\output@TPATM{##2}}% + \renewcommand{\inittabrows@TPATM}[1]{##1={\smaller\begin{tabular}{rcl}}}% + \renewcommand{\addtabrow@TPATM}[2] + {% + \protected@edef\newtabrows@TPATM + {% + \the##1% + \@hlinput@TPATM\formatsymbol{##2}&\origmath{\vartriangleright}&\noexpand\formatsymbol{\output@TPATM}\noexpand\\% + }% + \expandafter##1\expandafter{\newtabrows@TPATM}% + }% + \def\formatdfaoutput@TPATM##1##2% + {\expandafter\expandafter\expandafter\@formatdfaoutput@TPATM\csname delta(##1;##2)@TPATM\endcsname\@nil}% + \def\@formatdfaoutput@TPATM##1;##2\@nil{##1;\formatsymbol{##2}}% + \renewcommand{\label@output@TPATM} + {% + \raisebox{.5\tabcolsep} + {\rotatebox{90}{\psframebox[linestyle=none,fillstyle=solid,fillcolor=autoplatecolor]{\smaller \outputname}}}% + }% + \renewcommand{\fix@nextstate@TPATM} + {% + \global\let\newoutputsymbol@TPATM=\output@TPATM + \global\let\nextstate@TPATM=\nstate@TPATM + }% + \renewcommand{\mk@new@outputtape@TPATM}[1]% + {% + \setcounter{currtapepos@TPATM}{0}% + \protected@edef\tapecontents@TPATM{##1,}% + \let\newoutputtape@TPATM=\empty + \whiledo{\not\equal{\tapecontents@TPATM}{}} + {% + \stepcounter{currtapepos@TPATM}% + \getsymbol@TPATM\tapecontents@TPATM\outputsymbol@TPATM + \ifnum\value{currtapepos@TPATM}=\value{currinputsymbol@TPATM}% + \let\outputsymbol@TPATM=\newoutputsymbol@TPATM% + \fi + \protected@edef\newoutputtape@TPATM{\newoutputtape@TPATM\outputsymbol@TPATM,}% + }% + \expandafter\gobblelastcomma@TPATM\newoutputtape@TPATM\@nil\newoutputtape@TPATM + }% + } + +\newcommand{\mealyautomaton} +{% + \initializema@TPATM + \mealyautomaton@TPATM + } + +\newcommand{\mealyautomaton@TPATM} +{% + \@ifstar + {\setboolean{stategraph@TPATM}{true}\@mealyautomaton@TPATM} + {\setboolean{stategraph@TPATM}{false}\@mealyautomaton@TPATM}% + } + +\newcommand{\@mealyautomaton@TPATM}[2] +{% + \ifthenelse{\boolean{psspecialsallowed}} + {% + \begingroup + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% + \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}% + \let\next=\@@genericdfa@TPATM + } + {% + \rule{#1}{#2}% + \let\next=\@@nomealyautomaton@TPATM + }% + \next +} + +\newcommand{\@@nomealyautomaton@TPATM}[8]{} + + +% \simulatema{<width>}{<height>}{<states>}{<inputalphabet>}{<statetransitions>} +% {<initial state>}{<input tape>}{<number of steps>}{<tape move resolution>}{<output tape>} +% simulates a mealy automaton (deterministic finite automaton with output tape, output is triggered by state +% transitions). +% +% The parameters <width>, <height>, <states>, <inputalphabet>, <statetransitions>, <initial state>, <input tape>, +% <output tape> have the same meaning as for \mealyautomaton. +% The parameters <number of steps> and <tape move resolution> have the same meaning as for \simulatedfa. +% The simulation starts with both tapes at the beginning, in the initial state and with the output tape in the state +% given by <output tape>. After this, the simulation proceeds in the following steps: +% 1) Write output symbol of the `active' transition to the output tape. +% 2) Change state. +% 3) Advance both tapes and reiterate. +% \simulatema comes in normal and starred versions, with the same semantics as for \mealyautomaton, i.e. the normal +% version displays a state transition table, the starred version displays a state transition graph. + +\newcommand{\simulatema} +{% + \initializema@TPATM + \@ifstar + {\setboolean{stategraph@TPATM}{true}\@simulatema@TPATM} + {\setboolean{stategraph@TPATM}{false}\@simulatema@TPATM}% + } + +\newcommand{\@simulatema@TPATM}[2] +{% + \ifthenelse{\boolean{psspecialsallowed}} + {% + \begingroup + \setlength{\@tempdima}{#1}% + \setlength{\@tempdimb}{#2}% + \psset{xunit=\@tempdima,yunit=\@tempdimb,arrowinset=0}% + \let\next=\@@simulatema@TPATM + } + {% + \rule{#1}{#2}% + \let\next=\@@nosimulatema@TPATM + }% + \next +} + +\newcommand{\@@nosimulatema@TPATM}[8]{} + +\newcommand{\@@simulatema@TPATM}[8] +{% + % Setup initial state. + \setcounter{currentsupstep@TPATM}{0}% + \setcounter{currentdfastate@TPATM}{#4}\gdef\currentoutputtape@TPATM{#8}% + \stepwise[\setcounter{currentdfastate@TPATM}{#4}\gdef\currentoutputtape@TPATM{#8}] + {% + \setboolean{beginautosim@TPATM}{true}% + % Main loop for state transitions. + \whiledo{\value{currentsupstep@TPATM}<#6} + {% + % At the beginning, the situation right before the state transition is displayed. This is effected by only + % displaying the last step of the tape movement. + \ifthenelse{\boolean{beginautosim@TPATM}} + {\setboolean{beginautosim@TPATM}{false}\setcounter{currentsubstep@TPATM}{#7-1}} + {\setcounter{currentsubstep@TPATM}{0}}% + % Inner loop for tape movement. + \whiledo{\value{currentsubstep@TPATM}<#7} + {% + \stepcounter{currentsubstep@TPATM}% + % Display sequence of steps while the tape gradually moves. + \mkfactor{\tapeposition@TPATM}{\value{currentsupstep@TPATM}+\arabic{currentsubstep@TPATM}pt/#7}% + \switch[][\boolean{firstactivation}]{} + {% + \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{\currentoutputtape@TPATM}% + \ifthenelse{\value{currentsubstep@TPATM}=#7} + {\afterstep{\stopAdvancing}\global\let\currentoutputtape@TPATM\newoutputtape@TPATM}% + {\afterstep{\pageDuration{\autosimduration}}}% + }% + }% + \stepcounter{currentsupstep@TPATM}% + % After the tape is in the next (or initial) position, display new output symbol. + \switch[][\boolean{firstactivation}]{} + {% + \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{\currentoutputtape@TPATM}% + \setcounter{currentdfastate@TPATM}{\value{nextstate@TPATM}}\setcounter{nextstate@TPATM}{-1}% + }% + % Next, switch state and reiterate. + \ifthenelse{\value{currentsupstep@TPATM}=#6}{\switch}{\switch[][\boolean{firstactivation}]}{}% + {% + \begingroup\genericdfa@TPATM{#1}{#2}{#3}{#4}{#5}{\tapeposition@TPATM}{\value{currentdfastate@TPATM}}{\currentoutputtape@TPATM}% + }% + }% + }% +\endgroup +} + +\endinput +%% +%% End of file `automata.sty'. diff --git a/Master/texmf-dist/tex/latex/texpower/fixseminar.sty b/Master/texmf-dist/tex/latex/texpower/fixseminar.sty new file mode 100644 index 00000000000..3bf8b99c50e --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/fixseminar.sty @@ -0,0 +1,168 @@ +%% +%% This is file `fixseminar.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-addons.dtx (with options: `fixseminar') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +%======================================================================================================================= +% File: fixseminar.sty +% +% Fix some problems in conjunction with seminar. +% +% This package is part of the TeXPower bundle, to be found at +% +% http://texpower.sourceforge.net/ +% +% If using hyperref, load this package _after_ hyperref. +% +%======================================================================================================================= +% Author: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de> +% +% v0.0.1 Mar 28, 2000 First version for the pre-alpha release of texpower and hyperref v6.70a. +% +% v0.0.1a May 18, 2000 Added a \vss to a \vbox to get rid of an `overfull vbox' message. +% +% v0.0.2 Jun 02, 2000 Now handle seminar as well as powersem. +% +% v0.0.3 Sep 07, 2000 hyperref v6.70u and later don't have the \@hyperfixhead bug any more. +% +% v0.0.4 Nov 22, 2002 Now using ifpdf package if available. +% As hyperref v6.70u exists for some time now, the \@hyperfixhead hack is removed. +% Fixed a problem with \twoup (bug found and fix proposed by Laurent Mugnier). +% Added a preliminary fix for rotating slides with pdftex. +% +% v0.0.5 May 26, 2003 A small change to make fixseminar work better when hyperref is not loaded. + + +\NeedsTeXFormat{LaTeX2e} + +\ProvidesPackage% +{fixseminar}% +[2003/05/26 v0.0.5 Fix some problems of seminar.] + + +%======================================================================================================================= + +\RequirePackage{ifthen} + + +%======================================================================================================================= +% Options and general setup. + +\ProcessOptions + + +% The switch \ifpdf is to determine whether pdfLaTeX is being run and outputting pdf, using Heiko Oberdiek's faultproof +% pdf detector: + +\IfFileExists{ifpdf.sty} +{% + \RequirePackage{ifpdf}% + } +{% + \@ifundefined{pdftrue} + {% + \expandafter\newif\csname ifpdf\endcsname + \ifx\pdfoutput\undefined + \else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi + \fi + }{}% + } + + +%======================================================================================================================= +% Here come the fixes. + +% We need to make sure that magnification, as used by seminar, is respected when setting \pdfpageheight and +% \pdfpagewidth. We strip the pt and add truept which respects magnification. + + +\ifthenelse{\boolean{pdf}}% Are we outputting PDF? +{% Yes. + \@ifclassloaded{seminar}% seminar document class? + {% + \RequirePackage{graphics}% + \def\leftsliderotation#1{\rotatebox{90}{#1}}% + \def\rightsliderotation#1{\rotatebox{270}{#1}}% + \sliderotation{left}% + }{}% + \AtBeginDocument% Then we need to set \pdfpagewidth and \pdfpageheight in a _true_ unit to make sure + {% the pdf page has the right dimensions even when magnifying (as seminar does). + \setlength{\pdfhorigin}{1truein}% \pdfhorigin and \pdfvorigin also need to be set to true dimensions. + \setlength{\pdfvorigin}{1truein}% + \@ifclassloaded{seminar}% seminar document class? + {% + \ifportrait% Portrait slides? + \setlength{\pdfpageheight}{\strip@pt\paperheight truept}% + \setlength{\pdfpagewidth}{\strip@pt\paperwidth truept}% + \else% Landscape. Need to exchange height and width. + \renewcommand{\printlandscape} + {% + \setlength{\pdfpagewidth}{\strip@pt\paperheight truept}% + \setlength{\pdfpageheight}{\strip@pt\paperwidth truept}% + }% + \fi + }% + {% + \setlength{\pdfpageheight}{\strip@pt\paperheight truept}% + \setlength{\pdfpagewidth}{\strip@pt\paperwidth truept}% + }% + }% +} +{% No. In this case we define \special@paper which will put an appropriate \special into the dvi file. + \@ifclassloaded{seminar} + {% + \ifportrait + \edef\special@paper{\the\paperwidth,\the\paperheight}% + \else% Need to exchange height and width. + \renewcommand{\printlandscape}{\edef\special@paper{\the\paperheight,\the\paperwidth}} + \fi + \AtBeginDocument{\special{papersize=\special@paper}}% + }% + {% + }% + }% + + +% There is a bug in old hyperref versions to the effect that apparently, when using seminar there is a glitch in +% vertical spacing. Issue a warning if hyperref is too old. + +\@ifpackageloaded{hyperref}% Looking for \@hyperfixhead bug. +{% + \@ifpackagelater{hyperref}{2000/09/07}% Is the \@hyperfixhead bug present in hyperref? + {}% No. + {% Yes. Issue a warning. + \PackageWarning{fixseminar} + {Package hyperref too old (older than 6.70u).\MessageBreak Expect problems with seminar}% + }% + }{} +\endinput +%% +%% End of file `fixseminar.sty'. diff --git a/Master/texmf-dist/tex/latex/texpower/powersem.cls b/Master/texmf-dist/tex/latex/texpower/powersem.cls new file mode 100644 index 00000000000..fb6eff35232 --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/powersem.cls @@ -0,0 +1,234 @@ +%% +%% This is file `powersem.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% powersem.dtx (with options: `powersem') +%% +%% -------------------------------------------------------------- +%% 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} +\ProvidesClass{powersem} + [2004/07/27 v0.8a Create online Presentations with seminar.] +\RequirePackage{ifthen} +\newboolean{display} +\DeclareOption{display} +{\setboolean{display}{true}\PassOptionsToClass{slidesonly}{seminar}} +\newboolean{truepn@PS} +\DeclareOption{truepagenumbers}{\setboolean{truepn@PS}{true}} +\newboolean{BaseClass@PS} +\DeclareOption{KOMA} +{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{scrartcl}} +\DeclareOption{UseBaseClass} +{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{article}} +\DeclareOption{reportclass} +{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{report}} +\DeclareOption{bookclass} +{\setboolean{BaseClass@PS}{true}\providecommand{\baseclass}{book}} +\DeclareOption{a4paper}{\PassOptionsToClass{a4}{seminar}} +\newboolean{calcdim@PS} +\DeclareOption{calcdimensions}{\setboolean{calcdim@PS}{true}} +\DeclareOption*{\PassOptionsToClass{\CurrentOption}{seminar}} + +\ProcessOptions +\let\oldLC@PS=\LoadClass + +\ifthenelse{\boolean{BaseClass@PS}} +{% + \def\article@PS{article} + \let\oldPOTC@PS=\PassOptionsToClass + \def\PassOptionsToClass#1#2% + {\edef\cls@PS{#2}% + \ifx\article@PS\cls@PS\oldPOTC@PS{#1}{\baseclass}% + \else\oldPOTC@PS{#1}{#2}% + \fi} + \renewcommand{\LoadClass}[2][]% + {% + \edef\cls@PS{#2}% + \ifx\article@PS\cls@PS + \let\paperheight\sem@paperheight\let\paperwidth\sem@paperwidth + \oldLC@PS[#1]{\baseclass}% + \ifarticle\else\portraittrue\fi + \else + \oldLC@PS[#1]{#2}% + \fi + }% +} +{} +\oldLC@PS{seminar} + +\AtBeginDocument +{% +\input{seminar.bug}% +\input{seminar.bg2}% +} + +\expandafter\def\expandafter\set@slidesize\expandafter +{\set@slidesize\@colht\vsize} + +\g@addto@macro\@arrayparboxrestore\slide@rightskip + +\ifthenelse{\boolean{truepn@PS}}{\truepagenumbers}{} + +\AtBeginDocument{% +\ifthenelse{\boolean{BaseClass@PS}}{\sliderotation{none}}{}} +\AtBeginDocument{% +\ifarticle +\else + \def\output@slide{% + \begingroup + \hoffset=-\inverseslidesmag in + \voffset=-\inverseslidesmag in + \setslidelength\@tempdima{% + \ifportrait\paperwidth\else\paperheight\fi}% + \setslidelength\@tempdimb{% + \ifportrait\paperheight\else\paperwidth\fi}% + \ifrotateheaders + \@ifrotateslide{% + \dimen@=\@tempdima + \@tempdima=\@tempdimb + \@tempdimb=\dimen@}% + \fi + % \oddsidemargin, \evensidemargin, \headheight, \footheight + % used for scratch: + \setslidelength\headheight\slidetopmargin + \setslidelength\footheight\slidebottommargin + \ifautoslidemargins + \textwidth=\wd\@slidebox + \oddsidemargin=\@tempdima + \advance\oddsidemargin-\textwidth + \divide\oddsidemargin 2 + \else + \setslidelength\oddsidemargin\slideleftmargin + \setslidelength\evensidemargin\sliderightmargin + \textwidth=\@tempdima + \advance\textwidth-\oddsidemargin + \advance\textwidth-\evensidemargin + \fi + \setbox\@slidebox=\hbox to \@tempdima{{% + % + \kern\oddsidemargin + \vbox to\@tempdimb{{% + \ifnum\fancyput@flag>-1 + \hbox{\kern-\oddsidemargin\do@fancyput}% + \fi + \let\label\@gobble + \let\index\@gobble + \let\glossary\@gobble + \vbox to\headheight{{% + \vfill + \color@hbox + \normalcolor + \slideheadfont\relax%\strut Removed (STL) + \hb@xt@\textwidth{\@oddhead}% + \color@endbox + \kern\z@}}% + \nointerlineskip + \vss + \hbox to\textwidth{{\hss\box\@slidebox\hss}}% + \vss + \nointerlineskip + \vbox to\footheight{{% + \vfill + \color@hbox + \normalcolor + \slidefootfont\relax%\strut Removed (STL) + \hb@xt@\textwidth{\@oddfoot}% + \color@endbox + \vfill}}% + }}\hss}}% + \ifrotateheaders\@ifrotateslide\rotate@slide\fi + \insert@specials + \shipout\box\@slidebox + \endgroup + \let\firstmark\botmark + \ifthenelse{\boolean{truepn@PS}}{\stepcounter{page}}{}% + }% + \@ifundefined{fancyput@flag}{\def\fancyput@flag{-1}}{}% +\fi +} +\ifthenelse{\boolean{display}} +{% + \centerslidesfalse + \extraslideheight{0pt}% + \renewcommand{\slideshrink}{0}% + \def\@makeslide{% + \ifcenterslides + \setbox\@slidebox\vbox{{% + \@begindvi % added 1997/04/15 SPQR + \unvbox\@cclv + \ifvoid\slide@footins\else + \vskip\skip\slide@footins + \footnoterule + \unvbox\slide@footins + \fi + \vskip\z@}} + \else + \setbox\@slidebox\vbox to \slide@vsize{{% + \@begindvi % added 1997/04/15 SPQR + \unvbox\@cclv + \ifvoid\slide@footins\vfil\else + \vfil\vskip\skip\slide@footins + \footnoterule + \unvbox\slide@footins + \fi + \vskip\z@}}% + \fi + }% + } +{} +\def\relax@PS{\relax} + +\ifthenelse{\boolean{calcdim@PS}} +{% + \AtBeginDocument + {% + \setlength{\slidewidth}{\paperwidth}% + \advance\slidewidth by -\slideleftmargin\relax + \advance\slidewidth by -\sliderightmargin\relax + \ifx\theslideframe\relax@PS + \else + \advance\slidewidth by -2\slideframewidth\relax + \advance\slidewidth by -2\slideframesep\relax + \fi + \setlength{\slideheight}{\paperheight}% + \advance\slideheight by -\slidetopmargin\relax + \advance\slideheight by -\slidebottommargin\relax + \ifx\theslideframe\relax@PS + \else + \advance\slideheight by -2\slideframewidth\relax + \advance\slideheight by -2\slideframesep\relax + \fi + }% + } +{} + +\AtBeginDocument +{% + \@ifundefined{headwidth}{} + {% + \setslidelength{\headwidth}{\paperwidth}% + \addtoslidelength{\headwidth}{-\slideleftmargin}% + \addtoslidelength{\headwidth}{-\sliderightmargin}% + }% +} +\endinput +%% +%% End of file `powersem.cls'. 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'. diff --git a/Master/texmf-dist/tex/latex/texpower/tpcolors.cfg b/Master/texmf-dist/tex/latex/texpower/tpcolors.cfg new file mode 100644 index 00000000000..cd28d055d03 --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/tpcolors.cfg @@ -0,0 +1,383 @@ +%% +%% This is file `tpcolors.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-cfg.dtx (with options: `tpcolors') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +%======================================================================================================================= +% File: tpcolors.cfg +% +% Color configuration for the texpower package. +% +%======================================================================================================================= + +%======================================================================================================================= +% Standard colors. +% +% For every of the colors described in the "Defined colors for emphasis and highlighting elements" section of the +% documentation, there is one default value which is defined here. Further default colors are for background, panel and +% navigation elements. +% +% Note that this file is loaded _only_ if TeXPower's color management is active. +% +% Redefine colors for individual taste. Please remember, however, that a document transferred into another configuration +% where a different tpcolors.cfg is present, will look different on compilation. So for a `stable' color configuration, +% it might be better to put the respective \defineTPcolor commands into the preamble of the document or into a style +% file. + +% Color definitions for white background. + +\defineTPcolor[whitebg]{pagecolor}{rgb}{1,1,1}% Page background (for background style `plain'). + +\defineTPcolor[whitebg]{bgndstartcolor}{rgb}{1,1,0.9}% Start color for gradient background. +\defineTPcolor[whitebg]{bgndendcolor}{rgb}{1,1,1}% End color for gradient background. +\defineTPcolor[whitebg]{bgndmidcolor}{rgb}{0.9,1,0.9}% Middle color for gradient background (`double' gradient). + +\defineTPcolor[whitebg]{textcolor}{rgb}{0,0,0.5}% Normal text. + +\defineTPcolor[whitebg]{emcolor}{rgb}{0,0,0.8}% Emphasised text (if coloremph option is given). +\defineTPcolor[whitebg]{altemcolor}{rgb}{0,0.5,0.8}% Double emphasised text (if coloremph option is given). + +\defineTPcolor[whitebg]{mathcolor}{rgb}{0,0.5,0}% Math (if colormath option is given). + +\defineTPcolor[whitebg]{codecolor}{rgb}{0,0.5,0}% \code (additional emphasising command). +\defineTPcolor[whitebg]{underlcolor}{rgb}{0.7,0,0.3}% \underl (additional emphasising command). +\defineTPcolor[whitebg]{conceptcolor}{rgb}{0.6,0,0}% \concept (additional emphasising command). +\defineTPcolor[whitebg]{inactivecolor}{rgb}{0.7,0.7,0.7}% \inactive (additional emphasising command). +\defineTPcolor[whitebg]{presentcolor}{rgb}{1,1,0.8}% Background color for \present (emphasising command). +\defineTPcolor[whitebg]{highlightcolor}{rgb}{1,1,0.7}% Background color for \highlight (emphasising command). + +\defineTPcolor[whitebg]{buttoncolor}{rgb}{0.8,0.8,0.9}% Background color for buttons. +\defineTPcolor[whitebg]{buttonshadowcolor}{rgb}{.001,0,.502}% Button shadow. +\defineTPcolor[whitebg]{buttonframecolor}{gray}{0}% Button frame. +\defineTPcolor[whitebg]{buttontextcolor}{gray}{0}% Button text. + +\defineTPcolor[whitebg]{toppanelcolor}{gray}{0.9}% Top panel background. +\defineTPcolor[whitebg]{bottompanelcolor}{gray}{0.9}% Bottom panel background. +\defineTPcolor[whitebg]{leftpanelcolor}{gray}{0.9}% Left panel background. +\defineTPcolor[whitebg]{rightpanelcolor}{gray}{0.9}% Right panel background. +\defineTPcolor[whitebg]{toppaneltextcolor}{gray}{0}% Top panel text. +\defineTPcolor[whitebg]{bottompaneltextcolor}{gray}{0}% Bottom panel text. +\defineTPcolor[whitebg]{leftpaneltextcolor}{gray}{0}% Left panel text. +\defineTPcolor[whitebg]{rightpaneltextcolor}{gray}{0}% Right panel text. + + +% Color definitions for `light' background. + +\defineTPcolor[lightbg]{pagecolor}{rgb}{1,1,0.9}% Page background (for background style `plain'). + +\defineTPcolor[lightbg]{bgndstartcolor}{rgb}{1,1,0.8}% Start color for gradient background. +\defineTPcolor[lightbg]{bgndendcolor}{rgb}{1,1,1}% End color for gradient background. +\defineTPcolor[lightbg]{bgndmidcolor}{rgb}{0.8,1,0.8}% Middle color for gradient background (`double' gradient). + +\defineTPcolor[lightbg]{textcolor}{rgb}{0,0,0.5}% Normal text. + +\defineTPcolor[lightbg]{emcolor}{rgb}{0,0,0.8}% Emphasised text (if coloremph option is given). +\defineTPcolor[lightbg]{altemcolor}{rgb}{0,0.5,0.8}% Double emphasised text (if coloremph option is given). + +\defineTPcolor[lightbg]{mathcolor}{rgb}{0,0.4,0}% Math (if colormath option is given). + +\defineTPcolor[lightbg]{codecolor}{rgb}{0,0.5,0}% \code (additional emphasising command). +\defineTPcolor[lightbg]{underlcolor}{rgb}{0.7,0,0.3}% \underl (additional emphasising command). +\defineTPcolor[lightbg]{conceptcolor}{rgb}{0.6,0,0}% \concept (additional emphasising command). +\defineTPcolor[lightbg]{inactivecolor}{rgb}{0.7,0.7,0.7}% \inactive (additional emphasising command). +\defineTPcolor[lightbg]{presentcolor}{rgb}{1,1,1}% Background color for \present (emphasising command). +\defineTPcolor[lightbg]{highlightcolor}{rgb}{1,1,0.6}% Background color for \highlight (emphasising command). + +\defineTPcolor[lightbg]{buttoncolor}{rgb}{0.8,0.8,0.9}% Background color for buttons. +\defineTPcolor[lightbg]{buttonshadowcolor}{rgb}{.001,0,.502}% Button shadow. +\defineTPcolor[lightbg]{buttonframecolor}{gray}{0}% Button frame. +\defineTPcolor[lightbg]{buttontextcolor}{gray}{0}% Button text. + +\defineTPcolor[lightbg]{toppanelcolor}{gray}{0.9}% Top panel background. +\defineTPcolor[lightbg]{bottompanelcolor}{gray}{0.9}% Bottom panel background. +\defineTPcolor[lightbg]{leftpanelcolor}{gray}{0.9}% Left panel background. +\defineTPcolor[lightbg]{rightpanelcolor}{gray}{0.9}% Right panel background. +\defineTPcolor[lightbg]{toppaneltextcolor}{gray}{0}% Top panel text. +\defineTPcolor[lightbg]{bottompaneltextcolor}{gray}{0}% Bottom panel text. +\defineTPcolor[lightbg]{leftpaneltextcolor}{gray}{0}% Left panel text. +\defineTPcolor[lightbg]{rightpaneltextcolor}{gray}{0}% Right panel text. + + +% Color definitions for `dark' background. + +\defineTPcolor[darkbg]{pagecolor}{rgb}{0,0,0.4}% Page background (for background style `plain'). + +\defineTPcolor[darkbg]{bgndstartcolor}{rgb}{0,0,0.2}% Start color for gradient background. +\defineTPcolor[darkbg]{bgndendcolor}{rgb}{0,0,0.6}% End color for gradient background. +\defineTPcolor[darkbg]{bgndmidcolor}{rgb}{0,0.3,0.4}% Middle color for gradient background (`double' gradient). + +\defineTPcolor[darkbg]{textcolor}{rgb}{1,1,0.6}% Normal text. + +\defineTPcolor[darkbg]{emcolor}{rgb}{1,1,0}% Emphasised text (if coloremph option is given). +\defineTPcolor[darkbg]{altemcolor}{rgb}{1,0.6,0}% Double emphasised text (if coloremph option is given). + +\defineTPcolor[darkbg]{mathcolor}{rgb}{1,0.5,1}% Math (if colormath option is given). + +\defineTPcolor[darkbg]{codecolor}{rgb}{0,0.7,0}% \code (additional emphasising command). +\defineTPcolor[darkbg]{underlcolor}{rgb}{0.3,1,0.7}% \underl (additional emphasising command). +\defineTPcolor[darkbg]{conceptcolor}{rgb}{0.4,1,1}% \concept (additional emphasising command). +\defineTPcolor[darkbg]{inactivecolor}{rgb}{0.4,0.4,0.4}% \inactive (additional emphasising command). +\defineTPcolor[darkbg]{presentcolor}{rgb}{0,0,0}% Background color for \present (emphasising command). +\defineTPcolor[darkbg]{highlightcolor}{rgb}{0,0,0.1}% Background color for \highlight (emphasising command). + +\defineTPcolor[darkbg]{buttoncolor}{rgb}{0.4,0.4,0.6}% Background color for buttons. +\defineTPcolor[darkbg]{buttonshadowcolor}{gray}{0}% Button shadow. +\defineTPcolor[darkbg]{buttonframecolor}{gray}{0}% Button frame. +\defineTPcolor[darkbg]{buttontextcolor}{gray}{0}% Button text. + +\defineTPcolor[darkbg]{toppanelcolor}{gray}{0.4}% Top panel background. +\defineTPcolor[darkbg]{bottompanelcolor}{gray}{0.4}% Bottom panel background. +\defineTPcolor[darkbg]{leftpanelcolor}{gray}{0.4}% Left panel background. +\defineTPcolor[darkbg]{rightpanelcolor}{gray}{0.4}% Right panel background. +\defineTPcolor[darkbg]{toppaneltextcolor}{gray}{1}% Top panel text. +\defineTPcolor[darkbg]{bottompaneltextcolor}{gray}{1}% Bottom panel text. +\defineTPcolor[darkbg]{leftpaneltextcolor}{gray}{1}% Left panel text. +\defineTPcolor[darkbg]{rightpaneltextcolor}{gray}{1}% Right panel text. + + +% Color definitions for black background. + +\defineTPcolor[blackbg]{pagecolor}{rgb}{0,0,0}% Page background (for background style `plain'). + +\defineTPcolor[blackbg]{bgndstartcolor}{rgb}{0,0,0}% Start color for gradient background. +\defineTPcolor[blackbg]{bgndendcolor}{rgb}{0,0,0.2}% End color for gradient background. +\defineTPcolor[blackbg]{bgndmidcolor}{rgb}{0,0.2,0.2}% Middle color for gradient background (`double' gradient). + +\defineTPcolor[blackbg]{textcolor}{rgb}{1,1,0.6}% Normal text. + +\defineTPcolor[blackbg]{emcolor}{rgb}{1,1,0}% Emphasised text (if coloremph option is given). +\defineTPcolor[blackbg]{altemcolor}{rgb}{1,0.5,0}% Double emphasised text (if coloremph option is given). + +\defineTPcolor[blackbg]{mathcolor}{rgb}{1,0.5,1}% Math (if colormath option is given). + +\defineTPcolor[blackbg]{codecolor}{rgb}{0,0.7,0}% \code (additional emphasising command). +\defineTPcolor[blackbg]{underlcolor}{rgb}{0.3,1,0.7}% \underl (additional emphasising command). +\defineTPcolor[blackbg]{conceptcolor}{rgb}{0.4,1,1}% \concept (additional emphasising command). +\defineTPcolor[blackbg]{inactivecolor}{rgb}{0.4,0.4,0.4}% \inactive (additional emphasising command). +\defineTPcolor[blackbg]{presentcolor}{rgb}{0,0,0.3}% Background color for \present (emphasising command). +\defineTPcolor[blackbg]{highlightcolor}{rgb}{0,0,0.4}% Background color for \highlight (emphasising command). + +\defineTPcolor[blackbg]{buttoncolor}{rgb}{0.4,0.4,0.6}% Background color for buttons. +\defineTPcolor[blackbg]{buttonshadowcolor}{gray}{0}% Button shadow. +\defineTPcolor[blackbg]{buttonframecolor}{gray}{0}% Button frame. +\defineTPcolor[blackbg]{buttontextcolor}{gray}{0}% Button text. + +\defineTPcolor[blackbg]{toppanelcolor}{gray}{0.4}% Top panel background. +\defineTPcolor[blackbg]{bottompanelcolor}{gray}{0.4}% Bottom panel background. +\defineTPcolor[blackbg]{leftpanelcolor}{gray}{0.4}% Left panel background. +\defineTPcolor[blackbg]{rightpanelcolor}{gray}{0.4}% Right panel background. +\defineTPcolor[blackbg]{toppaneltextcolor}{gray}{1}% Top panel text. +\defineTPcolor[blackbg]{bottompaneltextcolor}{gray}{1}% Bottom panel text. +\defineTPcolor[blackbg]{leftpaneltextcolor}{gray}{1}% Left panel text. +\defineTPcolor[blackbg]{rightpaneltextcolor}{gray}{1}% Right panel text. + + +% The default definitions of TeXPower's standard colors do not include dimmed and enhanced variants, leaving the +% variants to be calculated automatically. This works quite well for the dimmed variant, but the automatically +% calculated enhanced variant might not be to everybody's taste. The following example (if uncommented) will define +% custom enhanced versions of all standard `text body' colors in all color sets which look slightly better than the +% automatically calculated ones. Note that background and panels are not affected by dimming and enhancing. + +%% Enhanced color variants for white background. + +% \defineTPcolor[whitebg]{etextcolor}{rgb}{0,0,0.7}% Normal text. + +% \defineTPcolor[whitebg]{eemcolor}{rgb}{0,0,1}% Emphasised text (if coloremph option is given). +% \defineTPcolor[whitebg]{ealtemcolor}{rgb}{0,0.6,0.9}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[whitebg]{emathcolor}{rgb}{0,0.6,0}% Math (if colormath option is given). + +% \defineTPcolor[whitebg]{ecodecolor}{rgb}{0,0.6,0}% \code (additional emphasising command). +% \defineTPcolor[whitebg]{eunderlcolor}{rgb}{0.8,0,0.4}% \underl (additional emphasising command). +% \defineTPcolor[whitebg]{econceptcolor}{rgb}{0.8,0,0}% \concept (additional emphasising command). +% \defineTPcolor[whitebg]{einactivecolor}{rgb}{0.6,0.6,0.6}% \inactive (additional emphasising command). +% \defineTPcolor[whitebg]{epresentcolor}{rgb}{1,1,0.8}% Background color for \present (emphasising command). +% \defineTPcolor[whitebg]{ehighlightcolor}{rgb}{1,1,0.7}% Background color for \highlight (emphasising command). + + +%% Enhanced color variants for `light' background. + +% \defineTPcolor[lightbg]{etextcolor}{rgb}{0,0,0.7}% Normal text. + +% \defineTPcolor[lightbg]{eemcolor}{rgb}{0,0,1}% Emphasised text (if coloremph option is given). +% \defineTPcolor[lightbg]{ealtemcolor}{rgb}{0,0.6,0.9}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[lightbg]{emathcolor}{rgb}{0,0.6,0}% Math (if colormath option is given). + +% \defineTPcolor[lightbg]{ecodecolor}{rgb}{0,0.65,0}% \code (additional emphasising command). +% \defineTPcolor[lightbg]{eunderlcolor}{rgb}{0.8,0,0.4}% \underl (additional emphasising command). +% \defineTPcolor[lightbg]{econceptcolor}{rgb}{0.8,0,0}% \concept (additional emphasising command). +% \defineTPcolor[lightbg]{einactivecolor}{rgb}{0.6,0.6,0.6}% \inactive (additional emphasising command). +% \defineTPcolor[lightbg]{epresentcolor}{rgb}{.95,1,.95}% Background color for \present (emphasising command). +% \defineTPcolor[lightbg]{ehighlightcolor}{rgb}{1,1,0.4}% Background color for \highlight (emphasising command). + + +%% Enhanced color variants for `dark' background. + +% \defineTPcolor[darkbg]{etextcolor}{rgb}{1,1,0.8}% Normal text. + +% \defineTPcolor[darkbg]{eemcolor}{rgb}{1,1,0.3}% Emphasised text (if coloremph option is given). +% \defineTPcolor[darkbg]{ealtemcolor}{rgb}{1,0.8,0}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[darkbg]{emathcolor}{rgb}{1,0.6,1}% Math (if colormath option is given). + +% \defineTPcolor[darkbg]{ecodecolor}{rgb}{0,0.9,0}% \code (additional emphasising command). +% \defineTPcolor[darkbg]{eunderlcolor}{rgb}{0.4,1,0.8}% \underl (additional emphasising command). +% \defineTPcolor[darkbg]{econceptcolor}{rgb}{0.7,1,1}% \concept (additional emphasising command). +% \defineTPcolor[darkbg]{einactivecolor}{rgb}{0.5,0.5,0.5}% \inactive (additional emphasising command). +% \defineTPcolor[darkbg]{epresentcolor}{rgb}{0.1,0,0}% Background color for \present (emphasising command). +% \defineTPcolor[darkbg]{ehighlightcolor}{rgb}{0,0,0}% Background color for \highlight (emphasising command). + + +%% Enhanced color variants for black background. + +% \defineTPcolor[blackbg]{etextcolor}{rgb}{1,1,0.8}% Normal text. + +% \defineTPcolor[blackbg]{eemcolor}{rgb}{1,1,0.3}% Emphasised text (if coloremph option is given). +% \defineTPcolor[blackbg]{ealtemcolor}{rgb}{1,0.4,0}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[blackbg]{emathcolor}{rgb}{1,0.6,1}% Math (if colormath option is given). + +% \defineTPcolor[blackbg]{ecodecolor}{rgb}{0,0.9,0}% \code (additional emphasising command). +% \defineTPcolor[blackbg]{eunderlcolor}{rgb}{0.4,1,0.8}% \underl (additional emphasising command). +% \defineTPcolor[blackbg]{econceptcolor}{rgb}{0.7,1,1}% \concept (additional emphasising command). +% \defineTPcolor[blackbg]{einactivecolor}{rgb}{0.5,0.5,0.5}% \inactive (additional emphasising command). +% \defineTPcolor[blackbg]{epresentcolor}{rgb}{0,0,0.4}% Background color for \present (emphasising command). +% \defineTPcolor[blackbg]{ehighlightcolor}{rgb}{0,0,0.5}% Background color for \highlight (emphasising command). + + + +% Remember that the color definitions above only represent _one_ example for a possible color configuration. +% The following example (if uncommented) completely redefines the standard colors for the darkbackground option. This +% works for one or all colors of this or other background options by analogy. (Comment out the definition of the +% darkbackground colors above if convenient.) + +%% Color definitions for `dark' background. + +% \defineTPcolor[darkbg]{pagecolor}{rgb}{0,0.1,0}% Page background (for background style `plain'). + +% \defineTPcolor[darkbg]{bgndstartcolor}{rgb}{0,0.05,0}% Start color for gradient background. +% \defineTPcolor[darkbg]{bgndendcolor}{rgb}{0,0.4,0}% End color for gradient background. +% \defineTPcolor[darkbg]{bgndmidcolor}{rgb}{0,0.2,0.5}% Middle color for gradient background (`double' gradient). + +% \defineTPcolor[darkbg]{textcolor}{rgb}{1,0.6,1}% Normal text. + +% \defineTPcolor[darkbg]{emcolor}{rgb}{1,0,1}% Emphasised text (if coloremph option is given). +% \defineTPcolor[darkbg]{altemcolor}{rgb}{1,0,0.5}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[darkbg]{mathcolor}{rgb}{0.5,1,1}% Math (if colormath option is given). + +% \defineTPcolor[darkbg]{codecolor}{rgb}{0.8,0,0}% \code (additional emphasising command). +% \defineTPcolor[darkbg]{underlcolor}{rgb}{1,0.7,0.3}% \underl (additional emphasising command). +% \defineTPcolor[darkbg]{conceptcolor}{rgb}{1,1,0.4}% \concept (additional emphasising command). +% \defineTPcolor[darkbg]{inactivecolor}{rgb}{0.4,0.4,0.4}% \inactive (additional emphasising command). +% \defineTPcolor[darkbg]{presentcolor}{rgb}{0,0,0}% Background color for \present (emphasising command). +% \defineTPcolor[darkbg]{highlightcolor}{rgb}{0,0.3,0}% Background color for \highlight (emphasising command). + +% \defineTPcolor[darkbg]{buttoncolor}{rgb}{0.4,0.4,0.6}% Background color for buttons. +% \defineTPcolor[darkbg]{buttonshadowcolor}{gray}{0}% Button shadow. +% \defineTPcolor[darkbg]{buttonframecolor}{gray}{0}% Button frame. +% \defineTPcolor[darkbg]{buttontextcolor}{gray}{0}% Button text. + +% \defineTPcolor[darkbg]{toppanelcolor}{gray}{0.4}% Top panel background. +% \defineTPcolor[darkbg]{bottompanelcolor}{gray}{0.4}% Bottom panel background. +% \defineTPcolor[darkbg]{leftpanelcolor}{gray}{0.4}% Left panel background. +% \defineTPcolor[darkbg]{rightpanelcolor}{gray}{0.4}% Right panel background. +% \defineTPcolor[darkbg]{toppaneltextcolor}{gray}{1}% Top panel text. +% \defineTPcolor[darkbg]{bottompaneltextcolor}{gray}{1}% Bottom panel text. +% \defineTPcolor[darkbg]{leftpaneltextcolor}{gray}{1}% Left panel text. +% \defineTPcolor[darkbg]{rightpaneltextcolor}{gray}{1}% Right panel text. + + +% In the usual standard defaults given above, no dimmed or enhanced variants are included, to demonstrate TeXPower's +% automatic dimming and enhancing capabilities. It is possible, however, to provide `hand-tuned' dimmed and enhanced +% variants for nicer results. This is done by prefixing "d" or "e" to the color name. In the following, custom dimmed +% and enhanced variants of some of the colors defined above are specified. Note that background and panels are not +% affected by dimming and enhancing, so only the `text body' colors are specified. + +%% Dimmed color variants for `dark' background. + +% \defineTPcolor[darkbg]{dtextcolor}{rgb}{0.5,0.4,0.5}% Normal text. + +% \defineTPcolor[darkbg]{demcolor}{rgb}{0.5,0,0.5}% Emphasised text (if coloremph option is given). +% \defineTPcolor[darkbg]{daltemcolor}{rgb}{0.5,0,0.2}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[darkbg]{dmathcolor}{rgb}{0.2,0.5,0.5}% Math (if colormath option is given). + +% \defineTPcolor[darkbg]{dcodecolor}{rgb}{0.5,0,0}% \code (additional emphasising command). +% \defineTPcolor[darkbg]{dunderlcolor}{rgb}{0.5,0.3,0.1}% \underl (additional emphasising command). +% \defineTPcolor[darkbg]{dconceptcolor}{rgb}{0.5,0.5,0.2}% \concept (additional emphasising command). +% \defineTPcolor[darkbg]{dinactivecolor}{rgb}{0.2,0.2,0.2}% \inactive (additional emphasising command). +% \defineTPcolor[darkbg]{dpresentcolor}{rgb}{0,0.05,0}% Background color for \present (emphasising command). +% \defineTPcolor[darkbg]{dhighlightcolor}{rgb}{0,0.15,0}% Background color for \highlight (emphasising command). + + +%% Enhanced color variants for `dark' background. + +% \defineTPcolor[darkbg]{etextcolor}{rgb}{1,0.8,1}% Normal text. + +% \defineTPcolor[darkbg]{eemcolor}{rgb}{1,0.2,1}% Emphasised text (if coloremph option is given). +% \defineTPcolor[darkbg]{ealtemcolor}{rgb}{1,0.2,0.7}% Double emphasised text (if coloremph option is given). + +% \defineTPcolor[darkbg]{emathcolor}{rgb}{0.7,1,1}% Math (if colormath option is given). + +% \defineTPcolor[darkbg]{ecodecolor}{rgb}{1,0,0}% \code (additional emphasising command). +% \defineTPcolor[darkbg]{eunderlcolor}{rgb}{1,0.9,0.5}% \underl (additional emphasising command). +% \defineTPcolor[darkbg]{econceptcolor}{rgb}{1,1,0.6}% \concept (additional emphasising command). +% \defineTPcolor[darkbg]{einactivecolor}{rgb}{0.5,0.5,0.5}% \inactive (additional emphasising command). +% \defineTPcolor[darkbg]{epresentcolor}{rgb}{0.2,0,0}% Background color for \present (emphasising command). +% \defineTPcolor[darkbg]{ehighlightcolor}{rgb}{0,0.4,0}% Background color for \highlight (emphasising command). + + + +% The following example (if uncommented) shows what is neccessary for defining a completely new standard color which is +% recognized by TeXPower commands like \dimcolors, \enhancecolors (and display commands using those) as well as the +% commands \whitebackground, \lightbackground, \darkbackground, and \blackbackground. +% +% If you don't want to give different definitions of your color for different backgrounds, you can define it just in the +% current color set (leaving out the optional argument to \defineTPcolor), but then it will stay the same on all +% backgrounds and not be adapted when the background color changes. +% +% You don't have to define dimmed and enhanced variants of your color (with prefix d and e, respectively). If you just +% leave them out, TeXPower will calculate appropriate variants automatically. + +% \defineTPcolor[whitebg]{mycolor}{rgb}{1,0.5,0}% Variants of mycolor for white backgrounds. +% \defineTPcolor[whitebg]{dmycolor}{rgb}{0.9,0.8,0.6}% +% \defineTPcolor[whitebg]{emycolor}{rgb}{1,0.7,0}% +% % +% \defineTPcolor[lightbg]{mycolor}{rgb}{1,0.5,0}% Variants of mycolor for light backgrounds. +% \defineTPcolor[lightbg]{dmycolor}{rgb}{0.9,0.8,0.6}% +% \defineTPcolor[lightbg]{emycolor}{rgb}{1,0.7,0}% +% % +% \defineTPcolor[darkbg]{mycolor}{rgb}{0,0.5,1}% Variants of mycolor for dark backgrounds. +% \defineTPcolor[darkbg]{dmycolor}{rgb}{0.1,0.2,0.4}% +% \defineTPcolor[darkbg]{emycolor}{rgb}{0,0.3,1}% +% % +% \defineTPcolor[blackbg]{mycolor}{rgb}{0,0.5,1}% Variants of mycolor for black backgrounds. +% \defineTPcolor[blackbg]{dmycolor}{rgb}{0.1,0.2,0.4}% +% \defineTPcolor[blackbg]{emycolor}{rgb}{0,0.3,1}% + +\endinput +%% +%% End of file `tpcolors.cfg'. diff --git a/Master/texmf-dist/tex/latex/texpower/tplists.sty b/Master/texmf-dist/tex/latex/texpower/tplists.sty new file mode 100644 index 00000000000..8b9212b7102 --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/tplists.sty @@ -0,0 +1,514 @@ +%% +%% This is file `tplists.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-addons.dtx (with options: `tplists') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +% =============================================================================== +% File: tplists.sty +% +% Function: The package provides dynamic lists. The following +% environments/lists are available +% 1) 'stepenum', 'stepitem', 'stepeqlist', 'stepcompactenum' +% 'stepcompactitem' and 'stepcompacteqlist'. +% 2) 'flipenum', 'flipitem', 'flipeqlist', 'flipcompactenum', +% 'flipcompactitem', and 'flipcompacteqlist' +% 3) 'dimenum', 'dimitem', 'dimeqlist', 'dimcompactenum', +% 'dimcompactitem', and 'dimcompacteqlist' +% where 'step' is short for stepped, 'flip' for flipped and +% 'dim' for dimmed. The packages 'paralist' and 'eqlist' +% must be loaded before this package to use the *eqlist and +% *compact* lists. +% +% Usage: The package is loaded in the normal fashion, eg: +% \usepackage{tplists} +% The following options exist: +% pausestep - makes step* lists use \pause +% The package works better (the lists look better) if TeXPower +% uses colors. +% +% All lists (except *eqlist) takes an optional parameter +% adding to the indent of the list. Note that dim* and +% flip* lists do not nest, and that step* lists inside +% dim*/flip* will behave as a dim*/flip* list respectively. +% +% Example: +% +% \documentclass[a4paper]{article} +% \usepackage[darkbackground,display]{texpower} +% \usepackage{tplists} +% \begin{document} +% \begin{flipitem}[2cm] +% \item Before +% \begin{enumerate}[1cm] +% \item An item +% \item Another item +% \end{enumerate} +% \item After +% \end{flipitem} +% \end{document} +% +% (The normal 'itemize' and 'enumerate' lists are modified +% so they accept the optional parameter and work nested +% with the new lists.) +% +% Issues: The step* lists use \vstep (as default) which give weird results with +% structured backgrounds. Using the pausestep option fixes this, but then +% you can't nest step* lists inside dim* or flip* lists. +% There are also some unresolved problems when using french babel. +% +% History: 2003/10/03 v0.1: +% * first public release +% 2003/10/04 v0.1a: +% * removed redefinition of eqlist (since it doesn't work) +% 2003/10/07 v0.1b: +% * corrected some typos in this documentation +% * added option pausestep +% * made dim* (and all variants of flip*) lists work without +% colors by using boldface for active items. +% + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tplists}% + [2003/10/07 v0.1b Dynamic Lists using TeXPower] + +%% Packages +\RequirePackage{texpower} +% Compact enum/item. +\newboolean{tpl@paralist} +\@ifpackageloaded{paralist}{\setboolean{tpl@paralist}{true}}{} +% Lists with equal indentation. +\newboolean{tpl@eqlist} +\@ifpackageloaded{eqlist}{\setboolean{tpl@eqlist}{true}}{} + +%% Options +% Use \pause for steplists (too avoid problems with structured backgrounds). +\newboolean{tpl@pausestep} +\DeclareOption{pausestep}{\setboolean{tpl@pausestep}{true}} + +\ProcessOptions + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% Flipped/dimmed/stepped itemize/enumerate/eqlist environment. % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +% '\iftpl@instepenv' indicates if we are in some kind of stepped list +% environment. '\iftpl@indimenv' / '\tpl@inflipenv' indicates that we are +% using one of the stepwise environments from texpower (that doesn't +% nest). '\iftpl@inpausestepenv' indicates that we are in a stepped +% list that uses \pause. + +% using 'tpl@' as prefix for internals. +\newif\iftpl@instepenv \tpl@instepenvfalse +\newif\iftpl@inpausestepenv \tpl@inpausestepenvfalse +\newif\iftpl@indimenv \tpl@indimenvfalse +\newif\iftpl@inflipenv \tpl@inflipenvfalse +\let\oldenumerate=\enumerate +\let\olditemize=\itemize +\let\endoldenumerate=\endenumerate +\let\endolditemize=\enditemize +\ifthenelse{\boolean{tpl@eqlist}}{% +\let\oldeqlist=\eqlist +\let\endoldeqlist=\endeqlist +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\let\oldcompactenum=\compactenum +\let\oldcompactitem=\compactitem +\let\endoldcompactenum=\endcompactenum +\let\endoldcompactitem=\endcompactitem +}{} + +%%% Defining \tpl@collect@body - command used to scan the list +%%% environments. Definition borrowed from 'amsmath.sty' - slightly +%%% modified to allow for 'long' arguments +\let\tpl@nx\noexpand +\let\tpl@xp\expandafter +\newtoks\tpl@emptytoks +\newtoks\tpl@envbody +\long\def\tpl@addto@envbody#1{\global\tpl@envbody\tpl@xp{\the\tpl@envbody#1}} +\def\tpl@collect@body#1{% + \tpl@envbody{\tpl@xp#1\tpl@xp{\the\tpl@envbody}}% + \edef\tpl@process@envbody{\the\tpl@envbody\tpl@nx\end{\@currenvir}}% + \tpl@envbody\tpl@emptytoks \def\begin@stack{b}% + \begingroup + \tpl@xp\let\csname\@currenvir\endcsname\tpl@collect@@body + \edef\tpl@process@envbody{\tpl@xp\tpl@nx\csname\@currenvir\endcsname}% + \tpl@process@envbody +} +\long\def\tpl@push@begins#1\begin#2{% + \ifx\end#2\else b\tpl@xp\tpl@push@begins\fi +} +\long\def\tpl@collect@@body#1\end#2{% + \edef\begin@stack{\tpl@push@begins#1\begin\end \tpl@xp\@gobble\begin@stack}% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \tpl@addto@envbody{#1}% + \else + \tpl@addto@envbody{#1\end{#2}}% + \fi + \tpl@process@envbody +} + +%%% Defining command '\tpl@addmargin' used to add a length to +%%% the leftmargin of the current level in a list. +\def\tpl@addmargin#1{% + \advance\@listdepth 1 + \addtolength{\csname leftmargin\romannumeral\@listdepth\endcsname}{#1} + \advance\@listdepth -1 +} + +%%% Defining a flipped step command. +\ifthenelse{\boolean{TPcolor}}% Can we use colors? +{% Yes. In this case highlighting is implemented by switching color. + \def\tpl@flipstep% Note that \tpl@flipstep takes no argument. + {% + \step{\ifthenelse{\boolean{firstactivation}}% + {\color{textcolor}}% + {\color{inactivecolor}}% + }% + }% +} +{% No. In this case highlighting is implemented by putting the item in boldface. + \def\tpl@flipstep + {% + \step{\ifthenelse{\boolean{firstactivation}}% + {\bfseries}{\mdseries}} + }% + } + +%%% Defining a dimmed step command. +\ifthenelse{\boolean{TPcolor}}% Can we use colors? +{% Yes. In this case highlighting is implemented by using \dstep + \def\tpl@dimstep% Note that \tpl@flipstep takes no argument. + {% + \dstep + }% +} +{% No. In this case highlighting is implemented by putting the item in boldface. + \def\tpl@dimstep + {% + \step{\bfseries} + \ifthenelse{\boolean{active}}{}{\mdseries}% + }% + } + +%%% Defining flipped stepped - itemize / enumerate / eqlist +%%% compact itemize / compact enumerate / compact eqlist - environments. +\newenvironment{flipitem}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@flipitem}% + {\global\@ignoretrue} +\newenvironment{flipenum}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@flipenum}% + {\global\@ignoretrue} +\ifthenelse{\boolean{tpl@eqlist}}{% +\newenvironment{flipeqlist}[1][0cm]{% + \tpl@collect@body\@flipeqlist}% + {\global\@ignoretrue} +\newenvironment{flipcompacteqlist}[1][0cm]{% + \tpl@collect@body\@flipcompacteqlist}% + {\global\@ignoretrue} +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\newenvironment{flipcompactitem}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@flipcompactitem}% + {\global\@ignoretrue} +\newenvironment{flipcompactenum}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@flipcompactenum}% + {\global\@ignoretrue} +}{} + +\newcommand\@fliplist[2]{% + \iftpl@indimenv + \PackageError{tplists}{% + dim* and flip* environments do NOT nest}{% + Do not continue! Type 'q' to stop and fix the nested list. + } + \else\iftpl@instepenv + \begin{#1} + \let\hidestepcontents=\displaystepcontents + \renewcommand{\item}{\tpl@flipstep\tpl@origitem}% + #2 + \end{#1}% + \else + \iftpl@inpausestepenv\let\liststepwise=\stepwise\fi + \liststepwise[\let\hidestepcontents=\displaystepcontents]{% + \begin{#1} + \iftpl@inpausestepenv\else + \iftpl@instepenv\else\let\tpl@origitem=\item\fi + \fi + \tpl@instepenvtrue + \tpl@inflipenvtrue + \renewcommand{\item}{\tpl@flipstep\tpl@origitem}% + #2 + \step{} + \end{#1}} + \fi\fi +} + +\newcommand\@flipitem[1]{% + \@fliplist{olditemize}{#1}} +\newcommand\@flipenum[1]{% + \@fliplist{oldenumerate}{#1}} +\ifthenelse{\boolean{tpl@eqlist}}{% +\newcommand\@flipeqlist[1]{% + \@fliplist{oldeqlist}{#1}} +\newcommand\@flipcompacteqlist[1]{% + \@fliplist{compacteqlist}{#1}} +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\newcommand\@flipcompactitem[1]{% + \@fliplist{oldcompactitem}{#1}} +\newcommand\@flipcompactenum[1]{% + \@fliplist{oldcompactenum}{#1}} +}{} + +%%% Defining dimmed stepped - itemize / enumerate / eqlist / +%%% compact itemize / compact enumerate / compact eqlist - environments. +\newenvironment{dimitem}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@dimitem}% + {\global\@ignoretrue} +\newenvironment{dimenum}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@dimenum}% + {\global\@ignoretrue} +\ifthenelse{\boolean{tpl@eqlist}}{% +\newenvironment{dimeqlist}[1][0cm]{% + \tpl@collect@body\@dimeqlist}% + {\global\@ignoretrue} +\newenvironment{dimcompacteqlist}[1][0cm]{% + \tpl@collect@body\@dimcompacteqlist}% + {\global\@ignoretrue} +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\newenvironment{dimcompactitem}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@dimcompactitem}% + {\global\@ignoretrue} +\newenvironment{dimcompactenum}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@dimcompactenum}% + {\global\@ignoretrue} +}{} + +\newcommand\@dimlist[2]{% + \iftpl@inflipenv + \PackageError{tplists}{% + dim* and flip* environments do NOT nest}{% + Do not continue! Type <q> to stop and fix the nested list. + } + \else\iftpl@instepenv + \begin{#1} + \renewcommand{\item}{\tpl@dimstep\tpl@origitem}% + #2 + \end{#1}% + \else + \iftpl@inpausestepenv\let\liststepwise=\stepwise\fi + \liststepwise{% + \begin{#1} + \iftpl@inpausestepenv\else + \iftpl@instepenv\else\let\tpl@origitem=\item\fi + \fi + \tpl@instepenvtrue + \tpl@indimenvtrue + \renewcommand{\item}{\tpl@dimstep\tpl@origitem}% + #2 + \end{#1}} + \fi\fi +} + +\newcommand\@dimitem[1]{% + \@dimlist{olditemize}{#1}} +\newcommand\@dimenum[1]{% + \@dimlist{oldenumerate}{#1}} +\ifthenelse{\boolean{tpl@eqlist}}{% +\newcommand\@dimeqlist[1]{% + \@dimlist{oldeqlist}{#1}} +\newcommand\@dimcompacteqlist[1]{% + \@dimlist{compacteqlist}{#1}} +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\newcommand\@dimcompactitem[1]{% + \@dimlist{oldcompactitem}{#1}} +\newcommand\@dimcompactenum[1]{% + \@dimlist{oldcompactenum}{#1}} +}{} + +%%% Defining stepped - itemize / enumerate / eqlist / +%%% compact itemize / compact enumerate / compact eqlist - environments. +\newenvironment{stepitem}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@stepitem}% + {\global\@ignoretrue} +\newenvironment{stepenum}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@stepenum}% + {\global\@ignoretrue} +\ifthenelse{\boolean{tpl@eqlist}}{% +\newenvironment{stepeqlist}[1][0cm]{% + \tpl@collect@body\@stepeqlist}% + {\global\@ignoretrue} +\newenvironment{stepcompacteqlist}[1][0cm]{% + \tpl@collect@body\@stepcompacteqlist}% + {\global\@ignoretrue} +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\newenvironment{stepcompactitem}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@stepcompactitem}% + {\global\@ignoretrue} +\newenvironment{stepcompactenum}[1][0cm]{% + \tpl@addmargin{#1} + \tpl@collect@body\@stepcompactenum}% + {\global\@ignoretrue} +}{} + +\ifthenelse{\boolean{tpl@pausestep}}{% +% Using \pause for step* lists +\newcommand\@steplist[2]{% + \iftpl@inflipenv + \PackageError{tplists}{% + flip* followed by step* environment does NOT work \MessageBreak + when the pausestep option is used}{% + Do not continue! Type <q> to stop and fix the nested list. + } + \else\iftpl@indimenv + \PackageError{tplists}{% + dim* followed by step* environment does NOT work \MessageBreak + when the pausestep option is used}{% + Do not continue! Type <q> to stop and fix the nested list. + } + \else + \begin{#1} + \iftpl@inpausestepenv\else\let\tpl@origitem=\item\fi + \tpl@inpausestepenvtrue + \renewcommand{\item}{\pause\tpl@origitem}% + #2 + \end{#1} + \fi\fi +} +}{ +% Using \liststepwise for step* lists +\newcommand\@steplist[2]{% + \iftpl@inflipenv + \begin{#1} + \renewcommand{\item}{\tpl@flipstep\tpl@origitem} + #2 + \end{#1}% + \else\iftpl@indimenv + \begin{#1} + \renewcommand{\item}{\dstep\tpl@origitem}% + #2 + \end{#1}% + \else\iftpl@instepenv + \begin{#1} + \renewcommand{\item}{\vstep\tpl@origitem}% + #2 + \end{#1}% + \else + \liststepwise{% + \begin{#1} + \iftpl@instepenv\else\let\tpl@origitem=\item\fi + \tpl@instepenvtrue + \renewcommand{\item}{\vstep\tpl@origitem}% + #2 + \end{#1}} + \fi\fi\fi +} +} + +\newcommand\@stepitem[1]{% + \@steplist{olditemize}{#1}} +\newcommand\@stepenum[1]{% + \@steplist{oldenumerate}{#1}} +\ifthenelse{\boolean{tpl@eqlist}}{% +\newcommand\@stepeqlist[1]{% + \@steplist{oldeqlist}{#1}} +\newcommand\@stepcompacteqlist[1]{% + \@steplist{compacteqlist}{#1}} +}{} +\ifthenelse{\boolean{tpl@paralist}}{% +\newcommand\@stepcompactitem[1]{% + \@steplist{oldcompactitem}{#1}} +\newcommand\@stepcompactenum[1]{% + \@steplist{oldcompactenum}{#1}} +}{} + +%%% Defining compact eqlist +\newenvironment{compacteqlist}[1][0cm]{% + % \tpl@addmargin{#1} + \begin{eqlist}[\parsep0pt\itemsep0pt]}% + {\end{eqlist}} + + +%%% Redefining enumerate and itemize to handle changes made by +%%% introducing steps and leftmargini-option. +\renewenvironment{enumerate}[1][0cm]{% + \tpl@addmargin{#1} + \begin{oldenumerate} + \iftpl@instepenv + \renewcommand{\item}{\tpl@origitem}% + \fi + }% + {\end{oldenumerate}} + +\renewenvironment{itemize}[1][0cm]{% + \tpl@addmargin{#1} + \begin{olditemize} + \iftpl@instepenv + \renewcommand{\item}{\tpl@origitem}% + \fi + }% + {\end{olditemize}} + +%%% Redefining compactenum and compactitem to handle changes made by +%%% introducing steps and leftmargini-option. +\ifthenelse{\boolean{tpl@paralist}}{% +\renewenvironment{compactenum}[1][0cm]{% + \tpl@addmargin{#1} + \begin{oldcompactenum} + \iftpl@instepenv + \renewcommand{\item}{\tpl@origitem}% + \fi + }% + {\end{oldcompactenum}} + +\renewenvironment{compactitem}[1][0cm]{% + \tpl@addmargin{#1} + \begin{oldcompactitem} + \iftpl@instepenv + \renewcommand{\item}{\tpl@origitem}% + \fi + }% + {\end{oldcompactitem}} +}{} +\endinput +%% +%% End of file `tplists.sty'. diff --git a/Master/texmf-dist/tex/latex/texpower/tpoptions.cfg b/Master/texmf-dist/tex/latex/texpower/tpoptions.cfg new file mode 100644 index 00000000000..96560a0998b --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/tpoptions.cfg @@ -0,0 +1,40 @@ +%% +%% This is file `tpoptions.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-cfg.dtx (with options: `tpoptions') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +%======================================================================================================================= +% File: tpoptions.cfg +% +% System-specific configuration of options defined by the texpower package. +% +%======================================================================================================================= + +% The following example (if uncommented) will turn on the display option by default. + +%\ExecuteOptions{display} + +\endinput +%% +%% End of file `tpoptions.cfg'. diff --git a/Master/texmf-dist/tex/latex/texpower/tppstcol.sty b/Master/texmf-dist/tex/latex/texpower/tppstcol.sty new file mode 100644 index 00000000000..02da81b8ab3 --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/tppstcol.sty @@ -0,0 +1,99 @@ +%% +%% This is file `tppstcol.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-addons.dtx (with options: `tppstcol') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +%======================================================================================================================= +% File: tppstcol.sty +% +% Replacement for ``pstcol.sty'' with some quirks corrected. +% There is a small problem with pstcol.sty which makes it impossible +% to set something like "fillcolor=\linecolor" in pstricks (see LaTeX +% Bug graphics/3366). As this is absolutely indispensible for +% automata.sty, I had to make a modified version to be used until the +% bug is mended. +% The following code is identical with the original pstcol.sty, with +% some modifications to correct the bug. +% +% This package is an addition to the TeXPower bundle, to be found at +% +% http://texpower.sourceforge.net/ +% +% Beware! As soon as the original bug in pstcol is corrected, this +% package will be deleted. +% +%======================================================================================================================= + +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{tppstcol} + [2001/08/28 v0.2 PSTricks color compatibility (DPC; revised + by STL)] +%%%%%%%%%%%%%%%%%% +\let\saved@gray\color@gray +\RequirePackage{pstricks} +\let\color@gray\saved@gray +%%%%%%%%%%%%%%%% +\DeclareOption*{\PassOptionsToPackage\CurrentOption{color}} +\ProcessOptions +\RequirePackage{color} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\pst@getcolor#1#2{% +\@ifundefined{\string\color@#1}% +{\@pstrickserr{Color `#1' not defined}\@eha}% + {\edef#2{#1}}} +\def\pst@usecolor#1% +{% + \expandafter\expandafter\expandafter + \c@lor@to@ps\csname\string\color @#1\endcsname\@@\space% + } +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\definecolor{darkgray}{gray}{.25} +\definecolor{gray}{gray}{.5} +\definecolor{lightgray}{gray}{.75} +\definecolor{gradbegin}{rgb}{0,1,1} +\definecolor{gradend}{rgb}{0,.1,.95} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\psset@bordercolor{white} +\psset@doublecolor{white} +\psset@linecolor{black} +\psset@fillcolor{white} +\psset@hatchcolor{black} +\psset@gridcolor{black} +\psset@gridlabelcolor{black} +\psset@shadowcolor{darkgray} +\psset@subgridcolor{gray} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\newgray#1{% + \definecolor{#1}{gray}} +\def\newrgbcolor#1#2{% + \newrgbcolorx{#1}#2\@@} +\def\newrgbcolorx#1#2 #3 #4\@@{% + \definecolor{#1}{rgb}{#2,#3,#4}} +\def\newcmykcolor#1#2{% + \newcmykcolorx{#1}#2\@@} +\def\newcmykcolorx#1#2 #3 #4 #5\@@{% + \definecolor{#1}{cmyk}{#2,#3,#4,#5}} +\endinput +%% +%% End of file `tppstcol.sty'. diff --git a/Master/texmf-dist/tex/latex/texpower/tpsem-a4.sty b/Master/texmf-dist/tex/latex/texpower/tpsem-a4.sty new file mode 100644 index 00000000000..4753d98ad98 --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/tpsem-a4.sty @@ -0,0 +1,36 @@ +%% +%% This is file `tpsem-a4.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-addons.dtx (with options: `tpsem-a4') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +% Fixed for LaTeX2e (\paperwidth and \paperheight are dimensions) by +% Stephan Lehmke. +\setlength\paperwidth{210mm} +\setlength\paperheight{297mm} +\input sem-page.sty +\slidewidth 222mm +\slideheight 152mm +\endinput +%% +%% End of file `tpsem-a4.sty'. diff --git a/Master/texmf-dist/tex/latex/texpower/tpsettings.cfg b/Master/texmf-dist/tex/latex/texpower/tpsettings.cfg new file mode 100644 index 00000000000..7beab25003c --- /dev/null +++ b/Master/texmf-dist/tex/latex/texpower/tpsettings.cfg @@ -0,0 +1,37 @@ +%% +%% This is file `tpsettings.cfg', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% texpower-cfg.dtx (with options: `tpsettings') +%% +%% -------------------------------------------------------------- +%% 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'. +%% +%======================================================================================================================= +% File: tpsettings.cfg +% +% System-specific configuration of defaults defined by the texpower package. +% +%======================================================================================================================= + + +\endinput +%% +%% End of file `tpsettings.cfg'. |