summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/texpower/hilitexample.tex
blob: 2cd8be37ed5bbdcad54de5614be8f76383c98078 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
%%
%% This is file `hilitexample.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% texpower-doc.dtx  (with options: `hilitexample,hilitexample-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{hilitexample.tex}%
      [2004/07/27 TeXPower example file]
%-----------------------------------------------------------------------------------------------------------------
% File: hilitexample.tex
%
% Highlighting example 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 hilitexample
%
% afterwards processing the resulting ps file with
%
% distill hilitexample.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 27, 2000: Some small changes in preparation of the update to TeXpower v0.0.7.
%                      Added demo for \highlighttext.
%                      Itemize demo now checks whether color is activated.
%
% v0.0.3 May 26, 2000: Added an example for how to make the text in a paragraph `stand out' from the background.
%
% v0.0.4 Jun 07, 2000: Now using \hidedimmed and \highlightenhanced.
%
% v0.0.5 Jul 19, 2000: stepitemize example rewritten for TeXPower v0.0.8g.
%

%-----------------------------------------------------------------------------------------------------------------
% Use slifonts.

\RequirePackage{tpslifonts}

% Input the generic preamble.

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

% The package soul is needed for \highlighttext to work.

\usepackage{soul}

%-----------------------------------------------------------------------------------------------------------------
% Finally, everything is set up. Here we go...
%
\begin{document}
\begin{slide}
%-----------------------------------------------------------------------------------------------------------------
%
\makeslidetitle{\macroname{stepwise} Example: Highlighting Text}\label{Sec:Exhl}
% The default for \step's which are not yet `active' is to be `invisible'. In preceding examples, we have redefined
% internal macros like \hidestepcontents or \activatestep to achieve special `highlighting' effects.
% Here, we demonstrate how make text `stand out' from the background incrementally without having it appear from thin
% air.

% The first example demonstrates how to make \step its argument `stand out' instead of making it appear `out of
% nowhere'.

\makeatletter
\ifthenelse{\boolean{TPcolor}}% Can we use colors?
{% Yes. In this case \step should change colors from `dimmed' to `active'.

  % The command \hidedimmed switches colors to `dimmed', the command \highlightenhanced switches colors to `enhanced'.
  \liststepwise[\let\hidestepcontents=\hidedimmed\let\activatestep=\highlightenhanced]
  {%
    \vspace*{\fill}
    \begin{quote}
      \Large%
      \step{Instead of making things appear out of `thin air',} \step{we can also make them appear `out of the
        background'} \step{by incrementally changing color from \concept{inactive}} \step{to \concept{active}.}
      \step{This also works with \emph{color emphasis}} \step{and \concept{math coloring}: $a=b^2$.}
    \end{quote}
    \vspace*{\fill}\vspace*{\fill}
    }%
  }
{% No. In this case we have to `handwave' using the soul package.
  % Instead of hiding its argument, the new command \myhide just changes the font size (maintaining the overall text
  % length though).
  \def\myhide
  {%
    \leavevmode%
    \SOUL@setup
    \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}%
    \SOUL@%
    }

  \liststepwise[\let\hidestepcontents=\myhide\setcounter{firststep}{0}]
  {%
    \vspace*{\fill}
    \begin{quote}
      \LARGE%
      \step{Instead of making things appear out of `thin air',} \step{we can also make them appear `out of the
        background'} \step{incrementally.}
    \end{quote}
    \vspace*{\fill}\vspace*{\fill}
    }%
  }
\makeatother

\newslide

% Next, it is demonstrated how we can `flip through' an itemize environment by just highlighting the items in turn
% instead of making them appear one by one.
%
% Define a macro \mystep which implements the highlighting effect.
\ifthenelse{\boolean{TPcolor}}% Can we use colors?
{% Yes. In this case highlighting is implemented by switching color.
  \def\mystep% Note that \mystep takes no argument. It just changes the way the next item is displayed.
  {%
    \usecolorset{stwcolors}%             Restore the undimmed colors valid at the beginning of \stepwise.
    \dstep[][\boolean{firstactivation}]% \dstep switches colors. The optional argument makes it appear only once.
    }%
}
{% No. In this case highlighting is implemented by redefining \labelitemi.
  \def\mystep
  {%
    \switch[][\boolean{firstactivation}]% The optional arguments make \switch act only once.
    {\def\labelitemi{\origmath{\gg}}}{\def\labelitemi{\origmath{\cdot}}}%
    }%
  }

% We define a custom itemize environment which automatically adds calls to \mystep:
\newenvironment{stepitemize}
{%
  \huge
  \begin{itemize}
    \let\origitem=\item
    % Here, the \mystep command is hidden inside \item
    \renewcommand{\item}{\mystep\origitem}%
    }
  {%
  \end{itemize}
  }

Instead of displaying incrementally, we can just `flip through' some items by highlighting them:

% Note that we use the starred version of \liststepwise so that the first item is highlighted on the first slide
% produced by \liststepwise.
%
\liststepwise*
{%
  \begin{stepitemize}
  \item Item 1
  \item Item 2
  \item Item 3
  \end{stepitemize}
  }

\pause

% The following example demonstrates highlighting inside a paragraph using \highlighttext. By redefining \activatestep
% to \highlighttext, the argument of every \step will be highlighted when the \step is activated for the first
% time. Note that highlighting doesn't influence line breaks because \highlighttext is implemented using the soul
% package.
%
% Again, we define \hidestepcontents to display its argument, so that the complete text is visible from the outset.

\stepwise[\let\activatestep=\highlighttext\let\hidestepcontents=\displayidentical]
{%
  \vspace*{\fill}
  \begin{minipage}{\linewidth}
    \LARGE
    \step{Inside} a paragraph, we can \step{highlight} text \step{without influencing} \step{line breaks}.
  \end{minipage}
  \vspace*{\fill}
  }
\newslide
\end{slide}
\end{document}
\endinput
%%
%% End of file `hilitexample.tex'.