-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtud-slides.typ
285 lines (257 loc) · 7.16 KB
/
tud-slides.typ
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
// TUD Theme for Typst Touying
//
// based on https://touying-typ.github.io/touying/docs/build-your-own-theme
#import "@preview/touying:0.4.2": *
#import "colors.typ": *
/*
* Utility Functions
*/
#let tud-gradient(self, body) = {
rect(
stroke: self.colors.debug-stroke,
fill: gradient.linear(
self.colors.tud-blue,
self.colors.tud-lightblue,
angle: 45deg,
),
body
)
}
/*
* Standard Slide
*/
#let slide(
self: none,
title: auto,
subtitle: none,
..args,
) = {
if title != auto {
self.tud-title = title
}
if subtitle != none {
self.tud-subtitle = subtitle
}
(self.methods.touying-slide)(self: self, ..args)
}
/*
* Title Slide
*/
#let title-slide(
self: none,
..args,
) = {
self = utils.empty-page(self) // clears self.page-args.header, self.page-args.footer, sets margin and padding to 0em
let info = self.info + args.named()
let cell(body) = rect(
width: 100%, height: 100%, inset: 0mm, outset: 0mm,
fill: none, stroke: self.colors.debug-stroke,
align(top + left, body)
)
let body = {
set text(fill: self.colors.tud-white)
set block(inset: 0mm, outset: 0mm, spacing: 0em)
set align(top + left)
grid(
columns: 100%,
rows: (4em, 1fr),
grid(
columns: (2em, 1fr, 10em),
rows: (100%),
cell([]), // empty space
cell(
align(horizon + left, image("logos/TU_Dresden_Logo_blau_HKS41.svg", width: 49mm, height: auto))), // TUD logo
cell([]), // empty, or DDC or secondary logo
),
tud-gradient(self,
block(
stroke: self.colors.debug-stroke,
fill: none,
width: 100%,
height: 100%,
inset: (left: 4em, top: 6em),
grid(
columns: (1fr),
rows: (4em, 8em, 1fr),
cell([
#set text(fill: self.colors.tud-white.transparentize(25%))
#text(weight: "bold", info.author)
#linebreak()
#info.institution
]),
cell([
#text(size: 2em, weight: "bold", info.title)
#linebreak()
#text(size: 2em, weight: "regular", info.subtitle)
]),
cell([
#set text(fill: self.colors.tud-white.transparentize(25%))
#self.info.location \/\/ #utils.info-date(self)
]),
),
)
)
)
}
(self.methods.touying-slide)(self: self, repeat: none, body)
}
/*
* Section Slide
*
* register self.methods.touying-new-section-slide = new-section-slide,
* so new-section-slide is called when first-level title is encountered
*/
#let new-section-slide(
self: none,
title: auto,
subtitle: none,
section,
..args,
) = {
// reset page margin and padding, so full page is covered by gradient
self.page-args += (
margin: (top: 0em, bottom: 3em, x: 0em),
)
self.padding = (x: 0em, y: 0em)
let cell(body) = rect(
width: 100%, height: 100%, inset: 0mm, outset: 0mm,
fill: none, stroke: self.colors.debug-stroke,
body
)
let body = {
set align(left + horizon)
tud-gradient(
self,
block(
stroke: self.colors.debug-stroke,
width: 100%,
height: 100%,
inset: (left: 4em, top: 12em),
grid(
columns: (1fr),
rows: (8em),
cell(text(size: 2em, fill: self.colors.tud-white, weight: "bold", section))
)
)
)
}
// call default slide
(self.methods.slide)(self: self, section: section, body)
}
/*
* Slides Function
*
* When title-slide is true, using #show: slides will automatically create a title-slide.
*/
#let slides(self: none, title-slide: true, slide-level: 1, ..args) = {
if title-slide {
(self.methods.title-slide)(self: self)
}
(self.methods.touying-slides)(self: self, slide-level: slide-level, ..args)
}
/*
* Register Function and Init Method
*/
#let register(
self: themes.default.register(),
aspect-ratio: "16-9",
debug: false,
footer : [],
// footer-columns: (4.13%, 16.18%, 38.38%, 30.88%, 1fr),
// footer-columns: (14mm, 54.8mm, 130mm, 19.6mm, 1fr, 35.3mm),
footer-info: self => {[
#self.info.title – #self.info.subtitle \
#self.info.institution \/\/ #self.info.author \
#self.info.location \/\/ #utils.info-date(self)
]
},
footer-number: self => {
"Slide " + states.slide-counter.display() + " / " + states.last-slide-number
},
footer-second-logo: self => {
// if self.info.ddc-logo {
// image("...", width: 80%, height: 10em) // DDC logo enabled
// } else {
// [] // DDC logo disabled
// }
},
) = {
// color theme
self = (self.methods.colors)(
self: self,
tud-blue: cddarkblue,
tud-lightblue: cdblue,
tud-gray: cdgray,
tud-white: cdwhite,
debug-stroke: if debug { 1pt + red } else { none },
)
self.tud-title = []
self.tud-subtitle = []
self.tud-footer = footer
let header(self) = {
let title = utils.call-or-display(self, self.tud-title)
let subtitle = utils.call-or-display(self, self.tud-subtitle)
// define cell function for grid as rects
let cell(body) = rect(
width: 100%, height: 100%, inset: 0mm, outset: 0mm,
fill: none, stroke: self.colors.debug-stroke,
align(bottom + left, text(size: 24pt, fill: self.colors.tud-blue, body))
)
set align(top)
block(
grid(
columns: (4em, 1fr),
rows: (18mm, 10.6mm),
cell([]),
cell(heading(level: 2, text(weight: "bold", title))),
cell([]),
cell(text(weight: "regular", subtitle))
),
)
}
let footer(self) = {
// define cell function for grid as rects
let cell(body) = rect(
width: 100%, height: 100%, inset: 0mm, outset: 0mm,
fill: none, stroke: self.colors.debug-stroke,
align(horizon + left, text(size: 0.4em, fill: self.colors.tud-gray, body))
)
set align(center + horizon)
block(
stroke: self.colors.debug-stroke,
width: 100%,
height: 3em,
grid(
// columns: (25%, 1fr, 25%),
// columns: footer-columns,
columns: (14mm, 54.8mm, 130mm, 19.6mm, 1fr, 35.3mm), // 6 columns
rows: (2em), // 1 row
cell([]), // empty space
cell(image("logos/TU_Dresden_Logo_blau_HKS41.svg", width: auto, height: 100%)), // TUD logo
cell(utils.call-or-display(self, footer-info)), // title etc.
cell(utils.call-or-display(self, footer-number)), // slide number
cell([]), // empty space
cell(utils.call-or-display(self, footer-second-logo)), // empty, or DDC or secondary logo
)
)
}
// page settings
self.page-args += (
paper: "presentation-" + aspect-ratio,
header: header,
footer: footer,
margin: (top: 41mm, bottom: 3em, x: 4em),
)
// register methods
self.methods.slide = slide
self.methods.title-slide = title-slide
self.methods.new-section-slide = new-section-slide
self.methods.touying-new-section-slide = new-section-slide
self.methods.slides = slides
self.methods.alert = (self: none, it) => text(fill: self.colors.tud-blue, it)
self.methods.init = (self: none, body) => {
set text(font: "Open Sans", size: 16pt)
body
}
self
}