summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/texpower/divexample.tex
blob: 42a4f15783d4b5fb1162ae68abb24cf9c24f5741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
%%
%% This is file `divexample.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% texpower-doc.dtx  (with options: `divexample,divexample-src,end')
%% 
%% --------------------------------------------------------------
%% 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'.
%% 
\ProvidesFile{divexample.tex}%
      [2004/07/27 TeXPower example file]
%-----------------------------------------------------------------------------------------------------------------
% File: divexample.tex
%
% Divisibility example (demonstrating \step's optional arguments) for the package texpower.sty.
%
% This file can be compiled with pdfLaTeX or (standard) LaTeX. When using standard LaTeX, the dvi file produced should
% be processed with
%
% dvips -Ppdf -j0 divexample
%
% afterwards processing the resulting ps file with
%
% distill divexample.ps
%
% (The syntax is for a unix system with tetex 1.0 and distiller 3. Modify appropriately for other configurations.)
%
% The resulting pdf file is meant for presenting `interactively' with Adobe Acrobat Reader.
%
%-----------------------------------------------------------------------------------------------------------------
% Autor: Stephan Lehmke <Stephan.Lehmke@cs.uni-dortmund.de>
%
% v0.0.1 Mar 20, 2000: First version for the pre-alpha release of TeXPower.
%
% v0.0.2 Apr 26, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
%
% v0.0.3 May 18, 2000: New file name.
%

%-----------------------------------------------------------------------------------------------------------------
% We input the generic preamble.

\input{__TPpreamble}
\hypersetup{pdftitle={texpower divisibility example}}


%-----------------------------------------------------------------------------------------------------------------
% Finally, everything is set up. Here we go...
%
\begin{document}
\begin{slide}
  % As the sectioning in the example files starts with \subsection, we `grade down' the sectioning commands.
  \let\subsubsection\subsection
  \let\subsection\section
%-----------------------------------------------------------------------------------------------------------------
%
\makeslidetitle{\macroname{stepwise} Example: Fooling Around}\label{Sec:ExFooling}
% The following example is just to show that a lot of fancy things are possible by appropriately defining the diverse
% `hooks' offererd by \stepwise.
`Tweaking' the hooks a little allows some truly bizarre applications\dots

% In the following \stepwise command, \activatestep will be set to \textbf. This means the `first' occurrence of a number
% is wider (because bf is an extended font) than all other occurrences of it. To avoid glitches in line breaks, all
% other occurrences of numbers (visible and invisible) need to be of the same width. Hence we define new versions of
% \displaystepcontents and \hidestepcontents.
\def\mydisplay#1{\makebox[\widthof{\textbf{#1}}]{#1}}
\def\myhide#1{\phantom{\makebox[\widthof{\textbf{#1}}]{#1}}}

\newcounter{modulo}
\newcounter{i}

% Finally, we define a custom \step command which sets the optional arguments of \step.
% We already have introduced the first optional argument, which determines when a \step is activated for the first
% time. Here, this one is left at its default value (\value{step}=\value{stepcommand}).
% Here, we also use the second optional argument, which has the same syntax as the first one (i.e. it can be surrounded
% either by square brackets or braces), but determines when a \step is active _at all_ (i.e. whether
% \displaystepcontents or \hidestepcontents is used). The default is the internal check \if@first@TP@true, which determines
% whether step number \value{stepcommand} has already been activated for the first time (this is saved internally for
% every step). Now, we redefine this condition to be fulfilled whenever the value of the counter step is divisible by
% the value of the counter stepcommand.
\def\mystep{\step[](\setcounter{modulo}{\value{step}/\value{stepcommand}*\value{stepcommand}}\ifthenelse{\value{step}=\value{modulo}})}%


% By setting the page duration to 0.5 seconds, we make the following sequence of slides appear automatically one by one,
% one every half second.

\pageDuration{0.5}

%
% We use the custom command \parstepwise which not only wraps the whole argument of \stepwise into a minipage (because
% otherwise vertical spacing goes haywire, don't ask me why), but also gives substance to steps. We use the starred
% version of this command so that the number 1 appears on the first slide generated by \parstepwise.
%
% \activatestep is set to \textbf to emphasize the number the divisors of which are displayed.
\parstepwise*[\let\activatestep=\textbf\let\displaystepcontents=\mydisplay\let\hidestepcontents=\myhide]
{%
  \huge
  \setcounter{i}{0}%
    Divisibility demo:

    % We just have to generate the appropriate number of \mystep commands which display `their' numbers.
    \whiledo{\value{i}<40}{\stepcounter{i}\mystep{\arabic{i}} }%

  }

% Stop automatic advancing of pages.

\stopAdvancing
\end{slide}
\end{document}
\endinput
%%
%% End of file `divexample.tex'.