| 1 |
%% |
| 2 |
%% This is file `mathexample.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% texpower-doc.dtx (with options: `mathexample,mathexample-src,end') |
| 8 |
%% |
| 9 |
%% -------------------------------------------------------------- |
| 10 |
%% TeXPower bundle - dynamic online presentations with LaTeX |
| 11 |
%% Copyright (C) 1999-2004 Stephan Lehmke |
| 12 |
%% Copyright (C) 2003-2005 Hans Fredrik Nordhaug |
| 13 |
%% |
| 14 |
%% This program is free software; you can redistribute it and/or |
| 15 |
%% modify it under the terms of the GNU General Public License |
| 16 |
%% as published by the Free Software Foundation; either version 2 |
| 17 |
%% of the License, or (at your option) any later version. |
| 18 |
%% |
| 19 |
%% This program is distributed in the hope that it will be useful, |
| 20 |
%% but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
%% GNU General Public License for more details. |
| 23 |
%% -------------------------------------------------------------- |
| 24 |
%% |
| 25 |
%% The list of all files belonging to the TeXPower bundle is |
| 26 |
%% given in the file `00readme.txt'. |
| 27 |
%% |
| 28 |
\ProvidesFile{mathexample.tex}% |
| 29 |
[2005/04/07 TeXPower example file] |
| 30 |
%----------------------------------------------------------------------------------------------------------------- |
| 31 |
% |
| 32 |
% Math example for the package texpower.sty. |
| 33 |
% |
| 34 |
%----------------------------------------------------------------------------------------------------------------- |
| 35 |
% Enable all color emphasis and highlighting options. Use white background and slifonts. |
| 36 |
|
| 37 |
\PassOptionsToPackage{coloremph,colormath,colorhighlight,whitebackground}{texpower} |
| 38 |
|
| 39 |
% Input the generic preamble. |
| 40 |
|
| 41 |
\input{__TPpreamble} |
| 42 |
|
| 43 |
\usepackage{tpslifonts} |
| 44 |
|
| 45 |
\hypersetup{pdftitle={texpower math example}} |
| 46 |
|
| 47 |
|
| 48 |
%----------------------------------------------------------------------------------------------------------------- |
| 49 |
% Packages and Preamble settings individual for this example. |
| 50 |
|
| 51 |
% We write some aligned equations. |
| 52 |
|
| 53 |
\usepackage{amsmath} |
| 54 |
% Make nested braces grow. |
| 55 |
\delimitershortfall-1sp |
| 56 |
|
| 57 |
%----------------------------------------------------------------------------------------------------------------- |
| 58 |
% Finally, everything is set up. Here we go... |
| 59 |
% |
| 60 |
\begin{document} |
| 61 |
\begin{slide} |
| 62 |
%----------------------------------------------------------------------------------------------------------------- |
| 63 |
% |
| 64 |
\makeslidetitle{\macroname{stepwise} Example: An Aligned Equation}\label{Sec:ExEq} |
| 65 |
% In the following, an aligned system of equations is built incrementally. We use the custom command \liststepwise to |
| 66 |
% avoid glitches in vertical spacing. |
| 67 |
% |
| 68 |
\liststepwise% |
| 69 |
{% |
| 70 |
% |
| 71 |
% This is just for compressing the equations so they can be squeezed on one slide. |
| 72 |
% |
| 73 |
\fontsize{7.8pt}{9pt}\selectfont |
| 74 |
\renewcommand{\arraystretch}{0}% |
| 75 |
\setlength{\arraycolsep}{0pt}% |
| 76 |
\setlength{\abovedisplayskip}{0pt}% |
| 77 |
\setlength{\belowdisplayskip}{0pt}% |
| 78 |
% |
| 79 |
% \highlightboxed will be used for underlaying some formulas with color. To minimize overlap, the width of the outer |
| 80 |
% frame is reduced. |
| 81 |
\setlength{\highlightboxsep}{1pt}% |
| 82 |
% |
| 83 |
\begin{align*} |
| 84 |
\lefteqn |
| 85 |
{% |
| 86 |
\min |
| 87 |
\left( |
| 88 |
% The nested braces are filled `from outer to inner'. This means nesting a lot of steps inside each other... |
| 89 |
% The outermost brace is displayed from the outset. |
| 90 |
% The first step (which follows right here) displays the next inner brace (the first argument of \min), filled |
| 91 |
% with an almost `empty' array (apart from one comma and some dots). |
| 92 |
% \bstep is used to get appropriate white space when the step is not yet active. |
| 93 |
\bstep |
| 94 |
{\max |
| 95 |
\left( |
| 96 |
\begin{array}{l} |
| 97 |
% The next two steps fill in the lines of the array. |
| 98 |
\bstep{\min\left(F'(x),\min\left(F_1(x),G_1(y)\right)\right)},\\[-2ex] |
| 99 |
\vdots\\ |
| 100 |
\bstep{\min\left(F'(x),\min\left(F_n(x),G_n(y)\right)\right)} |
| 101 |
\end{array} |
| 102 |
\right) |
| 103 |
}, |
| 104 |
% After the first brace is filled, the next step provides the second argument of \min. |
| 105 |
\bstep{\min\left(G_i(y),H_i(z)\right)} |
| 106 |
\right) |
| 107 |
} |
| 108 |
& |
| 109 |
% The next couple of steps will create the remaining lines of the aligned equations. These need to be |
| 110 |
% insubstantial (as is the default for \liststepwise), because & can't go in a box. |
| 111 |
% As a consequence, the horizontal alignment cannot kick in until the last step is performed. This would make the |
| 112 |
% alignment `flicker' sidewise. |
| 113 |
% So we have to bite the bullet and duplicate the widest entry here (invisibly), so that the horizontal alignment |
| 114 |
% is constant during all steps. *sigh* |
| 115 |
\phantom |
| 116 |
{% |
| 117 |
{}= |
| 118 |
\min |
| 119 |
\left( |
| 120 |
F'(x), |
| 121 |
\min |
| 122 |
\left( |
| 123 |
\max |
| 124 |
\left( |
| 125 |
\begin{array}{l} |
| 126 |
\min\left(F_1(x),\min\left(G_1(y),G_i(y)\right)\right),\\[-1.5ex] |
| 127 |
\vdots\\[-.5ex] |
| 128 |
\min\left(F_n(x),\min\left(G_n(y),G_i(y)\right)\right) |
| 129 |
\end{array} |
| 130 |
\right), |
| 131 |
H_i(z) |
| 132 |
\right) |
| 133 |
\right) |
| 134 |
} |
| 135 |
% The next step displays two lines at a time, but incompletely, i.e. some parts are missing (which are inside |
| 136 |
% nested calls of \bstep). |
| 137 |
% This way, it is demonstrated how the arguments of the nested \min's are reordered. |
| 138 |
\step |
| 139 |
{% |
| 140 |
\\ |
| 141 |
&= |
| 142 |
\max |
| 143 |
\left( |
| 144 |
% The macro \activatestep is used by \stepwise to `wrap' the argument of a \bstep command at the _first_ time |
| 145 |
% it appears. |
| 146 |
% Usually, it does nothing. Now, we redefine it to highlight its background, so it is easier to spot the |
| 147 |
% places where the additional arguments were inserted. |
| 148 |
\let\activatestep\highlightboxed |
| 149 |
\begin{array}{l} |
| 150 |
\min |
| 151 |
\left( |
| 152 |
% The inner \bstep's display the missing arguments, which are completely identical in both lines. |
| 153 |
% It is intended that all the missing arguments appear at the same time, so \rebstep is used for the |
| 154 |
% remaining arguments which have been left out. |
| 155 |
\min\left(\bstep{F'(x)},\min\left(\rebstep{F_1(x),G_1(y)}\right)\right),\min\left(G_i(y),H_i(z)\right) |
| 156 |
\right),\\[-2ex] |
| 157 |
\vdots\\[-1ex] |
| 158 |
\min |
| 159 |
\left( |
| 160 |
\min\left(\rebstep{F'(x)},\min\left(\rebstep{F_n(x),G_n(y)}\right)\right),\min\left(G_i(y),H_i(z)\right) |
| 161 |
\right) |
| 162 |
\end{array} |
| 163 |
\right) |
| 164 |
\\ |
| 165 |
&= |
| 166 |
\max |
| 167 |
\left( |
| 168 |
\let\activatestep\highlightboxed |
| 169 |
\begin{array}{l} |
| 170 |
\min |
| 171 |
\left( |
| 172 |
\min\left( |
| 173 |
% Here are the remaining arguments of \min which are all to be displayed in one step (together with |
| 174 |
% those from the previous line). |
| 175 |
\rebstep{F'(x)},\min\left(\rebstep{F_1(x)},\min\left(\rebstep{G_1(y)},G_i(y)\right)\right) |
| 176 |
\right), |
| 177 |
H_i(z) |
| 178 |
\right),\\[-2.5ex] |
| 179 |
\vdots\\[-1.5ex] |
| 180 |
\min |
| 181 |
\left( |
| 182 |
\min\left( |
| 183 |
\rebstep{F'(x)},\min\left(\rebstep{F_n(x)},\min\left(\rebstep{G_n(y)},G_i(y)\right)\right) |
| 184 |
\right), |
| 185 |
H_i(z) |
| 186 |
\right) |
| 187 |
\end{array} |
| 188 |
\right) |
| 189 |
} |
| 190 |
\step |
| 191 |
{% |
| 192 |
\\ |
| 193 |
&= |
| 194 |
\min |
| 195 |
\left( |
| 196 |
F'(x), |
| 197 |
\min |
| 198 |
\left( |
| 199 |
\max |
| 200 |
\left( |
| 201 |
\begin{array}{l} |
| 202 |
\min\left(F_1(x),\min\left(G_1(y),G_i(y)\right)\right),\\[-1.5ex] |
| 203 |
\vdots\\[-.5ex] |
| 204 |
\min\left(F_n(x),\min\left(G_n(y),G_i(y)\right)\right) |
| 205 |
\end{array} |
| 206 |
\right), |
| 207 |
H_i(z) |
| 208 |
\right) |
| 209 |
\right) |
| 210 |
} |
| 211 |
\end{align*} |
| 212 |
}% |
| 213 |
\newslide |
| 214 |
\end{slide} |
| 215 |
\end{document} |
| 216 |
\endinput |
| 217 |
%% |
| 218 |
%% End of file `mathexample.tex'. |