-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.typ
281 lines (247 loc) · 5.66 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
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
#let heading_style(it) = {
// Set chapter
locate(loc => {
let heading_number = counter(heading).at(loc).at(0)
if it.level == 1{
if heading_number != 0 {
pagebreak()
align(right,
grid(rows: (140pt,auto),
text(140pt, fill: rgb("#999999"), counter(heading).display()),
text(28pt, it.body)
)
)
pagebreak()
} else {
pad(
bottom: 50pt,
text(30pt, it))
}
// Increase figures counter
// counter(figure).step(level: 1)
}
else if it.level <= 3 {
pad(
top: 10pt,
bottom: 10pt,
text(14pt, it)
)
}
else if it.level > 3 {
// Set run-in subheadings, starting at level 4.
parbreak()
text(11pt, style: "italic", weight: "regular", it.body + ".")
} else {
it
}
})
}
#let project(
school_logo: none,
cover_image: none,
title: "",
subtitle: "",
author: "",
degree: "",
supervisors: (),
committee: (),
date: "",
abstract: [],
abstract_pt: none,
custom_sections: (),
body,
) = {
// Set the document's basic properties.
set document(author: author, title: title)
set page(
margin: (left: 20mm, right: 20mm, top: 20mm, bottom: 20mm),
)
set text(font: "Source Sans Pro", lang: "en")
set heading(numbering: "1.1")
//set figure(numbering: "1.1")
//show figure.where(kind: table): it => {
// counter(figure.where(kind: table)).step(level: 1)
// it
//}
show heading: heading_style
// Table of content and lists style
show outline: it => {
show heading: set text(fill: rgb("#000"))
set text(fill: rgb("#666666"), weight: 500)
it
}
// Set a heading style for bibliography
show bibliography: it => {
show heading: it_heading => {
pagebreak()
pad(
bottom: 50pt,
text(30pt, it_heading.body)
)
}
it
}
// Cover page
// Title page.
// The page can contain a logo if you pass one with `logo: "logo.png"`.
if school_logo == none {
school_logo = "images/ist-logo.png"
}
image(school_logo, height: 20mm, width: auto)
v(8mm)
// Image
if cover_image != none and cover_image.trim().len() > 0 {
pad(bottom: 10mm,
image(cover_image)
)
} else {
v(58mm)
}
align(center, {
block(
width: 80%,
{
// Title
text(16pt, weight: "bold", [This is the Title of the Thesis and it is a very Big Title covering More than One Line])
// Subtitle
if subtitle.trim().len() > 0 {
pad(
top: 0.8em,
text(14pt, subtitle)
)
}
// Author information.
pad(
top: 3.2em,
text(16pt, weight: "bold", author)
)
// Thesis information.
pad(
top: 3.2em, {
text(12pt, [Thesis to obtain the Master of Science Degree in])
linebreak()
v(1.8em)
text(16pt, weight: "bold", degree)
})
// Supervisor information
if supervisors.len() > 0 {
pad(
top: 1.8em,
text(12pt, {
if supervisors.len() > 1 {
[Supervisors: ]
} else {
[Supervisor: ]
}
supervisors.join([ \ ])
})
)
}
// Committee information.
if committee.len() > 0 {
pad(top: 1.2em, text(14pt, weight: "bold", [Examination Committee]))
pad(
top: 1.2em,
grid(
rows: (auto,) * calc.min(3, committee.len()),
gutter: 0.5em,
..committee.map(member => text(12pt, member.role + [: ] + member.name)),
),
)
}
})
})
// Date
align(center + bottom,
pad(
top: 4em,
text(14pt, weight: "bold", date)
)
)
pagebreak()
// End of cover page
counter(page).update(0)
set page(
margin: (left: 25mm, right: 25mm, top: 30mm, bottom: 30mm),
footer: [
#set align(center)
#set text(12pt, weight: "bold")
#counter(page).display(
"i",
)
],
number-align: center,
)
// Custom sections (Ackowledgments, Declarations, etc.)
// Abstract page.
v(1fr)
heading(outlined: false, numbering: none, text(0.85em)[Abstract])
align(left)[
#set par(justify: true)
#abstract
]
v(1.618fr)
pagebreak()
if abstract_pt != none {
v(1fr)
heading(outlined: false, numbering: none, text(0.85em)[Resumo])
align(left)[
#set par(justify: true)
#abstract_pt
]
v(1.618fr)
pagebreak()
}
// Table of contents.
outline(depth: 4, indent: true)
pagebreak()
// Figure listing
outline(
title: [List of Figures],
target: figure.where(kind: image),
)
pagebreak()
// Table listing
outline(
title: [List of Tables],
target: figure.where(kind: table),
)
// Reset page counter and make a empty page with no number
set page(
footer: []
)
pagebreak()
counter(page).update(0)
// Main content
set page(
margin: (left: 25mm, right: 25mm, top: 30mm, bottom: 30mm),
footer: [
#set align(center)
#set text(12pt, weight: "bold")
#counter(page).display(
"1",
)
],
number-align: center,
)
// Main body.
set par(justify: true)
body
}
#let appendices(body) = {
counter(heading).update(0)
counter("appendices").update(1)
set heading(
numbering: (..nums) => {
let vals = nums.pos()
let value = "ABCDEFGHIJ".at(vals.at(0) - 1)
if vals.len() == 1 {
return value
}
else {
return value + "." + nums.pos().slice(1).map(str).join(".")
}
}
);
[#pagebreak() #body]
}