Debian Codegraph @

texmf-dist/source/latex/ltx-talk/ltx-talk-title.dtx

raw
1 % \iffalse meta-comment
2 %
3 % File: ltx-talk-title.dtx Copyright (C) 2025,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/xbeameltx-talkr
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-title} -- Title pages^^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-title} 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 % \begin{variable}{\@author, \@date, \@institute, \@subtitle, \@title}
77 % \begin{variable}
78 % {
79 % \@shortauthor ,
80 % \@shortdate ,
81 % \@shortinstitute ,
82 % \@shortsubtitle ,
83 % \@shorttitle
84 % }
85 % We create a set of keys and variables in one go. Following the classical
86 % kernel approach, all of the underlying storage is global. The short values
87 % will always be set in the following code so can be used automatically
88 % anywhere we might want them.
89 % \begin{macrocode}
90 \clist_map_inline:nn
91 { author , date , institute , subtitle , title }
92 {
93 \keys_define:nn { talk / metadata }
94 {
95 #1 .tl_gset:c = @ #1 ,
96 short- #1 .tl_gset:c = @short #1
97 }
98 }
99 % \end{macrocode}
100 % Allow empty values for author and title.
101 % \begin{macrocode}
102 \tl_gclear:N \@author
103 \tl_gclear:N \@title
104 % \end{macrocode}
105 % As the date has a standard value, that has to be propagated.
106 % \begin{macrocode}
107 \tl_gset_eq:NN \@shortdate \@date
108 % \end{macrocode}
109 % \end{variable}
110 % \end{variable}
111 %
112 % \begin{macro}{\author, \date, \title}
113 % Slightly repetitive but as we need to handle the tagging aspects, this is
114 % easier than using a loop. The main aim is to add the short metadata
115 % concept. Notice that keys are set before the main data storage in case
116 % someone set the value as a key as well as a mandatory argument.
117 % \begin{macrocode}
118 \RenewDocumentCommand \author { = { short-author } O { {#2} } m }
119 {
120 \keys_set:nn { talk / metadata } {#1}
121 \tl_gset:Nn \@author {#2}
122 \tl_gset_eq:NN \g__tag_title_author_tl \@author
123 \keys_set_known:nn { hyp } {#1}
124 }
125 \RenewDocumentCommand \date { = { short-date } O { {#2} } m }
126 {
127 \keys_set:nn { talk / metadata } {#1}
128 \tl_gset:Nn \@date {#2}
129 }
130 \RenewDocumentCommand \title { = { short-title } O { {#2} } m }
131 {
132 \keys_set:nn { talk / metadata } {#1}
133 \tl_gset:Nn \@title {#2}
134 \tl_gset_eq:NN \g__tag_title_title_tl \@title
135 \keys_set_known:nn { hyp } {#1}
136 }
137 % \end{macrocode}
138 % \end{macro}
139 %
140 % \begin{macro}{\institute, \subtitle}
141 % Simple storage at present: unlike some of the kernel data, there is not
142 % a lot to do here.
143 % \begin{macrocode}
144 \NewDocumentCommand \institute { = { short-institute } O { {#2} } m }
145 {
146 \keys_set:nn { talk / metadata } {#1}
147 \tl_gset:Nn \@institute {#2}
148 }
149 \NewDocumentCommand \subtitle { = { short-subtitle } O { {#2} } m }
150 {
151 \keys_set:nn { talk / metadata } {#1}
152 \tl_gset:Nn \@subtitle {#2}
153 }
154 % \end{macrocode}
155 % \end{macro}
156 %
157 % \begin{variable}
158 % {
159 % \l_@@_titlelem_after_skip ,
160 % \l_@@_titlelem_before_skip ,
161 % \l_@@_titlelem_color_tl ,
162 % \l_@@_titlelem_font_tl ,
163 % \l_@@_titlelem_tag_begin_tl ,
164 % \l_@@_titlelem_tag_end_tl ,
165 % }
166 % As the various elements of the titlepage share certain characteristics, we
167 % use a single template and split them as instances.
168 % \begin{macrocode}
169 \NewTemplateType { titlepage-element } { 1 }
170 \DeclareTemplateInterface { titlepage-element } { talk } { 1 }
171 {
172 after-skip : length = 0em ,
173 before-skip : length = 0em ,
174 color : tokenlist = . ,
175 font : tokenlist = \normalfont ,
176 tag-begin : tokenlist = ,
177 tag-end : tokenlist =
178 }
179 \DeclareTemplateCode { titlepage-element } { talk } { 1 }
180 {
181 after-skip = \l_@@_titlelem_after_skip ,
182 before-skip = \l_@@_titlelem_before_skip ,
183 color = \l_@@_titlelem_color_tl ,
184 font = \l_@@_titlelem_font_tl ,
185 tag-begin = \l_@@_titlelem_tag_begin_tl ,
186 tag-end = \l_@@_titlelem_tag_end_tl
187 }
188 {
189 \tl_if_empty:nF {#1}
190 {
191 \vspace { \l_@@_titlelem_before_skip }
192 \group_begin:
193 \tl_if_empty:NF \l_@@_titlelem_color_tl
194 { \color_select:V \l_@@_titlelem_color_tl }
195 \l_@@_titlelem_font_tl
196 \l_@@_titlelem_tag_begin_tl
197 #1
198 \par
199 \l_@@_titlelem_tag_end_tl
200 \group_end:
201 \vspace { \l_@@_titlelem_after_skip }
202 }
203 }
204 % \end{macrocode}
205 % Standard settings are taken from \cls{beamer} with minor adjustments.
206 % \begin{macrocode}
207 \DeclareInstance { titlepage-element } { author } { talk }
208 { before-skip = 1em }
209 \DeclareInstance { titlepage-element } { date } { talk }
210 { after-skip = 0.5em }
211 \DeclareInstance { titlepage-element } { institute } { talk }
212 { font = \scriptsize }
213 \DeclareInstance { titlepage-element } { subtitle } { talk }
214 { before-skip = 0.25em , color = structure }
215 \DeclareInstance { titlepage-element } { title } { talk }
216 {
217 color = structure ,
218 font = \Large ,
219 tag-begin = \tag_struct_begin:n { tag = Title } ,
220 tag-end = \tag_struct_end:
221 }
222 % \end{macrocode}
223 % \end{variable}
224 %
225 % \begin{variable}
226 % {
227 % \l_@@_titlepage_order_clist ,
228 % \l_@@_titlepage_alignment_tl ,
229 % \l_@@_titlepage_framestyle_tl ,
230 % \l_@@_frame_alignment_tl
231 % }
232 % Here, we deal with the overall style: notice that frame vertical alignment
233 % actually applies elsewhere, which is why it doesn't show up in the template
234 % code part. As a result, we have a slightly repetitive key interface.
235 % \begin{macrocode}
236 \NewTemplateType { titlepage } { 0 }
237 \DeclareTemplateInterface { titlepage } { talk } { 0 }
238 {
239 element-order : commalist =
240 {
241 title ,
242 subtitle ,
243 author ,
244 institute ,
245 date
246 } ,
247 framestyle : tokenlist = talk ,
248 horizontal-alignment : choice { left , center , right } = center ,
249 vertical-alignment : choice { bottom , center , stretch , top } = center
250 }
251 \DeclareTemplateCode { titlepage } { talk } { 0 }
252 {
253 element-order = \l_@@_titlepage_order_clist ,
254 framestyle = \l_@@_titlepage_framestyle_tl ,
255 horizontal-alignment =
256 {
257 left = \tl_set:Nn \l_@@_titlepage_alignment_tl { flushleft } ,
258 center = \tl_set:Nn \l_@@_titlepage_alignment_tl { center } ,
259 right = \tl_set:Nn \l_@@_titlepage_alignment_tl { flushright }
260 } ,
261 vertical-alignment =
262 {
263 bottom = \tl_set:Nn \l_@@_frame_alignment_tl { bottom } ,
264 center = \tl_set:Nn \l_@@_frame_alignment_tl { center } ,
265 stretch = \tl_set:Nn \l_@@_frame_alignment_tl { stretch } ,
266 top = \tl_set:Nn \l_@@_frame_alignment_tl { top }
267 }
268 }
269 {
270 \tl_if_empty:NF \l_@@_titlepage_framestyle_tl
271 { \exp_args:NV \thispagestyle \l_@@_titlepage_framestyle_tl }
272 \begin { \l_@@_titlepage_alignment_tl }
273 \cs_set_protected:Npn \and { \quad }
274 \clist_map_inline:Nn \l_@@_titlepage_order_clist
275 {
276 \ExpandArgs { nnv } \UseInstance { titlepage-element }
277 {##1} { @ ##1 }
278 }
279 \end { \l_@@_titlepage_alignment_tl }
280 }
281 % \end{macrocode}
282 % \end{variable}
283 %
284 % \begin{macro}{\maketitle}
285 % A very simple setup.
286 % \begin{macrocode}
287 \NewDocumentCommand \maketitle { O {} }
288 {
289 \bool_if:NTF \l_@@_frame_bool
290 { \UseTemplate { titlepage } { talk } {#1} }
291 {
292 \begin { frame }
293 \UseTemplate { titlepage } { talk } {#1}
294 \end { frame }
295 }
296 }
297 % \end{macrocode}
298 % \end{macro}
299 %
300 % \begin{macrocode}
301 %</class>
302 % \end{macrocode}
303 %
304 % \end{implementation}
305 %
306 % \PrintIndex