| 1 |
%% |
| 2 |
%% This is file `divexample.tex', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% texpower-doc.dtx (with options: `divexample,divexample-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{divexample.tex}% |
| 29 |
[2005/04/07 TeXPower example file] |
| 30 |
%----------------------------------------------------------------------------------------------------------------- |
| 31 |
% |
| 32 |
% Divisibility example (demonstrating \step's optional arguments) for the package texpower.sty. |
| 33 |
% |
| 34 |
%----------------------------------------------------------------------------------------------------------------- |
| 35 |
% We input the generic preamble. |
| 36 |
|
| 37 |
\input{__TPpreamble} |
| 38 |
\hypersetup{pdftitle={texpower divisibility example}} |
| 39 |
|
| 40 |
|
| 41 |
%----------------------------------------------------------------------------------------------------------------- |
| 42 |
% Finally, everything is set up. Here we go... |
| 43 |
% |
| 44 |
\begin{document} |
| 45 |
\begin{slide} |
| 46 |
% As the sectioning in the example files starts with \subsection, we `grade down' the sectioning commands. |
| 47 |
\let\subsubsection\subsection |
| 48 |
\let\subsection\section |
| 49 |
%----------------------------------------------------------------------------------------------------------------- |
| 50 |
% |
| 51 |
\makeslidetitle{\macroname{stepwise} Example: Fooling Around}\label{Sec:ExFooling} |
| 52 |
% The following example is just to show that a lot of fancy things are possible by appropriately defining the diverse |
| 53 |
% `hooks' offererd by \stepwise. |
| 54 |
`Tweaking' the hooks a little allows some truly bizarre applications\dots |
| 55 |
|
| 56 |
% In the following \stepwise command, \activatestep will be set to \textbf. This means the `first' occurrence of a number |
| 57 |
% is wider (because bf is an extended font) than all other occurrences of it. To avoid glitches in line breaks, all |
| 58 |
% other occurrences of numbers (visible and invisible) need to be of the same width. Hence we define new versions of |
| 59 |
% \displaystepcontents and \hidestepcontents. |
| 60 |
\def\mydisplay#1{\makebox[\widthof{\textbf{#1}}]{#1}} |
| 61 |
\def\myhide#1{\phantom{\makebox[\widthof{\textbf{#1}}]{#1}}} |
| 62 |
|
| 63 |
\newcounter{modulo} |
| 64 |
\newcounter{i} |
| 65 |
|
| 66 |
% Finally, we define a custom \step command which sets the optional arguments of \step. |
| 67 |
% We already have introduced the first optional argument, which determines when a \step is activated for the first |
| 68 |
% time. Here, this one is left at its default value (\value{step}=\value{stepcommand}). |
| 69 |
% Here, we also use the second optional argument, which has the same syntax as the first one (i.e. it can be surrounded |
| 70 |
% either by square brackets or braces), but determines when a \step is active _at all_ (i.e. whether |
| 71 |
% \displaystepcontents or \hidestepcontents is used). The default is the internal check \if@first@TP@true, which determines |
| 72 |
% whether step number \value{stepcommand} has already been activated for the first time (this is saved internally for |
| 73 |
% every step). Now, we redefine this condition to be fulfilled whenever the value of the counter step is divisible by |
| 74 |
% the value of the counter stepcommand. |
| 75 |
\def\mystep{\step[](\setcounter{modulo}{\value{step}/\value{stepcommand}*\value{stepcommand}}\ifthenelse{\value{step}=\value{modulo}})}% |
| 76 |
|
| 77 |
|
| 78 |
% By setting the page duration to 0.5 seconds, we make the following sequence of slides appear automatically one by one, |
| 79 |
% one every half second. |
| 80 |
|
| 81 |
\pageDuration{0.5} |
| 82 |
|
| 83 |
% |
| 84 |
% We use the custom command \parstepwise which not only wraps the whole argument of \stepwise into a minipage (because |
| 85 |
% otherwise vertical spacing goes haywire, don't ask me why), but also gives substance to steps. We use the starred |
| 86 |
% version of this command so that the number 1 appears on the first slide generated by \parstepwise. |
| 87 |
% |
| 88 |
% \activatestep is set to \textbf to emphasize the number the divisors of which are displayed. |
| 89 |
\parstepwise*[\let\activatestep=\textbf\let\displaystepcontents=\mydisplay\let\hidestepcontents=\myhide] |
| 90 |
{% |
| 91 |
\huge |
| 92 |
\setcounter{i}{0}% |
| 93 |
Divisibility demo: |
| 94 |
|
| 95 |
% We just have to generate the appropriate number of \mystep commands which display `their' numbers. |
| 96 |
\whiledo{\value{i}<40}{\stepcounter{i}\mystep{\arabic{i}} }% |
| 97 |
|
| 98 |
} |
| 99 |
|
| 100 |
% Stop automatic advancing of pages. |
| 101 |
|
| 102 |
\stopAdvancing |
| 103 |
\end{slide} |
| 104 |
\end{document} |
| 105 |
\endinput |
| 106 |
%% |
| 107 |
%% End of file `divexample.tex'. |