-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathltx-talk-title.dtx
More file actions
306 lines (306 loc) · 8.81 KB
/
ltx-talk-title.dtx
File metadata and controls
306 lines (306 loc) · 8.81 KB
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
% \iffalse meta-comment
%
% File: ltx-talk-title.dtx Copyright (C) 2025,2026 Joseph Wright
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
% https://www.latex-project.org/lppl.txt
%
% This file is part of the "ltx-talk bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% The released version of this bundle is available from CTAN.
%
% -----------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
% https://github.com/josephwright/xbeameltx-talkr
%
% for those people who are interested.
%
% -----------------------------------------------------------------------
%
%<*driver>
\documentclass{l3doc}
% Additional commands needed in this source
\NewDocumentCommand\email{m}{\href{mailto:#1}{\nolinkurl{#1}}}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% ^^A As we are dealing with a class, this has to be done manually
% \def\filedate{2026-04-30}
% \def\fileversion{v0.5.0}
%
% \title{^^A
% \pkg{ltx-talk-title} -- Title pages^^A
% \thanks{This file describes \fileversion,
% last revised \filedate.}^^A
% }
%
% \author{^^A
% Joseph Wright^^A
% \thanks{^^A
% E-mail: \email{joseph@texdev.net}^^A
% }^^A
% }
%
% \date{Released \filedate}
%
% \maketitle
%
% \begin{documentation}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{ltx-talk-title} implementation}
%
% Start the \pkg{DocStrip} guards.
% \begin{macrocode}
%<*class>
% \end{macrocode}
%
% Identify the internal prefix.
% \begin{macrocode}
%<@@=talk>
% \end{macrocode}
%
% \begin{variable}{\@author, \@date, \@institute, \@subtitle, \@title}
% \begin{variable}
% {
% \@shortauthor ,
% \@shortdate ,
% \@shortinstitute ,
% \@shortsubtitle ,
% \@shorttitle
% }
% We create a set of keys and variables in one go. Following the classical
% kernel approach, all of the underlying storage is global. The short values
% will always be set in the following code so can be used automatically
% anywhere we might want them.
% \begin{macrocode}
\clist_map_inline:nn
{ author , date , institute , subtitle , title }
{
\keys_define:nn { talk / metadata }
{
#1 .tl_gset:c = @ #1 ,
short- #1 .tl_gset:c = @short #1
}
}
% \end{macrocode}
% Allow empty values for author and title.
% \begin{macrocode}
\tl_gclear:N \@author
\tl_gclear:N \@title
% \end{macrocode}
% As the date has a standard value, that has to be propagated.
% \begin{macrocode}
\tl_gset_eq:NN \@shortdate \@date
% \end{macrocode}
% \end{variable}
% \end{variable}
%
% \begin{macro}{\author, \date, \title}
% Slightly repetitive but as we need to handle the tagging aspects, this is
% easier than using a loop. The main aim is to add the short metadata
% concept. Notice that keys are set before the main data storage in case
% someone set the value as a key as well as a mandatory argument.
% \begin{macrocode}
\RenewDocumentCommand \author { = { short-author } O { {#2} } m }
{
\keys_set:nn { talk / metadata } {#1}
\tl_gset:Nn \@author {#2}
\tl_gset_eq:NN \g__tag_title_author_tl \@author
\keys_set_known:nn { hyp } {#1}
}
\RenewDocumentCommand \date { = { short-date } O { {#2} } m }
{
\keys_set:nn { talk / metadata } {#1}
\tl_gset:Nn \@date {#2}
}
\RenewDocumentCommand \title { = { short-title } O { {#2} } m }
{
\keys_set:nn { talk / metadata } {#1}
\tl_gset:Nn \@title {#2}
\tl_gset_eq:NN \g__tag_title_title_tl \@title
\keys_set_known:nn { hyp } {#1}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\institute, \subtitle}
% Simple storage at present: unlike some of the kernel data, there is not
% a lot to do here.
% \begin{macrocode}
\NewDocumentCommand \institute { = { short-institute } O { {#2} } m }
{
\keys_set:nn { talk / metadata } {#1}
\tl_gset:Nn \@institute {#2}
}
\NewDocumentCommand \subtitle { = { short-subtitle } O { {#2} } m }
{
\keys_set:nn { talk / metadata } {#1}
\tl_gset:Nn \@subtitle {#2}
}
% \end{macrocode}
% \end{macro}
%
% \begin{variable}
% {
% \l_@@_titlelem_after_skip ,
% \l_@@_titlelem_before_skip ,
% \l_@@_titlelem_color_tl ,
% \l_@@_titlelem_font_tl ,
% \l_@@_titlelem_tag_begin_tl ,
% \l_@@_titlelem_tag_end_tl ,
% }
% As the various elements of the titlepage share certain characteristics, we
% use a single template and split them as instances.
% \begin{macrocode}
\NewTemplateType { titlepage-element } { 1 }
\DeclareTemplateInterface { titlepage-element } { talk } { 1 }
{
after-skip : length = 0em ,
before-skip : length = 0em ,
color : tokenlist = . ,
font : tokenlist = \normalfont ,
tag-begin : tokenlist = ,
tag-end : tokenlist =
}
\DeclareTemplateCode { titlepage-element } { talk } { 1 }
{
after-skip = \l_@@_titlelem_after_skip ,
before-skip = \l_@@_titlelem_before_skip ,
color = \l_@@_titlelem_color_tl ,
font = \l_@@_titlelem_font_tl ,
tag-begin = \l_@@_titlelem_tag_begin_tl ,
tag-end = \l_@@_titlelem_tag_end_tl
}
{
\tl_if_empty:nF {#1}
{
\vspace { \l_@@_titlelem_before_skip }
\group_begin:
\tl_if_empty:NF \l_@@_titlelem_color_tl
{ \color_select:V \l_@@_titlelem_color_tl }
\l_@@_titlelem_font_tl
\l_@@_titlelem_tag_begin_tl
#1
\par
\l_@@_titlelem_tag_end_tl
\group_end:
\vspace { \l_@@_titlelem_after_skip }
}
}
% \end{macrocode}
% Standard settings are taken from \cls{beamer} with minor adjustments.
% \begin{macrocode}
\DeclareInstance { titlepage-element } { author } { talk }
{ before-skip = 1em }
\DeclareInstance { titlepage-element } { date } { talk }
{ after-skip = 0.5em }
\DeclareInstance { titlepage-element } { institute } { talk }
{ font = \scriptsize }
\DeclareInstance { titlepage-element } { subtitle } { talk }
{ before-skip = 0.25em , color = structure }
\DeclareInstance { titlepage-element } { title } { talk }
{
color = structure ,
font = \Large ,
tag-begin = \tag_struct_begin:n { tag = Title } ,
tag-end = \tag_struct_end:
}
% \end{macrocode}
% \end{variable}
%
% \begin{variable}
% {
% \l_@@_titlepage_order_clist ,
% \l_@@_titlepage_alignment_tl ,
% \l_@@_titlepage_framestyle_tl ,
% \l_@@_frame_alignment_tl
% }
% Here, we deal with the overall style: notice that frame vertical alignment
% actually applies elsewhere, which is why it doesn't show up in the template
% code part. As a result, we have a slightly repetitive key interface.
% \begin{macrocode}
\NewTemplateType { titlepage } { 0 }
\DeclareTemplateInterface { titlepage } { talk } { 0 }
{
element-order : commalist =
{
title ,
subtitle ,
author ,
institute ,
date
} ,
framestyle : tokenlist = talk ,
horizontal-alignment : choice { left , center , right } = center ,
vertical-alignment : choice { bottom , center , stretch , top } = center
}
\DeclareTemplateCode { titlepage } { talk } { 0 }
{
element-order = \l_@@_titlepage_order_clist ,
framestyle = \l_@@_titlepage_framestyle_tl ,
horizontal-alignment =
{
left = \tl_set:Nn \l_@@_titlepage_alignment_tl { flushleft } ,
center = \tl_set:Nn \l_@@_titlepage_alignment_tl { center } ,
right = \tl_set:Nn \l_@@_titlepage_alignment_tl { flushright }
} ,
vertical-alignment =
{
bottom = \tl_set:Nn \l_@@_frame_alignment_tl { bottom } ,
center = \tl_set:Nn \l_@@_frame_alignment_tl { center } ,
stretch = \tl_set:Nn \l_@@_frame_alignment_tl { stretch } ,
top = \tl_set:Nn \l_@@_frame_alignment_tl { top }
}
}
{
\tl_if_empty:NF \l_@@_titlepage_framestyle_tl
{ \exp_args:NV \thispagestyle \l_@@_titlepage_framestyle_tl }
\begin { \l_@@_titlepage_alignment_tl }
\cs_set_protected:Npn \and { \quad }
\clist_map_inline:Nn \l_@@_titlepage_order_clist
{
\ExpandArgs { nnv } \UseInstance { titlepage-element }
{##1} { @ ##1 }
}
\end { \l_@@_titlepage_alignment_tl }
}
% \end{macrocode}
% \end{variable}
%
% \begin{macro}{\maketitle}
% A very simple setup.
% \begin{macrocode}
\NewDocumentCommand \maketitle { O {} }
{
\bool_if:NTF \l_@@_frame_bool
{ \UseTemplate { titlepage } { talk } {#1} }
{
\begin { frame }
\UseTemplate { titlepage } { talk } {#1}
\end { frame }
}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
%</class>
% \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex