-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.typ
111 lines (103 loc) · 2.25 KB
/
template.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
#import "metadata.typ": *
#let slides(doc) = {
// Variables for configuration.
let scale = 2cm
let width = beamer_format.at(0) * scale
let height = beamer_format.at(1) * scale
// Setup.
set document(
title: presentation_title,
author: author,
)
set text(
font: font,
size: 25pt,
)
set page(
width: width,
height: height,
margin: 0pt,
)
set align(center + horizon)
show heading: title => {
pagebreak(weak: true)
rect(
width: 100%, height: 100%,
fill: gradient.radial(theme_background.lighten(15%), theme_background.darken(15%)),
text(fill: theme_text, title)
)
counter(page).update(x => x - 1)
pagebreak(weak: true)
}
// Title page.
rect(
width: 100%, height: 100%,
fill: gradient.radial(theme_background.lighten(15%), theme_background.darken(15%)),
{
set text(fill: theme_text)
text(size: 50pt, weight: "bold", presentation_title)
linebreak()
text(size: 30pt, presentation_subtitle)
v(2em)
text(size: 25pt, author)
linebreak()
text(size: 15pt, date)
}
)
pagebreak(weak: true)
counter(page).update(1)
// Actual content.
doc
}
#let slide(title: "", content) = {
// Header with slide title.
let header = context {
let headers = query(selector(heading).before(here()))
set align(left + top)
set text(fill: theme_text, weight: "bold")
rect(width: 100%, fill: theme_background, pad(x: 10pt, y: 10pt)[
#if headers == () {
text(size: 30pt, title)
} else {
let section = headers.last().body
if title == "" {
text(size: 30pt, section)
} else {
text(size: 15pt, section)
linebreak()
text(size: 25pt, title)
}
}
])
}
// Footer with left and right section.
let footer = grid(columns: (1fr, auto), pad(x: 5pt, y: 8pt)[
// Presentation title and author.
#set align(left)
#set text(12pt)
#presentation_title \
#set text(10pt)
#author -- #date
], [
// Page counter.
#rect(
width: 60pt,
height: 40pt,
fill: theme_background,
align(
center + horizon,
text(20pt, fill: theme_text, context counter(page).display())
)
)
])
pagebreak(weak: true)
grid(rows: (auto, 1fr, auto), {
header
}, {
// Inner slide content.
pad(x: 10pt, y: 10pt, box(align(left, content)))
}, {
footer
})
pagebreak(weak: true)
}