-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.typ
166 lines (149 loc) · 4.27 KB
/
lib.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
#import "@preview/touying:0.5.2": *
#let margin = (
left: 0.39in,
right: 0.34in,
top: 1.2in,
bottom: 0.33in
)
#let show-copyright = state("show-copyright", false)
#let figure-with-copyright(copyright: none, caption: none, ..args) = {
figure(caption: context [
#if show-copyright.get() {
copyright
} else {
caption
}
], ..args)
}
#let header-font(..args) = {
text(font: "roboto", fallback: false, weight: "black", tracking: 2pt, size: 10pt, ..args)
}
#let footer-font(..args) = {
text(font: "roboto", fallback: false, fill: rgb("#898989"), size: 9pt, ..args)
}
#let title-font(..args) = {
set par(leading: 0.1in)
set text(font: "roboto", fallback: false, weight: "black", size: 42pt)
text(..args)
}
#let subtitle-font(..args) = {
text(font: "roboto", fallback: false, size: 22pt, ..args)
}
#let slide-title-font(..args) = {
set par(leading: 0.1in)
text(font: "roboto", fallback: false, weight: "black", bottom-edge: "descender", size: 42pt, ..args)
}
#let header = self => pad(left: margin.left, right: margin.right, align(top)[
#if self.store.enable-header {
v(0.39in)
header-font(upper(self.info.short-title + " / " + self.info.short-author))
}
#place(top + right, dx: 0.34in, dy: 0.2in)[#block(height: 0.99in, self.info.logo)]
])
#let footer(self) = pad(left: margin.left, right: margin.right, grid(
rows: 0.125in,
columns: (15%, 1fr, 15%),
align: (bottom + left, bottom + center, bottom + right),
footer-font(utils.display-info-date(self)),
footer-font(self.info.department + " | " + self.info.institute + " | " + self.info.short-author),
footer-font(context utils.slide-counter.display() ),
))
#let slide(title: auto, config: (:), repeat: auto, setting: body => body, composer: auto, ..bodies) = touying-slide-wrapper(self => {
let self = utils.merge-dicts(
self,
config-common(subslide-preamble: self => {
block(
height: 1.99in - margin.top,
below: 0.24in,
width: 100% - 2in,
align(bottom)[
#slide-title-font(upper(if title != auto { title } else { utils.display-current-heading(depth: self.slide-level) }))
]
)
}),
)
touying-slide(self: self, config: config, repeat: repeat, setting: setting, composer: composer, ..bodies)
})
#let title-slide(..args) = touying-slide-wrapper(self => {
self.store.enable-header = false
let info = self.info + args.named()
let body = {
grid(
columns: 100%,
rows: (
2.76in - margin.top,
1.18in,
1.6in
),
gutter: (0in, 0.2in),
grid.cell([]),
grid.cell(align: bottom + center, title-font(upper(info.title))),
grid.cell(align: top + center, subtitle-font(info.subtitle)),
)
}
touying-slide(self: self, body)
})
#let new-section-slide(section) = touying-slide-wrapper(self => {
let body = {
grid(
columns: 100%,
rows: (
4.32in - margin.top,
1.18in,
1.18in
),
gutter: (0in, 0.05in),
grid.cell([]),
grid.cell(align: bottom, slide-title-font(upper(section))),
grid.cell(align: top, subtitle-font([]))
)
}
touying-slide(self: self, body)
})
#let d-outline() = context {
let elems = query(
heading.where(level: 1, outlined: true)
)
set enum(numbering: n => title-font[#n], spacing: 0.4in, body-indent: 0.25in)
show enum: set align(horizon)
v(2.91in-1.18in-margin.top)
columns(2,
for (i, section) in elems.enumerate() {
{
enum.item(i + 1, section.body)
}
parbreak()
})
}
#let outline-slide() = slide(title: "Outline", d-outline())
#let not-tudabeamer-2023-theme(
..args,
body,
) = {
set text(font: "roboto", fallback: false, size: 20pt)
show: touying-slides.with(
config-store(
enable-header: true,
),
config-page(
width: 13.33in,
height: 7.5in,
footer-descent: 0in,
header-ascent: 0in,
margin: margin,
header: header,
footer: footer,
),
config-common(
slide-fn: slide,
new-section-slide-fn: new-section-slide,
datetime-format: "[day].[month].[year]"
),
config-methods(init: (self: none, body) => {
set document(title: self.info.title + " " + self.info.subtitle, author: self.info.author, date: self.info.date)
body
}),
..args,
)
body
}