-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.typ
213 lines (181 loc) · 4.75 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
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
#import "@preview/big-todo:0.2.0": *
#import "@preview/cetz:0.2.2"
#import "@preview/codly:1.0.0": *
#import "@preview/drafting:0.2.0": *
#import "@preview/fletcher:0.4.2" as fletcher: node, edge
#import "@preview/wrap-it:0.1.0": wrap-content
#import "@preview/lovelace:0.2.0": *
#import "i18n.typ": *
#let project(
title: [],
subtitle: [],
author: [],
professors: (),
department: [],
course: [],
session: [],
academic_year: [],
abstract: [],
dedication: [],
final: false,
locale: "it",
bibliography_file: "./bibliography.bib",
body,
) = {
set document(author: author, title: title)
set page(
paper: "a4",
margin: (x: 2.5cm, y: 1.25cm),
numbering: none,
)
set text(
font: "Libertinus Serif",
lang: locale,
region: locale,
size: 12pt,
hyphenate: true,
)
set page(header: if not final {
box(
width: 100%,
stroke: 1pt + red,
inset: .5em,
align(
center + horizon,
text(
fill: red,
size: 18pt,
[
#i18n.at(locale).draft_dated
#datetime.today().display(i18n.at(locale).date_format)
]
),
),
)
} else {
none
})
for logo in ("assets/logo_bw.png", "assets/logo_colored.png") {
align(
center,
[
#image(logo, width: 6.5cm)
#v(2em, weak: true)
#upper[#text(department)]
#v(2em, weak: true)
#text(size: 14pt, strong([#text(course)]))
#line(stroke: (dash: "dotted", thickness: 1pt), length: 100%)
#v(5em)
#heading(level: 1, outlined: false, text(size: 28pt, hyphenate: false, title))
#v(2em)
#heading(level: 2, outlined: false, text(size: 18pt, weight: "regular", hyphenate: false, subtitle))
#align(bottom)[
#text(size: 14pt)[
#grid(
columns: (auto, 1fr, auto),
align: (top + left),
rows: 1,
row-gutter: 2em,
[
*#text(i18n.at(locale).supervisor):* \
#text(professors.at(0), hyphenate: false)
],
{ },
[
*#text(i18n.at(locale).presented_by):* \
#text(author)
],
{
if professors.len() > 1 {
let title = if professors.len() == 2 {
i18n.at(locale).assistant_supervisor
} else {
i18n.at(locale).assistant_supervisors
}
text(size: 14pt, weight: "bold", title)
linebreak()
for professor in professors.slice(1) {
text(professor, hyphenate: false)
linebreak()
}
}
},
)
#v(2em, weak: true)
#line(stroke: (dash: "solid", thickness: 1pt), length: 100%)
#i18n.at(locale).graduation_session_of #text(session) \
#i18n.at(locale).academic_year #text(academic_year)
]
]
],
)
pagebreak()
}
set page(margin: 2.5cm)
show link: underline
set par(justify: true, leading: 0.75em)
show raw.where(block: false): box.with(
stroke: (paint: gray, thickness: .5pt),
outset: (y: .2em, x: -.2em),
inset: (x: .5em),
radius: .2em,
)
counter(page).update(1) // reset page counter
set par(spacing: 1.6em)
show heading: set block(spacing: 1em)
if abstract != [] {
align(
horizon,
{
heading(level: 1, i18n.at(locale).abstract)
text(abstract)
},
)
pagebreak()
}
if dedication != [] and final {
align(horizon + end, text(dedication))
pagebreak()
}
set page(numbering: "1")
outline(title: i18n.at(locale).table_of_contents, indent: 20pt, depth: 2)
{
show heading.where(level: 1): it => {
pagebreak()
v(8cm)
set par(justify: false, spacing: 0cm)
let c = counter(heading).display("1")
// text(size: 40pt, c)
v(1cm)
text(size: 40pt, it.body, hyphenate: false)
v(1cm)
}
show heading.where(level: 2): it => {
set text(size: 20pt)
v(2cm)
it
}
show heading.where(level: 3): it => {
set text(size: 14pt)
it
}
set heading(numbering: "1.1.")
set-page-properties()
show: codly-init.with()
codly(
number-format: none,
zebra-fill: none,
languages: (
python: (name: "Python", icon: "", color: rgb("#3572A5")),
),
)
show: setup-lovelace
body
bibliography(
bibliography_file,
title: i18n.at(locale).bibliography,
style: "institute-of-electrical-and-electronics-engineers",
// style: "association-for-computing-machinery",
)
}
}