Debian Codegraph @

texmf-dist/source/latex/clicks/clicks.dtx

raw
1 % \iffalse meta-comment
2 % (The MIT License)
3 %
4 % Copyright (c) 2021-2024 Yegor Bugayenko
5 %
6 % Permission is hereby granted, free of charge, to any person obtaining a copy
7 % of this software and associated documentation files (the 'Software'), to deal
8 % in the Software without restriction, including without limitation the rights
9 % to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 % copies of the Software, and to permit persons to whom the Software is
11 % furnished to do so, subject to the following conditions:
12 %
13 % The above copyright notice and this permission notice shall be included in all
14 % copies or substantial portions of the Software.
15 %
16 % THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 % IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 % FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 % AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 % LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 % OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 % SOFTWARE.
23 % \fi
24
25 % \CheckSum{0}
26 %
27 % \CharacterTable
28 % {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
29 % 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
30 % Digits \0\1\2\3\4\5\6\7\8\9
31 % Exclamation \! Double quote \" Hash (number) \#
32 % Dollar \$ Percent \% Ampersand \&
33 % Acute accent \' Left paren \( Right paren \)
34 % Asterisk \* Plus \+ Comma \,
35 % Minus \- Point \. Solidus \/
36 % Colon \: Semicolon \; Less than \<
37 % Equals \= Greater than \> Question mark \?
38 % Commercial at \@ Left bracket \[ Backslash \\
39 % Right bracket \] Circumflex \^ Underscore \_
40 % Grave accent \` Left brace \{ Vertical bar \|
41 % Right brace \} Tilde \~}
42
43 % \GetFileInfo{clicks.dtx}
44 % \DoNotIndex{\endgroup,\begingroup,\let,\else,\fi,\newcommand,\newenvironment}
45
46 % \iffalse
47 %<*driver>
48 \ProvidesFile{clicks.dtx}
49 %</driver>
50 %<package>\NeedsTeXFormat{LaTeX2e}
51 %<package>\ProvidesPackage{clicks}
52 %<*package>
53 [2024/12/25 0.4.3 Slide Deck Animation]
54 %</package>
55 %<*driver>
56 \documentclass{ltxdoc}
57 \usepackage[tt=false, type1=true]{libertine}
58 \usepackage{clicks}
59 \usepackage{href-ul}
60 \PageIndex
61 \EnableCrossrefs
62 \CodelineIndex
63 \RecordChanges
64 \begin{document}
65 \DocInput{clicks.dtx}
66 \PrintChanges
67 \PrintIndex
68 \end{document}
69 %</driver>
70 % \fi
71
72 % \title{|clicks|: \LaTeX{} Package \\ for Slide Deck Animation\thanks{The sources are in GitHub at \href{https://github.com/yegor256/clicks}{yegor256/clicks}}}
73 % \author{Yegor Bugayenko \\ \texttt{[email protected]}}
74 % \date{\filedate, \fileversion}
75 %
76 % \maketitle
77 %
78 % \section{Introduction}
79 %
80 % This package helps simulate animation in PDF documents. You put
81 % some content on the page, then you ``click'' and the pages ends,
82 % while the content gets copied to the next page. There, you add new
83 % content. In the full-screen presentation mode this will look
84 % like animation, similar to what you can get with MS PowerPoint:
85 %\iffalse
86 %<*verb>
87 %\fi
88 \begin{verbatim}
89 \documentclass{article}
90 \usepackage{clicks}
91 \begin{document}
92 \print{Here is your wedding plan:}\click
93 \print{1. Buy a ring}\click
94 \print{2. Propose}\click
95 \print{3. Get married}\flush
96 \end{document}
97 \end{verbatim}
98 %\iffalse
99 %</verb>
100 %\fi
101
102 % You can make it shorter, with the help of
103 % |\plick| and |\plush| commands:
104 %\iffalse
105 %<*verb>
106 %\fi
107 \begin{verbatim}
108 \documentclass{article}
109 \usepackage{clicks}
110 \begin{document}
111 \plick[2]{Here is your wedding plan:}
112 \plick[3]{1. Buy a ring}
113 \plick[5]{2. Propose}
114 \plush[1]{3. Get married}
115 \end{document}
116 \end{verbatim}
117 %\iffalse
118 %</verb>
119 %\fi
120
121 % The optional parameters at |\plick| and |\plush|
122 % are the minutes: how long you are planning to stay at this animation.
123 % The minutes are accumulated in the |minutes| counter, which
124 % you can show, for example, at your header. This will help you track
125 % time during the presentation. The commands
126 % |\click| and |\flush| also have the
127 % same optional arguments.
128
129 % \section{Package Options}
130
131 % \begin{macro}{static}
132 % If you need to render the document without animation, just
133 % use the |static| package option.
134 % \end{macro}
135
136 % \StopEventually{}
137
138 % \section{Implementation}
139
140 % \changes{v0.1.0}{2021/09/13}{Initial version}
141
142 % First, we parse package options:
143 % \begin{macrocode}
144 \RequirePackage{pgfopts}
145 \pgfkeys{
146 /clicks/.cd,
147 static/.store in=\clicks@static,
148 }
149 \ProcessPgfPackageOptions{/clicks}
150 % \end{macrocode}
151
152 % Then, we define a few supplementary commands:
153 % \begin{macrocode}
154 \makeatletter
155 \newcommand*\clicks@body{}
156 \newcommand\clicks@flush{%
157 \clicks@body\vspace*{0pt}\newpage%
158 }
159 \makeatother
160 % \end{macrocode}
161
162 % Then, we declare a counter of minutes:
163 % \begin{macrocode}
164 \newcounter{minutes}
165 % \end{macrocode}
166
167 % \begin{macro}{\print}
168 % Then, we define |\print| command:
169 % \begin{macrocode}
170 \RequirePackage{etoolbox}
171 \makeatletter
172 \newcommand\print[1]{%
173 \gappto\clicks@body{{#1}}%
174 \def\param{#1}%
175 \ifx\param\empty\else%
176 \gappto\clicks@body{{\par}}%
177 \fi%
178 }
179 \makeatother
180 % \end{macrocode}
181 % \end{macro}
182
183 % \begin{macro}{\flush}
184 % Then, we define |\flush| command:
185 % \begin{macrocode}
186 \makeatletter
187 \newcommand\flush[1][1]{%
188 \ifx\clicks@body\empty\else%
189 \clicks@flush%
190 \renewcommand*\clicks@body{}%
191 \fi%
192 \ifdefined\clicks@static\else%
193 \addtocounter{minutes}{#1}%
194 \fi%
195 }
196 \makeatother
197 % \end{macrocode}
198 % \end{macro}
199
200 % \begin{macro}{\click}
201 % Then, we define |\click| command:
202 % \begin{macrocode}
203 \makeatletter
204 \newcommand\click[1][0]{%
205 \ifdefined\clicks@static\else%
206 \addtocounter{minutes}{#1}%
207 \fi%
208 \ifdefined\clicks@static\else%
209 \clicks@flush%
210 \fi%
211 }
212 \makeatother
213 % \end{macrocode}
214 % \end{macro}
215
216 % \begin{macro}{\plush}
217 % Then, we define |\plush| command:
218 % \begin{macrocode}
219 \newcommand\plush[2][1]{%
220 \print{#2}%
221 \flush[#1]%
222 }
223 % \end{macrocode}
224 % \end{macro}
225
226 % \begin{macro}{\plick}
227 % Then, we define |\plick| command:
228 % \begin{macrocode}
229 \newcommand\plick[2][1]{%
230 \print{#2}%
231 \click[#1]%
232 }
233 % \end{macrocode}
234 % \end{macro}
235
236 % \Finale
237
238 %\clearpage
239 %
240 %\PrintChanges
241 %\clearpage
242 %\PrintIndex