summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/clicks/clicks.dtx
blob: 86e71fc74619895b281d2c298ca339a578353a14 (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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
% \iffalse meta-comment
% (The MIT License)
%
% Copyright (c) 2021-2024 Yegor Bugayenko
%
% Permission is hereby granted, free of charge, to any person obtaining a copy
% of this software and associated documentation files (the 'Software'), to deal
% in the Software without restriction, including without limitation the rights
% to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
% copies of the Software, and to permit persons to whom the Software is
% furnished to do so, subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in all
% copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
% SOFTWARE.
% \fi

% \CheckSum{0}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}

% \GetFileInfo{clicks.dtx}
% \DoNotIndex{\endgroup,\begingroup,\let,\else,\fi,\newcommand,\newenvironment}

% \iffalse
%<*driver>
\ProvidesFile{clicks.dtx}
%</driver>
%<package>\NeedsTeXFormat{LaTeX2e}
%<package>\ProvidesPackage{clicks}
%<*package>
[2024/12/20 0.4.2 Slide Deck Animation]
%</package>
%<*driver>
\documentclass{ltxdoc}
\usepackage[tt=false, type1=true]{libertine}
\usepackage{clicks}
\usepackage{href-ul}
\PageIndex
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
	\DocInput{clicks.dtx}
	\PrintChanges
	\PrintIndex
\end{document}
%</driver>
% \fi

% \title{|clicks|: \LaTeX{} Package \\ for Slide Deck Animation\thanks{The sources are in GitHub at \href{https://github.com/yegor256/clicks}{yegor256/clicks}}}
% \author{Yegor Bugayenko \\ \texttt{yegor256@gmail.com}}
% \date{\filedate, \fileversion}
%
% \maketitle
%
% \section{Introduction}
%
% This package helps simulate animation in PDF documents. You put
% some content on the page, then you ``click'' and the pages ends,
% while the content gets copied to the next page. There, you add new
% content. In the full-screen presentation mode this will look
% like animation, similar to what you can get with MS PowerPoint:
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
\documentclass{article}
\usepackage{clicks}
\begin{document}
\print{Here is your wedding plan:}\click
\print{1. Buy a ring}\click
\print{2. Propose}\click
\print{3. Get married}\flush
\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi

% You can make it shorter, with the help of
% |\plick| and |\plush| commands:
%\iffalse
%<*verb>
%\fi
\begin{verbatim}
\documentclass{article}
\usepackage{clicks}
\begin{document}
\plick[2]{Here is your wedding plan:}
\plick[3]{1. Buy a ring}
\plick[5]{2. Propose}
\plush[1]{3. Get married}
\end{document}
\end{verbatim}
%\iffalse
%</verb>
%\fi

% The optional parameters at |\plick| and |\plush|
% are the minutes: how long you are planning to stay at this animation.
% The minutes are accumulated in the |minutes| counter, which
% you can show, for example, at your header. This will help you track
% time during the presentation. The commands
% |\click| and |\flush| also have the
% same optional arguments.

% \section{Package Options}

% \begin{macro}{static}
% If you need to render the document without animation, just
% use the |static| package option.
% \end{macro}

% \StopEventually{}

% \section{Implementation}

% \changes{v0.1.0}{2021/09/13}{Initial version}

% First, we parse package options:
%    \begin{macrocode}
\RequirePackage{pgfopts}
\pgfkeys{
  /clicks/.cd,
  static/.store in=\clicks@static,
}
\ProcessPgfPackageOptions{/clicks}
%    \end{macrocode}

% Then, we define a few supplementary commands:
%    \begin{macrocode}
\makeatletter
\newcommand*\clicks@body{}
\newcommand\clicks@flush{%
  \clicks@body\vspace*{0pt}\newpage%
}
\makeatother
%    \end{macrocode}

% Then, we declare a counter of minutes:
%    \begin{macrocode}
\newcounter{minutes}
%    \end{macrocode}

% \begin{macro}{\print}
% Then, we define |\print| command:
%    \begin{macrocode}
\RequirePackage{etoolbox}
\makeatletter
\newcommand\print[1]{%
  \def\param{#1}%
  \ifx\param\empty\else%
    \gappto\clicks@body{{#1\par}}%
  \fi%
}
\makeatother
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\flush}
% Then, we define |\flush| command:
%    \begin{macrocode}
\makeatletter
\newcommand\flush[1][1]{%
  \ifx\clicks@body\empty\else%
    \clicks@flush%
    \renewcommand*\clicks@body{}%
  \fi%
  \ifdefined\clicks@static\else%
    \addtocounter{minutes}{#1}%
  \fi%
}
\makeatother
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\click}
% Then, we define |\click| command:
%    \begin{macrocode}
\makeatletter
\newcommand\click[1][0]{%
  \ifdefined\clicks@static\else%
    \addtocounter{minutes}{#1}%
  \fi%
  \ifdefined\clicks@static\else%
    \clicks@flush%
  \fi%
}
\makeatother
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\plush}
% Then, we define |\plush| command:
%    \begin{macrocode}
\newcommand\plush[2][1]{%
  \print{#2}%
  \flush[#1]%
}
%    \end{macrocode}
% \end{macro}

% \begin{macro}{\plick}
% Then, we define |\plick| command:
%    \begin{macrocode}
\newcommand\plick[2][1]{%
  \print{#2}%
  \click[#1]%
}
%    \end{macrocode}
% \end{macro}

% \Finale

%\clearpage
%
%\PrintChanges
%\clearpage
%\PrintIndex