-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.typ
174 lines (143 loc) · 4.59 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
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
#import "typst-slides/slides.typ": *
#let color = (
primary: rgb(0, 91, 148),
primary_c: rgb(148, 57, 0),
secondary: rgb(152, 125, 28),
secondary_c: rgb(28,55,152),
text: rgb(32, 56, 100),
text_c: rgb(100, 76, 32),
)
#let titech-theme(lang) = data => {
let scriptsize = 8pt
let flag = image.with("asset/flag.svg")
let _top_bar = place(top, rect(width: 100%, height: .41cm, fill: color.secondary, stroke: none))
let logical-slide = counter("logical-slide")
let alert(background: none, slide-info, bodies) = {
if bodies.len() != 1 {
panic("default variant of default theme only supports one body per slide")
}
let body = bodies.first()
//background
if background != none {
place(background)
}
//header
_top_bar + place(top+center, flag(width: if data.aspect-ratio == "16-9" {3/4} else {1} * 12.126%))
align(center + horizon, block(breakable: false, body))
}
let title-slide(slide-info, bodies) = {
if bodies.len() != 0 {
panic("title slide does not allow any body")
}
alert(background: image("asset/bg_" + data.aspect-ratio + ".jpg"), slide-info, ([
#v(1fr)
#block(inset: 1.65em, text(1.65em)[*#data.title*])
#line(length: 91%, stroke: .55pt)
#{
set text(size: .9em)
if data.subtitle != none {
v(1em)
text[*#data.subtitle*]
}
}
#v(1em)
#grid(
columns: (1fr,) * calc.min(data.authors.len(), 3),
column-gutter: 1em,
row-gutter: 1em,
[#text(size: .9em, data.authors.at(0).affiliation)\ #text(1.5em, data.authors.at(0).name)]
)
#v(4fr)
],))
}
let thanks(slide-info, bodies) = {
if bodies.len() > 1 {
panic("you cannot input bodies more than 1")
}
set text(1.5em, weight: "bold")
let content = if lang == "jp" [ご清聴ありがとうございました]
else if lang == "en" [Thanks for your listening!]
let body = bodies.at(0, default: content)
alert(
background: place(bottom, image("asset/bg_thanks_" + data.aspect-ratio + ".jpg")),
slide-info,
(move(dy: -9%, body),)
)
}
let default(slide-info, bodies) = {
set text(color.text)
set strong(delta: 100)
if bodies.len() != 1 {
panic("default variant of default theme only supports one body per slide")
}
let body = bodies.first()
// header
_top_bar + place(top+left, dx: 91%, flag(width: if data.aspect-ratio == "19-6" {86.84%} else {1} * 6.5%))
v(1em)
if "title" in slide-info {
block(
width: 100%, breakable: false,
inset: (x: 1em), outset: 0em,
heading(level: 1, slide-info.title)
)
}
v(1fr)
block(
width: 100%, inset: (x: 2em), breakable: false, outset: 0em,
body
)
v(2fr)
// footer
place(bottom + right, dx: -.4em, dy: -.5em, text(.9em, logical-slide.display()))
}
let wake-up(slide-info, bodies) = {
set text(color.text)
if bodies.len() != 1 {
panic("wake up variant of default theme only supports one body per slide")
}
let body = bodies.first()
block(
width: 100%, height: 100%, inset: 2em, breakable: false, outset: 0em,
fill: color.secondary,
text(size: 1.5em, fill: white, {v(1fr); body; v(1fr)})
)
}
(
"alert": alert,
"title slide": title-slide,
"thanks": thanks,
"default": default,
"wake up": wake-up,
)
}
#let project(
title: none,
authors: none,
subtitle: none,
date: none,
lang: "jp",
aspect-ratio: "4-3",
handout: false,
body
) = {
show: slides.with(
authors: authors,
theme: titech-theme(lang),
title: title,
subtitle: subtitle,
date: date,
handout: handout,
aspect-ratio: aspect-ratio,
)
// change here with your font size for main text
let main_size = if aspect-ratio == "16-9" {20pt} else {24pt}
set text(
main_size,
font: ("Noto Sans CJK JP", "Noto Sans"),
lang: lang,
)
show link: set text(color.text_c)
show raw: set text(font: "JuliaMono")
show figure: set text(0.7em)
body
}