-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.typ
119 lines (99 loc) · 2.57 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
#let example(number: "", body) = {
strong("Example "+number)
linebreak()
body
}
#let note(body) = {
[
#strong("Note")
#linebreak()
#body
]
}
#let exercise(number, body) = {
strong("Exercise "+number)
linebreak()
body
}
#let project(
title: none,
header-title: none,
subtitle: none,
university: none,
faculty: none,
semester: none,
lecturer: none,
author: none,
email: none,
body
) = {
set text(size: 11pt)
set par(justify: true)
show link: underline
show link: set text(fill: rgb(40,40,220))
// headings
show heading: it => context {
let num-style = it.numbering
if num-style == none {
return it
}
let num = text(weight: "thin", numbering(num-style, ..counter(heading).at(here()))+[ \u{200b}])
let x-offset = -1 * measure(num).width
pad(left: x-offset, par(hanging-indent: -1 * x-offset, text(fill: black.lighten(25%), num) + [] + text(fill: black, it.body)))
}
// title page
[
#set text(size: 1.25em)
#v(.8fr)
#text(size: 2.5em, fill: black, strong(title)) \
#v(0em)
#text(size: 1.5em, fill: black.lighten(25%), subtitle)
#semester\
#university\
#faculty\
#text(size: 0.6em, upper(strong("Lecturer")))\
#lecturer
#text(size: 0.6em, upper(strong("Author")))\
#author\
#email
#datetime.today().display("[year]-[month]-[day]")
#v(0.1fr)
]
// page setup
set page(
margin: (top: 2.5cm, bottom: 2.5cm, right: 4cm),
header: [
#set text(size: 0.75em)
#table(columns: (1fr, auto, 1fr), align: bottom, stroke: none, inset: 0pt, [
#header-title
], [], [
#show: align.with(top + right)
#semester
])
] + v(-0.5em) + line(length: 100%, stroke: black),
footer: {
set text(size: 0.75em)
line(length: 100%, stroke: black)
v(-0.5em)
table(columns: (1fr, auto, 1fr),
align: top,
stroke: none,
inset: 0pt,
[],
align(center, context {
str(counter(page).display())
[ \/ ]
str(counter(page).final().last())
}),
[]
)
}
)
// table setup
set table(
stroke: none,
)
set heading(numbering: "1.")
counter(page).update(1)
body
}