| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% File: ltx-talk-frame.dtx Copyright (C) 2023-2026 Joseph Wright |
| 4 |
% |
| 5 |
% It may be distributed and/or modified under the conditions of the |
| 6 |
% LaTeX Project Public License (LPPL), either version 1.3c of this |
| 7 |
% license or (at your option) any later version. The latest version |
| 8 |
% of this license is in the file |
| 9 |
% |
| 10 |
% https://www.latex-project.org/lppl.txt |
| 11 |
% |
| 12 |
% This file is part of the "ltx-talk bundle" (The Work in LPPL) |
| 13 |
% and all files in that bundle must be distributed together. |
| 14 |
% |
| 15 |
% The released version of this bundle is available from CTAN. |
| 16 |
% |
| 17 |
% ----------------------------------------------------------------------- |
| 18 |
% |
| 19 |
% The development version of the bundle can be found at |
| 20 |
% |
| 21 |
% https://github.com/josephwright/ltx-talk |
| 22 |
% |
| 23 |
% for those people who are interested. |
| 24 |
% |
| 25 |
% ----------------------------------------------------------------------- |
| 26 |
% |
| 27 |
%<*driver> |
| 28 |
\documentclass{l3doc} |
| 29 |
% Additional commands needed in this source |
| 30 |
\NewDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}} |
| 31 |
\begin{document} |
| 32 |
\DocInput{\jobname.dtx} |
| 33 |
\end{document} |
| 34 |
%</driver> |
| 35 |
% \fi |
| 36 |
% |
| 37 |
% ^^A As we are dealing with a class, this has to be done manually |
| 38 |
% \def\filedate{2026-04-30} |
| 39 |
% \def\fileversion{v0.5.0} |
| 40 |
% |
| 41 |
% \title{^^A |
| 42 |
% \pkg{ltx-talk-frame} -- The structure of frames^^A |
| 43 |
% \thanks{This file describes \fileversion, |
| 44 |
% last revised \filedate.}^^A |
| 45 |
% } |
| 46 |
% |
| 47 |
% \author{^^A |
| 48 |
% Joseph Wright^^A |
| 49 |
% \thanks{^^A |
| 50 |
% E-mail: \email{[email protected]}^^A |
| 51 |
% }^^A |
| 52 |
% } |
| 53 |
% |
| 54 |
% \date{Released \filedate} |
| 55 |
% |
| 56 |
% \maketitle |
| 57 |
% |
| 58 |
% \begin{documentation} |
| 59 |
% |
| 60 |
% \end{documentation} |
| 61 |
% |
| 62 |
% \begin{implementation} |
| 63 |
% |
| 64 |
% \section{\pkg{ltx-talk-frame} implementation} |
| 65 |
% |
| 66 |
% Start the \pkg{DocStrip} guards. |
| 67 |
% \begin{macrocode} |
| 68 |
%<*class> |
| 69 |
% \end{macrocode} |
| 70 |
% |
| 71 |
% Identify the internal prefix. |
| 72 |
% \begin{macrocode} |
| 73 |
%<@@=talk> |
| 74 |
% \end{macrocode} |
| 75 |
% |
| 76 |
% \subsection{Slides in frames} |
| 77 |
% |
| 78 |
% Currently, each slide in a frame will produce a separate page in the output |
| 79 |
% (unless the slide is suppressed entirely). Material is then hidden on some |
| 80 |
% pages by using opacity. An alternative approach would be to use Optional |
| 81 |
% Content Groups to have a similar effect on one page per frame. However, |
| 82 |
% whilst that would be relatively clear for appear/disappear effects, it would |
| 83 |
% be much less straight-forward for partial transparency, \foreign{etc.}, plus |
| 84 |
% would depend more heavily on viewer support. At a future stage we may wish to |
| 85 |
% revisit this. |
| 86 |
% |
| 87 |
% \begin{variable}{\g_@@_slide_continue_bool, \l_@@_slide_continue_bool} |
| 88 |
% Tracks whether the frame continues after the current slide. |
| 89 |
% \begin{macrocode} |
| 90 |
\bool_new:N \g_@@_slide_continue_bool |
| 91 |
\bool_new:N \l_@@_slide_continue_bool |
| 92 |
% \end{macrocode} |
| 93 |
% \end{variable} |
| 94 |
% |
| 95 |
% \begin{variable}{\l_@@_slide_box} |
| 96 |
% \begin{macrocode} |
| 97 |
\box_new:N \l_@@_slide_box |
| 98 |
% \end{macrocode} |
| 99 |
% \end{variable} |
| 100 |
% |
| 101 |
% \begin{variable}{\g_@@_slide_int, \c@slide, \theslide} |
| 102 |
% The slide number inside the current frame: needed to know which overlays |
| 103 |
% are active. We also provide \LaTeX{} counter-style access. |
| 104 |
% \begin{macrocode} |
| 105 |
\int_new:N \g_@@_slide_int |
| 106 |
\cs_new_eq:NN \c@slide \g_@@_slide_int |
| 107 |
\cs_new:Npn \theslide { \@arabic \c@slide } |
| 108 |
% \end{macrocode} |
| 109 |
% \end{variable} |
| 110 |
% |
| 111 |
% Required to know which is the last slide in a frame for tagging. |
| 112 |
% \begin{macrocode} |
| 113 |
\property_new:nnnn { slides } { now } { 1 } { \int_use:N \g_@@_slide_int } |
| 114 |
% \end{macrocode} |
| 115 |
% |
| 116 |
% \begin{macro}{\@@_slide:nn} |
| 117 |
% \begin{macro}{\@@_slide_aux:n} |
| 118 |
% Each slide is parsed inside simple set up, the only complexity being if we |
| 119 |
% are handling fragile frames. There, all \cs{obeyedline} in the grabbed |
| 120 |
% tokens need to be turned back into |^^M| before rescanning: this ensures |
| 121 |
% that any verbatim grabbing in the frame still works. The strange business |
| 122 |
% with setting the continuation boolean is needed as otherwise we get an |
| 123 |
% infinite loop if there is an overlay specification for the frame itself. |
| 124 |
% Tagging should not of itself force slide continuation, so the global |
| 125 |
% boolean is reset for the tagged slide. |
| 126 |
% \begin{macrocode} |
| 127 |
\cs_new_protected:Npn \@@_slide:nn #1#2 |
| 128 |
{ |
| 129 |
\group_begin: |
| 130 |
\tl_set:Ne \l_@@_tmp_tl |
| 131 |
{ |
| 132 |
\property_ref:ee { frame . \int_use:N \g_@@_frame_int } |
| 133 |
{ slides } |
| 134 |
} |
| 135 |
\str_if_eq:VnTF \l_@@_frame_tagging_str { n } |
| 136 |
{ \str_set:NV \l_@@_frame_tagging_str \l_@@_tmp_tl } |
| 137 |
{ |
| 138 |
\str_replace_all:NnV \l_@@_frame_tagging_str { ,n } |
| 139 |
\l_@@_tmp_tl |
| 140 |
\str_replace_all:NnV \l_@@_frame_tagging_str { ,~n } |
| 141 |
\l_@@_tmp_tl |
| 142 |
} |
| 143 |
\int_gzero:N \g_@@_slide_int |
| 144 |
\RenewCommandCopy \frame \@@_latexe_frame:n |
| 145 |
\bool_do_while:Nn \g_@@_slide_continue_bool |
| 146 |
{ |
| 147 |
\int_gincr:N \g_@@_slide_int |
| 148 |
\bool_gset_false:N \g_@@_slide_continue_bool |
| 149 |
\@@_if_overlay:nT {#1} |
| 150 |
{ |
| 151 |
\@@_slide_begin: |
| 152 |
\bool_set_eq:NN \l_@@_slide_continue_bool |
| 153 |
\g_@@_slide_continue_bool |
| 154 |
\@@_if_overlay:VTF \l_@@_frame_tagging_str |
| 155 |
{ |
| 156 |
\bool_gset_eq:NN \g_@@_slide_continue_bool |
| 157 |
\l_@@_slide_continue_bool |
| 158 |
\@@_frame_tag:n |
| 159 |
} |
| 160 |
{ |
| 161 |
\bool_gset_eq:NN \g_@@_slide_continue_bool |
| 162 |
\l_@@_slide_continue_bool |
| 163 |
\@@_frame_notag:n |
| 164 |
} |
| 165 |
{ |
| 166 |
\bool_if:NTF \l_@@_frame_verb_bool |
| 167 |
{ \@@_slide_aux:n } |
| 168 |
{ \use:n } |
| 169 |
{#2} |
| 170 |
} |
| 171 |
\@@_slide_end: |
| 172 |
} |
| 173 |
} |
| 174 |
\property_record:ee { frame . \int_use:N \g_@@_frame_int } |
| 175 |
{ slides } |
| 176 |
\group_end: |
| 177 |
} |
| 178 |
\cs_new_protected:Npn \@@_slide_aux:n #1 |
| 179 |
{ |
| 180 |
\group_begin: |
| 181 |
\cs_set:Npn \obeyedline { ^^J } |
| 182 |
\use:e |
| 183 |
{ |
| 184 |
\group_end: |
| 185 |
\tl_retokenize:n {#1} |
| 186 |
} |
| 187 |
} |
| 188 |
% \end{macrocode} |
| 189 |
% \end{macro} |
| 190 |
% \end{macro} |
| 191 |
% |
| 192 |
% The very last frame will not be recorded by the above, so we have to add to |
| 193 |
% the hook at the very end of the run. |
| 194 |
% \begin{macrocode} |
| 195 |
\AddToHook { enddocument / afterlastpage } |
| 196 |
{ |
| 197 |
\property_record:ee { frame . \int_use:N \g_@@_frame_int } |
| 198 |
{ slides } |
| 199 |
} |
| 200 |
% \end{macrocode} |
| 201 |
% |
| 202 |
% \begin{variable}{\g_@@_frame_struct_int} |
| 203 |
% The tagging structure number for the slide: needed by the content placed |
| 204 |
% outside of the current box (for example the frame title). |
| 205 |
% \begin{macrocode} |
| 206 |
\int_new:N \g_@@_frame_struct_int |
| 207 |
% \end{macrocode} |
| 208 |
% \end{variable} |
| 209 |
% |
| 210 |
% \begin{macro}{\@@_slide_begin:, \@@_slide_end:} |
| 211 |
% \begin{macrocode} |
| 212 |
\cs_new_protected:Npn \@@_slide_begin: |
| 213 |
{ |
| 214 |
\int_gzero:N \g_@@_pauses_int |
| 215 |
\tl_gclear:N \g_@@_frame_title_tl |
| 216 |
\tl_gclear:N \g_@@_frame_subtitle_tl |
| 217 |
\box_gclear:N \g_@@_footnote_box |
| 218 |
\@@_cnt_save: |
| 219 |
\vbox_set:Nw \l_@@_slide_box |
| 220 |
\tl_gclear:N \g_@@_onslide_tl |
| 221 |
} |
| 222 |
\cs_new_protected:Npn \@@_slide_end: |
| 223 |
{ |
| 224 |
\tl_use:N \g_@@_onslide_tl |
| 225 |
\vbox_set_end: |
| 226 |
\bool_if:NT \g_@@_slide_continue_bool |
| 227 |
{ \@@_cnt_restore: } |
| 228 |
\vbox_to_ht:nn { \textheight } |
| 229 |
{ |
| 230 |
\use:c { @@_slide_align_ \l_@@_frame_alignment_tl :n } |
| 231 |
{ \vbox_unpack_drop:N \l_@@_slide_box } |
| 232 |
\box_if_empty:NF \g_@@_footnote_box |
| 233 |
{ |
| 234 |
\footnoterule |
| 235 |
\vbox_unpack_drop:N \g_@@_footnote_box |
| 236 |
} |
| 237 |
} |
| 238 |
\clearpage |
| 239 |
} |
| 240 |
% \end{macrocode} |
| 241 |
% \end{macro} |
| 242 |
% |
| 243 |
% \begin{macro} |
| 244 |
% { |
| 245 |
% \@@_slide_align_bottom:n , |
| 246 |
% \@@_slide_align_center:n , |
| 247 |
% \@@_slide_align_stretch:n , |
| 248 |
% \@@_slide_align_top:n |
| 249 |
% } |
| 250 |
% A pretty standard abstraction: we make sure there are always two skips. |
| 251 |
% \begin{macrocode} |
| 252 |
\cs_new_protected:Npn \@@_slide_align_bottom:n #1 |
| 253 |
{ |
| 254 |
\skip_vertical:n { 0pt~plus~1fil } |
| 255 |
#1 |
| 256 |
\skip_vertical:n { 0pt } |
| 257 |
} |
| 258 |
\cs_new_protected:Npn \@@_slide_align_center:n #1 |
| 259 |
{ |
| 260 |
\skip_vertical:n { 0pt~plus~0.5fil } |
| 261 |
#1 |
| 262 |
\skip_vertical:n { 0pt~plus~0.5fil } |
| 263 |
} |
| 264 |
\cs_new_protected:Npn \@@_slide_align_stretch:n #1 |
| 265 |
{ |
| 266 |
\skip_vertical:n { 0pt } |
| 267 |
#1 |
| 268 |
\skip_vertical:n { 0pt } |
| 269 |
} |
| 270 |
\cs_new_protected:Npn \@@_slide_align_top:n #1 |
| 271 |
{ |
| 272 |
\skip_vertical:n { 0pt } |
| 273 |
#1 |
| 274 |
\skip_vertical:n { 0pt~plus~1fil } |
| 275 |
} |
| 276 |
% \end{macrocode} |
| 277 |
% \end{macro} |
| 278 |
% |
| 279 |
% \subsection{Counters} |
| 280 |
% |
| 281 |
% \begin{variable}{\g_@@_cnt_reset_seq} |
| 282 |
% As \cs{stepcounter}, \foreign{etc}., will increment at each overlay, there |
| 283 |
% is a need to save and reset. The list will be finalized at the end of the |
| 284 |
% preamble, so the data storage is created at that point. The starting point |
| 285 |
% is counters created before the class is loaded (other than those for lists, |
| 286 |
% which reset \enquote{naturally}). Other cases are handled by adding to |
| 287 |
% \cs{newcounter}. |
| 288 |
% \begin{macrocode} |
| 289 |
\seq_new:N \g_@@_cnt_reset_seq |
| 290 |
\seq_gset_from_clist:Nn \g_@@_cnt_reset_seq |
| 291 |
{ |
| 292 |
equation , |
| 293 |
footnote , |
| 294 |
mpfootnote , |
| 295 |
parentequation |
| 296 |
} |
| 297 |
\seq_map_inline:Nn \g_@@_cnt_reset_seq |
| 298 |
{ |
| 299 |
\int_new:c { g_@@_saved_ #1 _int } |
| 300 |
\int_gset_eq:cc { g_@@_saved_ #1 _int } { c@ #1 } |
| 301 |
} |
| 302 |
% \end{macrocode} |
| 303 |
% \end{variable} |
| 304 |
% |
| 305 |
% \begin{macro}{\@@_cnt_save:, \@@_cnt_restore:} |
| 306 |
% A simple save-and-restore pair. |
| 307 |
% \begin{macrocode} |
| 308 |
\cs_new_protected:Npn \@@_cnt_save: |
| 309 |
{ |
| 310 |
\seq_map_inline:Nn \g_@@_cnt_reset_seq |
| 311 |
{ \int_gset_eq:cc { g_@@_saved_ ##1 _int } { c@ ##1 } } |
| 312 |
} |
| 313 |
\cs_new_protected:Npn \@@_cnt_restore: |
| 314 |
{ |
| 315 |
\seq_map_inline:Nn \g_@@_cnt_reset_seq |
| 316 |
{ \int_gset_eq:cc { c@ ##1 } { g_@@_saved_ ##1 _int } } |
| 317 |
} |
| 318 |
% \end{macrocode} |
| 319 |
% \end{macro} |
| 320 |
% |
| 321 |
% \begin{macro}{\@definecounter, \std@definecounter} |
| 322 |
% Track all counters for resetting. |
| 323 |
% \begin{macrocode} |
| 324 |
\cs_new_eq:NN \std@definecounter \@definecounter |
| 325 |
\cs_gset_protected:Npn \@definecounter #1 |
| 326 |
{ |
| 327 |
\std@definecounter {#1} |
| 328 |
\int_new:c { g_@@_saved_ #1 _int } |
| 329 |
\seq_gput_right:Nn \g_@@_cnt_reset_seq {#1} |
| 330 |
} |
| 331 |
% \end{macrocode} |
| 332 |
% \end{macro} |
| 333 |
% |
| 334 |
% \subsection{Frame options} |
| 335 |
% |
| 336 |
% \begin{variable}{\l_@@_frame_alignment_tl} |
| 337 |
% \begin{macrocode} |
| 338 |
\tl_new:N \l_@@_frame_alignment_tl |
| 339 |
% \end{macrocode} |
| 340 |
% \end{variable} |
| 341 |
% |
| 342 |
% \begin{variable} |
| 343 |
% { |
| 344 |
% \l_@@_action_spec_str , |
| 345 |
% \l_@@_frame_name_str , |
| 346 |
% \l_@@_frame_tagging_str |
| 347 |
% } |
| 348 |
% \begin{macrocode} |
| 349 |
\keys_define:nn { talk / frame } |
| 350 |
{ |
| 351 |
action-spec .str_set:N = |
| 352 |
\l_@@_action_spec_str , |
| 353 |
label .meta:n = |
| 354 |
{ name = {#1} } , |
| 355 |
name .str_set:N = |
| 356 |
\l_@@_frame_name_str , |
| 357 |
tag-slides .str_set:N = |
| 358 |
\l_@@_frame_tagging_str , |
| 359 |
vertical-alignment .choices:nn = |
| 360 |
{ bottom , center , stretch , top } |
| 361 |
{ |
| 362 |
\tl_set_eq:NN \l_@@_frame_alignment_tl |
| 363 |
\l_keys_value_tl |
| 364 |
} |
| 365 |
} |
| 366 |
\keys_set:nn { talk / frame } |
| 367 |
{ |
| 368 |
action-spec = , |
| 369 |
name = , |
| 370 |
tag-slides = n , |
| 371 |
vertical-alignment = center |
| 372 |
} |
| 373 |
% \end{macrocode} |
| 374 |
% \end{variable} |
| 375 |
% |
| 376 |
% \subsection{Tagging for headers} |
| 377 |
% |
| 378 |
% \begin{macro}{\@@_header_tag_begin:n, \@@_header_tag_begin:e} |
| 379 |
% \begin{macro}{\@@_header_tag_end:} |
| 380 |
% Generalized control for inserting material into the header area (which is |
| 381 |
% otherwise outside of tagging). |
| 382 |
% \begin{macrocode} |
| 383 |
\cs_new_protected:Npn \@@_header_tag_begin:n #1 |
| 384 |
{ |
| 385 |
\tag_resume:n { header } |
| 386 |
\tag_mc_end: |
| 387 |
\tag_struct_begin:n {#1} |
| 388 |
\tag_mc_begin:n { } |
| 389 |
} |
| 390 |
\cs_generate_variant:Nn \@@_header_tag_begin:n { e } |
| 391 |
\cs_new_protected:Npn \@@_header_tag_end: |
| 392 |
{ |
| 393 |
\tag_mc_end: |
| 394 |
\tag_struct_end: |
| 395 |
\tag_mc_begin:n { artifact } |
| 396 |
\tag_suspend:n { header } |
| 397 |
} |
| 398 |
% \end{macrocode} |
| 399 |
% \end{macro} |
| 400 |
% \end{macro} |
| 401 |
% |
| 402 |
% \subsection{Wallpaper} |
| 403 |
% |
| 404 |
% \begin{variable} |
| 405 |
% { |
| 406 |
% \l_@@_footelem_left_skip , |
| 407 |
% \l_@@_footelem_right_skip , |
| 408 |
% \l_@@_footelem_color_tl , |
| 409 |
% \l_@@_footelem_font_tl |
| 410 |
% } |
| 411 |
% \begin{macrocode} |
| 412 |
\NewTemplateType { footer-element } { 1 } |
| 413 |
\DeclareTemplateInterface { footer-element } { talk } { 1 } |
| 414 |
{ |
| 415 |
color : tokenlist , |
| 416 |
font : tokenlist = , |
| 417 |
left-hspace : length = 0em , |
| 418 |
right-hspace : length = 0em |
| 419 |
} |
| 420 |
\DeclareTemplateCode { footer-element } { talk } { 1 } |
| 421 |
{ |
| 422 |
color = \l_@@_footelem_color_tl , |
| 423 |
font = \l_@@_footelem_font_tl , |
| 424 |
left-hspace = \l_@@_footelem_left_skip , |
| 425 |
right-hspace = \l_@@_footelem_right_skip |
| 426 |
} |
| 427 |
{ |
| 428 |
\tl_if_empty:nF {#1} |
| 429 |
{ |
| 430 |
\hspace { \l_@@_footelem_left_skip } |
| 431 |
\hbox:n |
| 432 |
{ |
| 433 |
\tl_if_empty:NF \l_@@_footelem_color_tl |
| 434 |
{ \color_select:V \l_@@_footelem_color_tl } |
| 435 |
\l_@@_footelem_font_tl |
| 436 |
#1 |
| 437 |
} |
| 438 |
\hspace { \l_@@_footelem_right_skip } |
| 439 |
} |
| 440 |
} |
| 441 |
\DeclareInstance { footer-element } { date } { talk } { } |
| 442 |
\DeclareInstance { footer-element } { author } { talk } { } |
| 443 |
\DeclareInstance { footer-element } { title } { talk } { } |
| 444 |
\DeclareInstance { footer-element } { subtitle } { talk } { } |
| 445 |
\DeclareInstance { footer-element } { institute } { talk } { } |
| 446 |
\DeclareInstance { footer-element } { framenumber } { talk } { } |
| 447 |
\DeclareInstance { footer-element } { totalframes } { talk } { } |
| 448 |
% \end{macrocode} |
| 449 |
% \end{variable} |
| 450 |
% |
| 451 |
% \begin{variable} |
| 452 |
% { |
| 453 |
% \l_@@_header_bg_tl , |
| 454 |
% \l_@@_header_fg_tl , |
| 455 |
% \l_@@_header_font_tl , |
| 456 |
% \l_@@_header_ht_dim , |
| 457 |
% \l_@@_header_left_skip , |
| 458 |
% \l_@@_header_frametitle_bool , |
| 459 |
% \l_@@_header_right_skip |
| 460 |
% } |
| 461 |
% Templates for the header area. The background always covers the full width, |
| 462 |
% but the text area may be narrower. The setup here aims to avoid repeated |
| 463 |
% kerns but also dealing with complex conditionals, hence we always move to |
| 464 |
% the edge of the paper first then adjust as required. |
| 465 |
% \begin{macrocode} |
| 466 |
\NewTemplateType { header } { 0 } |
| 467 |
\DeclareTemplateInterface { header } { talk } { 0 } |
| 468 |
{ |
| 469 |
background-color : tokenlist, |
| 470 |
color : tokenlist = structure , |
| 471 |
font : tokenlist = \normalfont , |
| 472 |
height : length = \Gm@tmargin + \headsep , |
| 473 |
left-hspace : skip = \Gm@lmargin , |
| 474 |
print-frame-title : boolean = true , |
| 475 |
right-hspace : skip = \Gm@rmargin |
| 476 |
} |
| 477 |
\DeclareTemplateCode { header } { talk } { 0 } |
| 478 |
{ |
| 479 |
background-color = \l_@@_header_bg_tl , |
| 480 |
color = \l_@@_header_fg_tl , |
| 481 |
font = \l_@@_header_font_tl , |
| 482 |
height = \l_@@_header_ht_dim , |
| 483 |
left-hspace = \l_@@_header_left_skip , |
| 484 |
print-frame-title = \l_@@_header_frametitle_bool , |
| 485 |
right-hspace = \l_@@_header_right_skip |
| 486 |
} |
| 487 |
{ |
| 488 |
\noindent |
| 489 |
\@@_wallpaper_hrule:Nnn |
| 490 |
\l_@@_header_bg_tl |
| 491 |
{ \l_@@_header_ht_dim - \headsep } |
| 492 |
{ \headsep } |
| 493 |
\skip_horizontal:n { \l_@@_header_left_skip } |
| 494 |
\group_begin: |
| 495 |
\tl_if_empty:NF \l_@@_header_fg_tl |
| 496 |
{ \color_select:V \l_@@_header_fg_tl } |
| 497 |
\l_@@_header_font_tl |
| 498 |
\bool_if:NT \l_@@_header_frametitle_bool |
| 499 |
{ |
| 500 |
\ExpandArgs { nnV } |
| 501 |
\UseInstance { frametitle } { header } |
| 502 |
\g_@@_frame_title_tl |
| 503 |
} |
| 504 |
\group_end: |
| 505 |
} |
| 506 |
\DeclareInstance { header } { std } { talk } { } |
| 507 |
\AddToHook { begindocument } |
| 508 |
{ |
| 509 |
\DeclareInstanceCopy { header } { wallpaper } { std } |
| 510 |
\EditInstance { header } { wallpaper } |
| 511 |
{ print-frame-title = false } |
| 512 |
} |
| 513 |
% \end{macrocode} |
| 514 |
% \end{variable} |
| 515 |
% \begin{variable} |
| 516 |
% { |
| 517 |
% \l_@@_footer_bg_tl , |
| 518 |
% \l_@@_footer_fg_tl , |
| 519 |
% \l_@@_footer_font_tl , |
| 520 |
% \l_@@_footer_order_clist , |
| 521 |
% \l_@@_footer_sep_tl , |
| 522 |
% \l_@@_footer_font_tl , |
| 523 |
% \l_@@_footer_left_skip , |
| 524 |
% \l_@@_footer_right_skip |
| 525 |
% } |
| 526 |
% Templates for the footer area. Again the margins are handled in stages: |
| 527 |
% here we do have a box for the content so the right skip is used, and we |
| 528 |
% avoid an overfull box by including consideration of the right margin of the |
| 529 |
% page layout. |
| 530 |
% \begin{macrocode} |
| 531 |
\NewTemplateType { footer } { 0 } |
| 532 |
\DeclareTemplateInterface { footer } { talk } { 0 } |
| 533 |
{ |
| 534 |
background-color : tokenlist , |
| 535 |
color : tokenlist , |
| 536 |
element-order : commalist , |
| 537 |
font : tokenlist = \tiny , |
| 538 |
left-hspace : length = \Gm@lmargin , |
| 539 |
right-hspace : length = \Gm@rmargin , |
| 540 |
separator : tokenlist = \hfil |
| 541 |
} |
| 542 |
\DeclareTemplateCode { footer } { talk } { 0 } |
| 543 |
{ |
| 544 |
background-color = \l_@@_footer_bg_tl , |
| 545 |
color = \l_@@_footer_fg_tl , |
| 546 |
element-order = \l_@@_footer_order_clist , |
| 547 |
font = \l_@@_footer_font_tl , |
| 548 |
left-hspace = \l_@@_footer_left_skip , |
| 549 |
right-hspace = \l_@@_footer_right_skip , |
| 550 |
separator = \l_@@_footer_sep_tl |
| 551 |
} |
| 552 |
{ |
| 553 |
\noindent |
| 554 |
\@@_wallpaper_hrule:Nnn |
| 555 |
\l_@@_footer_bg_tl |
| 556 |
{ \footskip } |
| 557 |
{ \Gm@bmargin - \footskip } |
| 558 |
\skip_horizontal:n { \l_@@_footer_left_skip } |
| 559 |
\vbox_set_to_wd:Nnn \l_@@_tmp_box |
| 560 |
{ |
| 561 |
\paperwidth |
| 562 |
- \l_@@_footer_left_skip |
| 563 |
- \l_@@_footer_right_skip |
| 564 |
} |
| 565 |
{ |
| 566 |
\tl_if_empty:NF \l_@@_footer_fg_tl |
| 567 |
{ \color_select:V \l_@@_footer_fg_tl } |
| 568 |
\l_@@_footer_font_tl |
| 569 |
\clist_pop:NNT \l_@@_footer_order_clist \l_@@_tmp_tl |
| 570 |
{ |
| 571 |
\ExpandArgs { nVv } \UseInstance { footer-element } \l_@@_tmp_tl |
| 572 |
{ @ \@@_metadata_name:n { \l_@@_tmp_tl } } |
| 573 |
\clist_map_inline:Nn \l_@@_footer_order_clist |
| 574 |
{ |
| 575 |
\tl_if_empty:cF { @ \@@_metadata_name:n { ##1 } } |
| 576 |
{ |
| 577 |
\l_@@_footer_sep_tl |
| 578 |
\ExpandArgs { nnv } |
| 579 |
\UseInstance { footer-element } {##1} |
| 580 |
{ @ \@@_metadata_name:n { ##1 } } |
| 581 |
} |
| 582 |
} |
| 583 |
} |
| 584 |
\hfil |
| 585 |
} |
| 586 |
\box_use_drop:N \l_@@_tmp_box |
| 587 |
\skip_horizontal:n { \l_@@_footer_right_skip - \Gm@rmargin } |
| 588 |
} |
| 589 |
\DeclareInstance { footer } { std } { talk } { } |
| 590 |
\AddToHook { begindocument } |
| 591 |
{ |
| 592 |
\DeclareInstanceCopy { footer } { wallpaper } { std } |
| 593 |
\EditInstance { footer } { wallpaper } |
| 594 |
{ element-order = } |
| 595 |
} |
| 596 |
% \end{macrocode} |
| 597 |
% \end{variable} |
| 598 |
% \begin{macro}[EXP]{\@@_metadata_name:n} |
| 599 |
% A simple auxiliary to shorten metadata names if appropriate. Full expansion |
| 600 |
% is applied as this avoids any issue with stored names. |
| 601 |
% \begin{macrocode} |
| 602 |
\cs_new:Npn \@@_metadata_name:n #1 |
| 603 |
{ |
| 604 |
\tl_if_exist:cTF { @ short #1 } |
| 605 |
{ short #1 } |
| 606 |
{#1} |
| 607 |
} |
| 608 |
% \end{macrocode} |
| 609 |
% \end{macro} |
| 610 |
% |
| 611 |
% \begin{macro}{\@@_wallpaper_hrule:Nnn} |
| 612 |
% A simple abstraction for the top and bottom rules on the page. |
| 613 |
% \begin{macrocode} |
| 614 |
\cs_new_protected:Npn \@@_wallpaper_hrule:Nnn #1#2#3 |
| 615 |
{ |
| 616 |
\skip_horizontal:n { -\Gm@lmargin } |
| 617 |
\tl_if_empty:NF #1 |
| 618 |
{ |
| 619 |
\group_begin: |
| 620 |
\color_select:V #1 |
| 621 |
\rule:nnn { \paperwidth } {#2} {#3} |
| 622 |
\skip_horizontal:n { -\paperwidth } |
| 623 |
\group_end: |
| 624 |
} |
| 625 |
} |
| 626 |
% \end{macrocode} |
| 627 |
% \end{macro} |
| 628 |
% |
| 629 |
% \begin{macro}{\ps@plain, \ps@wallpaper, \ps@talk} |
| 630 |
% Install a standard header and footer template, and redefine the |
| 631 |
% \texttt{plain} one as this will be used for frames without |
| 632 |
% \enquote{wallpaper} which still need core links, \foreign{etc}. We also |
| 633 |
% provide a version that only shows the visual elements: this is deliberately |
| 634 |
% using the same settings as the main templates. |
| 635 |
% \begin{macrocode} |
| 636 |
\cs_set_nopar:Npn \ps@plain |
| 637 |
{ |
| 638 |
\cs_set_nopar:Npn \@oddhead |
| 639 |
{ |
| 640 |
\hfil |
| 641 |
} |
| 642 |
\cs_set_nopar:Npn \@oddfoot { } |
| 643 |
\cs_set_eq:NN \@evenhead \@oddhead |
| 644 |
\cs_set_eq:NN \@evenfoot \@oddfoot |
| 645 |
} |
| 646 |
\cs_set_nopar:Npn \ps@wallpaper |
| 647 |
{ |
| 648 |
\cs_set_nopar:Npn \@oddhead |
| 649 |
{ |
| 650 |
\UseInstance { header } { wallpaper } |
| 651 |
\hfil |
| 652 |
} |
| 653 |
\cs_set_nopar:Npn \@oddfoot |
| 654 |
{ |
| 655 |
\UseInstance { footer } { wallpaper } |
| 656 |
\hfil |
| 657 |
} |
| 658 |
\cs_set_eq:NN \@evenhead \@oddhead |
| 659 |
\cs_set_eq:NN \@evenfoot \@oddfoot |
| 660 |
} |
| 661 |
\cs_new_nopar:Npn \ps@talk |
| 662 |
{ |
| 663 |
\cs_set_nopar:Npn \@oddhead |
| 664 |
{ |
| 665 |
\UseInstance { header } { std } |
| 666 |
\hfil |
| 667 |
} |
| 668 |
\cs_set_nopar:Npn \@oddfoot { \UseInstance { footer } { std } } |
| 669 |
\cs_set_eq:NN \@evenhead \@oddhead |
| 670 |
\cs_set_eq:NN \@evenfoot \@oddfoot |
| 671 |
} |
| 672 |
\pagestyle { talk } |
| 673 |
% \end{macrocode} |
| 674 |
% \end{macro} |
| 675 |
% |
| 676 |
% \subsection{The \texttt{frame} environment} |
| 677 |
% |
| 678 |
% \begin{variable}{\l_@@_frame_bool} |
| 679 |
% To track whether we are inside a frame or not. |
| 680 |
% \begin{macrocode} |
| 681 |
\bool_new:N \l_@@_frame_bool |
| 682 |
% \end{macrocode} |
| 683 |
% \end{variable} |
| 684 |
% |
| 685 |
% \begin{variable}{\g_@@_frame_tag_bool} |
| 686 |
% To track when a frame is being tagged: mainly needed for the header |
| 687 |
% (and as a result global). |
| 688 |
% \begin{macrocode} |
| 689 |
\bool_new:N \g_@@_frame_tag_bool |
| 690 |
% \end{macrocode} |
| 691 |
% \end{variable} |
| 692 |
% |
| 693 |
% \begin{variable}{\l_@@_frame_verb_bool} |
| 694 |
% Indicates that material was collected verbatim (and thus needs rescanning). |
| 695 |
% \begin{macrocode} |
| 696 |
\bool_new:N \l_@@_frame_verb_bool |
| 697 |
% \end{macrocode} |
| 698 |
% \end{variable} |
| 699 |
% |
| 700 |
% \begin{variable}{\g_@@_frame_int, \c@frame, \theframe, \@framenumber} |
| 701 |
% The overall frame number, including \LaTeX{} counter-like access. |
| 702 |
% \begin{macrocode} |
| 703 |
\int_new:N \g_@@_frame_int |
| 704 |
\cs_new_eq:NN \c@frame \g_@@_frame_int |
| 705 |
\cs_new:Npn \theframe { \@arabic \c@frame } |
| 706 |
\cs_new:Npn \@framenumber { \arabic { frame } } |
| 707 |
% \end{macrocode} |
| 708 |
% \end{variable} |
| 709 |
% |
| 710 |
% \begin{variable}{\@totalframes} |
| 711 |
% The total frames can be handled using the kernel properties. |
| 712 |
% \begin{macrocode} |
| 713 |
\property_new:nnnn { totalframes } { shipout } { -1 } |
| 714 |
{ \int_use:N \g_@@_frame_int } |
| 715 |
\AddToHook { enddocument / afterlastpage } |
| 716 |
{ \property_record:nn { lastpage } { totalframes } } |
| 717 |
\cs_new:Npn \@totalframes { \property_ref:nn { lastpage } { totalframes } } |
| 718 |
% \end{macrocode} |
| 719 |
% \end{variable} |
| 720 |
% |
| 721 |
% \begin{macro}{\@@_latexe_frame:n} |
| 722 |
% As we will need to re-define \cs{frame} but have it available inside |
| 723 |
% frames, a copy is made here. |
| 724 |
% \begin{macrocode} |
| 725 |
\NewCommandCopy \@@_latexe_frame:n \frame |
| 726 |
% \end{macrocode} |
| 727 |
% \end{macro} |
| 728 |
% |
| 729 |
% \begin{macro}{\@@_frame_process:nn} |
| 730 |
% Here, the frame content is received as the argument. |
| 731 |
% \begin{macrocode} |
| 732 |
\cs_new_protected:Npn \@@_frame_process:nn #1#2 |
| 733 |
{ |
| 734 |
\int_gincr:N \g_@@_frame_int |
| 735 |
\bool_set_true:N \l_@@_frame_bool |
| 736 |
\str_if_empty:NF \l_@@_frame_name_str |
| 737 |
{ |
| 738 |
\tl_if_exist:cT { g_@@_frame_ \l_@@_frame_name_str _tl } |
| 739 |
{ |
| 740 |
\msg_error:nnV { talk } { duplicate-frame-name } |
| 741 |
\l_@@_frame_name_str |
| 742 |
} |
| 743 |
\tl_clear_new:c { g_@@_frame_ \l_@@_frame_name_str _tl } |
| 744 |
\tl_gset:ce { g_@@_frame_ \l_@@_frame_name_str _tl } |
| 745 |
{ |
| 746 |
{ |
| 747 |
\bool_if:NTF \l_@@_frame_verb_bool |
| 748 |
{ true } |
| 749 |
{ false } |
| 750 |
} |
| 751 |
{ \exp_not:n {#2} } |
| 752 |
} |
| 753 |
} |
| 754 |
\@@_slide:nn {#1} {#2} |
| 755 |
} |
| 756 |
% \end{macrocode} |
| 757 |
% \end{macro} |
| 758 |
% |
| 759 |
% \begin{macro}{\@@_frame_tag:n} |
| 760 |
% Wraps some content in tagging for a frame: we may have multiple of these |
| 761 |
% in one logical frame, but that is non-standard. |
| 762 |
% \begin{macrocode} |
| 763 |
\cs_new_protected:Npn \@@_frame_tag:n #1 |
| 764 |
{ |
| 765 |
\tag_struct_begin:n { tag = frame } |
| 766 |
\int_gset:Nn \g_@@_frame_struct_int { \tag_get:n { struct_num } } |
| 767 |
\bool_gset_true:N \g_@@_frame_tag_bool |
| 768 |
#1 |
| 769 |
\tag_struct_end: |
| 770 |
} |
| 771 |
% \end{macrocode} |
| 772 |
% \end{macro} |
| 773 |
% \begin{macro}{\@@_frame_notag:n} |
| 774 |
% The alternative: turn off tagging and suppress the function that would |
| 775 |
% tag the frame title. |
| 776 |
% \begin{macrocode} |
| 777 |
\cs_new_protected:Npn \@@_frame_notag:n #1 |
| 778 |
{ |
| 779 |
\tag_mc_begin:n { artifact } |
| 780 |
\tag_suspend:n { frame } |
| 781 |
\bool_gset_false:N \g_@@_frame_tag_bool |
| 782 |
#1 |
| 783 |
\par |
| 784 |
\tag_resume:n { frame } |
| 785 |
\tag_mc_end: |
| 786 |
} |
| 787 |
% \end{macrocode} |
| 788 |
% \end{macro} |
| 789 |
% |
| 790 |
% \begin{macro}{frame, frame*} |
| 791 |
% The definition for the \env{frame} and \env{frame*} environments: the exact |
| 792 |
% interface at both the document and code levels is still open. |
| 793 |
% \begin{macrocode} |
| 794 |
\bool_if:NTF \l_@@_frame_title_bool |
| 795 |
{ |
| 796 |
\RenewDocumentEnvironment { frame } |
| 797 |
{ D <> { all } = { action-spec } O { } +m +b } |
| 798 |
{ |
| 799 |
\str_clear:N \l_@@_frame_name_str |
| 800 |
\keys_set:nn { talk / frame } {#2} |
| 801 |
\bool_set_false:N \l_@@_frame_verb_bool |
| 802 |
\@@_frame_process:nn {#1} { \frametitle {#3} #4 } |
| 803 |
} |
| 804 |
{ } |
| 805 |
\NewDocumentEnvironment { frame* } |
| 806 |
{ D <> { all } = { action-spec } O { } +m c } |
| 807 |
{ |
| 808 |
\str_clear:N \l_@@_frame_name_str |
| 809 |
\keys_set:nn { talk / frame } {#2} |
| 810 |
\bool_set_true:N \l_@@_frame_verb_bool |
| 811 |
\tl_gset:Nn \g_@@_frame_title_tl {#3} |
| 812 |
\exp_args:Nne \@@_frame_process:nn {#1} |
| 813 |
{ \tl_to_str:n { \frametitle } \exp_not:n { {#3} #4 } } |
| 814 |
} |
| 815 |
{ } |
| 816 |
} |
| 817 |
{ |
| 818 |
\RenewDocumentEnvironment { frame } |
| 819 |
{ !D <> { all } = { action-spec } !O { } +b } |
| 820 |
{ |
| 821 |
\str_clear:N \l_@@_frame_name_str |
| 822 |
\keys_set:nn { talk / frame } {#2} |
| 823 |
\bool_set_false:N \l_@@_frame_verb_bool |
| 824 |
\@@_frame_process:nn {#1} {#3} |
| 825 |
} |
| 826 |
{ } |
| 827 |
\NewDocumentEnvironment { frame* } |
| 828 |
{ !D <> { all } = { action-spec } !O { } c } |
| 829 |
{ |
| 830 |
\str_clear:N \l_@@_frame_name_str |
| 831 |
\keys_set:nn { talk / frame } {#2} |
| 832 |
\bool_set_true:N \l_@@_frame_verb_bool |
| 833 |
\@@_frame_process:nn {#1} {#3} |
| 834 |
} |
| 835 |
{ } |
| 836 |
} |
| 837 |
% \end{macrocode} |
| 838 |
% \end{macro} |
| 839 |
% |
| 840 |
% \begin{macro}{\@@_frame_reuse:nn} |
| 841 |
% \begin{macro}{\@@_frame_reuse_aux:nn} |
| 842 |
% \begin{macro}{\@@_frame_reuse_aux:nnn} |
| 843 |
% \begin{macro}{\reuseframe, \againframe} |
| 844 |
% Reusing a frame is largely a question of passing the correct stored |
| 845 |
% information along after setting the flag for re-scanning. |
| 846 |
% \begin{macrocode} |
| 847 |
\cs_new_protected:Npn \@@_frame_reuse:nn #1#2 |
| 848 |
{ |
| 849 |
\tl_if_exist:cTF { g_@@_frame_ #2 _tl } |
| 850 |
{ |
| 851 |
\exp_args:Nv \@@_frame_reuse_aux:nn |
| 852 |
{ g_@@_frame_ #2 _tl } {#1} |
| 853 |
} |
| 854 |
{ \msg_error:nnn { talk } { unknown-frame-name } {#2} } |
| 855 |
} |
| 856 |
\cs_new_protected:Npn \@@_frame_reuse_aux:nn #1#2 |
| 857 |
{ \@@_frame_reuse_aux:nnn #1 {#2} } |
| 858 |
\cs_new_protected:Npn \@@_frame_reuse_aux:nnn #1#2#3 |
| 859 |
{ |
| 860 |
\use:c { bool_set_ #1 :N } \l_@@_frame_verb_bool |
| 861 |
\@@_frame_process:nn {#3} {#2} |
| 862 |
} |
| 863 |
\NewDocumentCommand \reuseframe { D <> { all } = { action-spec } O { } m } |
| 864 |
{ |
| 865 |
\group_begin: |
| 866 |
\keys_set:nn { talk / frame } {#2} |
| 867 |
\str_clear:N \l_@@_frame_name_str |
| 868 |
\@@_frame_reuse:nn {#1} {#3} |
| 869 |
\group_end: |
| 870 |
} |
| 871 |
\NewCommandCopy \againframe \reuseframe |
| 872 |
% \end{macrocode} |
| 873 |
% \end{macro} |
| 874 |
% \end{macro} |
| 875 |
% \end{macro} |
| 876 |
% \end{macro} |
| 877 |
% |
| 878 |
% \begin{macrocode} |
| 879 |
\msg_new:nnnn { talk } { unknown-frame-name } |
| 880 |
{ Unknown~frame~name~"#1"! } |
| 881 |
{ |
| 882 |
You~asked~to~reuse~the~contents~of~a~frame~with~the~name~"#1",~ |
| 883 |
but~that~name~was~never~defined. |
| 884 |
} |
| 885 |
\msg_new:nnnn { talk } { duplicate-frame-name } |
| 886 |
{ Duplicate~frame~name~"#1"! } |
| 887 |
{ |
| 888 |
You~asked~to~save~the~contents~of~this~frame~with~the~name~"#1",~ |
| 889 |
but~that~name~has~already~been~used. |
| 890 |
} |
| 891 |
% \end{macrocode} |
| 892 |
% |
| 893 |
% \begin{macrocode} |
| 894 |
%</class> |
| 895 |
% \end{macrocode} |
| 896 |
% |
| 897 |
% \end{implementation} |
| 898 |
% |
| 899 |
% \PrintIndex |