Debian Codegraph @

texmf-dist/doc/latex/texpower/hilitexample.tex

raw
1 %%
2 %% This is file `hilitexample.tex',
3 %% generated with the docstrip utility.
4 %%
5 %% The original source files were:
6 %%
7 %% texpower-doc.dtx (with options: `hilitexample,hilitexample-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{hilitexample.tex}%
29 [2005/04/07 TeXPower example file]
30 %-----------------------------------------------------------------------------------------------------------------
31 %
32 % Highlighting example for the package texpower.sty.
33 %
34 %-----------------------------------------------------------------------------------------------------------------
35 % Use slifonts.
36
37 \RequirePackage{tpslifonts}
38
39 % Input the generic preamble.
40
41 \input{__TPpreamble}
42 \hypersetup{pdftitle={texpower highlighting example}}
43
44 % The package soul is needed for \highlighttext to work.
45
46 \usepackage{soul}
47
48 %-----------------------------------------------------------------------------------------------------------------
49 % Finally, everything is set up. Here we go...
50 %
51 \begin{document}
52 \begin{slide}
53 %-----------------------------------------------------------------------------------------------------------------
54 %
55 \makeslidetitle{\macroname{stepwise} Example: Highlighting Text}\label{Sec:Exhl}
56 % The default for \step's which are not yet `active' is to be `invisible'. In preceding examples, we have redefined
57 % internal macros like \hidestepcontents or \activatestep to achieve special `highlighting' effects.
58 % Here, we demonstrate how make text `stand out' from the background incrementally without having it appear from thin
59 % air.
60
61 % The first example demonstrates how to make \step its argument `stand out' instead of making it appear `out of
62 % nowhere'.
63
64 \makeatletter
65 \ifthenelse{\boolean{TPcolor}}% Can we use colors?
66 {% Yes. In this case \step should change colors from `dimmed' to `active'.
67
68 % The command \hidedimmed switches colors to `dimmed', the command \highlightenhanced switches colors to `enhanced'.
69 \liststepwise[\let\hidestepcontents=\hidedimmed\let\activatestep=\highlightenhanced]
70 {%
71 \vspace*{\fill}
72 \begin{quote}
73 \Large%
74 \step{Instead of making things appear out of `thin air',} \step{we can also make them appear `out of the
75 background'} \step{by incrementally changing color from \concept{inactive}} \step{to \concept{active}.}
76 \step{This also works with \emph{color emphasis}} \step{and \concept{math coloring}: $a=b^2$.}
77 \end{quote}
78 \vspace*{\fill}\vspace*{\fill}
79 }%
80 }
81 {% No. In this case we have to `handwave' using the soul package.
82 % Instead of hiding its argument, the new command \myhide just changes the font size (maintaining the overall text
83 % length though).
84 \def\myhide
85 {%
86 \leavevmode%
87 \SOUL@setup
88 \def\SOUL@everytoken{\makebox[\widthof{\the\SOUL@token}][s]{\rule[\depthof{\the\SOUL@token}*-1]{0pt}{\depthof{\the\SOUL@token}+\heightof{\the\SOUL@token}}\hrulefill\tiny\the\SOUL@token\hrulefill}\SOUL@setkern\SOUL@charkern}%
89 \SOUL@%
90 }
91
92 \liststepwise[\let\hidestepcontents=\myhide\setcounter{firststep}{0}]
93 {%
94 \vspace*{\fill}
95 \begin{quote}
96 \LARGE%
97 \step{Instead of making things appear out of `thin air',} \step{we can also make them appear `out of the
98 background'} \step{incrementally.}
99 \end{quote}
100 \vspace*{\fill}\vspace*{\fill}
101 }%
102 }
103 \makeatother
104
105 \newslide
106
107 % Next, it is demonstrated how we can `flip through' an itemize environment by just highlighting the items in turn
108 % instead of making them appear one by one.
109 %
110 % Define a macro \mystep which implements the highlighting effect.
111 \ifthenelse{\boolean{TPcolor}}% Can we use colors?
112 {% Yes. In this case highlighting is implemented by switching color.
113 \def\mystep% Note that \mystep takes no argument. It just changes the way the next item is displayed.
114 {%
115 \usecolorset{stwcolors}% Restore the undimmed colors valid at the beginning of \stepwise.
116 \dstep[][\boolean{firstactivation}]% \dstep switches colors. The optional argument makes it appear only once.
117 }%
118 }
119 {% No. In this case highlighting is implemented by redefining \labelitemi.
120 \def\mystep
121 {%
122 \switch[][\boolean{firstactivation}]% The optional arguments make \switch act only once.
123 {\def\labelitemi{\origmath{\gg}}}{\def\labelitemi{\origmath{\cdot}}}%
124 }%
125 }
126
127 % We define a custom itemize environment which automatically adds calls to \mystep:
128 \newenvironment{stepitemize}
129 {%
130 \huge
131 \begin{itemize}
132 \let\origitem=\item
133 % Here, the \mystep command is hidden inside \item
134 \renewcommand{\item}{\mystep\origitem}%
135 }
136 {%
137 \end{itemize}
138 }
139
140 Instead of displaying incrementally, we can just `flip through' some items by highlighting them:
141
142 % Note that we use the starred version of \liststepwise so that the first item is highlighted on the first slide
143 % produced by \liststepwise.
144 %
145 \liststepwise*
146 {%
147 \begin{stepitemize}
148 \item Item 1
149 \item Item 2
150 \item Item 3
151 \end{stepitemize}
152 }
153
154 \pause
155
156 % The following example demonstrates highlighting inside a paragraph using \highlighttext. By redefining \activatestep
157 % to \highlighttext, the argument of every \step will be highlighted when the \step is activated for the first
158 % time. Note that highlighting doesn't influence line breaks because \highlighttext is implemented using the soul
159 % package.
160 %
161 % Again, we define \hidestepcontents to display its argument, so that the complete text is visible from the outset.
162
163 \stepwise[\let\activatestep=\highlighttext\let\hidestepcontents=\displayidentical]
164 {%
165 \vspace*{\fill}
166 \begin{minipage}{\linewidth}
167 \LARGE
168 \step{Inside} a paragraph, we can \step{highlight} text \step{without influencing} \step{line breaks}.
169 \end{minipage}
170 \vspace*{\fill}
171 }
172 \newslide
173 \end{slide}
174 \end{document}
175 \endinput
176 %%
177 %% End of file `hilitexample.tex'.