-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtemplate_zusammenf.typ
248 lines (212 loc) · 5.62 KB
/
template_zusammenf.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
// Template Zusammenfassung
// (C) 2024, Nina Grässli, Jannis Tschan
#import "helpers.typ": *
// Global variables
#let colors = (
hellblau: rgb("#29769E"),
dunkelblau: rgb("#1A4E69"),
grün: rgb("#8B9654"),
hellgrün: rgb("#BFBC8A"),
gelb: rgb("#F2C12E"),
rot: rgb("#A6460F"),
orange: rgb("#D98825"),
comment: rgb("#2D9428"),
)
#let languages = (
de: (page: "Seite", chapter: "Kapitel", toc: "Inhaltsverzeichnis"),
en: (page: "Page", chapter: "Chapter", toc: "Contents"),
)
#let dateformat = "[day].[month].[year]"
// Main template
#let project(
authors: (),
fach: "",
fach-long: "",
semester: "",
date: datetime.today(),
landscape: false,
column-count: 1,
tableofcontents: (enabled: false, depth: "", columns: ""), // (depth: none, columns: 1)
language: "de",
font-size: 11pt,
display-title-footer: true,
appendix: (), // specifiy path to .typ file to add appendix documents
body,
) = {
// == Document Configuration ==
// PDF Metadata
set document(
author: authors,
title: fach + " Zusammenfassung " + semester,
date: date,
)
let font-default = (font: "Calibri", lang: language, region: "ch", size: font-size)
let font-special = (
..font-default,
font: "JetBrains Mono",
weight: "bold",
fill: colors.hellblau,
)
let footer = context [
#set text(font: font-special.font, size: 0.9em)
#fach | #semester | #authors.join(" & ")
#h(1fr)
#languages.at(language).page #counter(page).display()
]
set page(
flipped: landscape,
columns: column-count,
footer: if (display-title-footer) { footer },
margin: if (column-count < 2) {
(top: 2cm, left: 1.5cm, right: 1.5cm, bottom: 2cm)
} else {
0.5cm
},
)
set columns(column-count, gutter: 2em)
// Default document font
set text(..font-default)
// Style built-in functions
// Headings formatting
set heading(numbering: "1.1.1.", supplement: languages.at(language).chapter)
show heading: hd => block({
if hd.numbering != none and hd.level <= 3 {
context counter(heading).display()
h(1.3em)
}
hd.body
})
show heading.where(level: 1): h => {
set text(..font-special, top-edge: 0.18em)
line(length: 100%, stroke: 0.18em + colors.hellblau)
upper(h)
v(0.45em)
}
show heading.where(level: 2): h => {
set text(size: 0.9em)
upper(h)
}
// Remove space above H4, fixes spacing between H3 & H4
show heading.where(level: 4): h => {
v(-0.4em)
h
}
// Table formatting
set table(
stroke: (x, y) => (
left: if x > 0 { 0.07em },
top: if y > 0 { 0.07em },
),
inset: 0.5em,
)
// Recommended workaround in Typst 0.11 until table.header is styleable
show table.cell.where(y: 0): emph
// Unordered list, use with "- " or #list[]
show list: set list(marker: "–", body-indent: 0.45em)
// "Important" template, use with "_text_" or #emph[]
show emph: set text(fill: font-special.fill, weight: font-special.weight)
// Code, use with ```python print("Hello World")```
show raw: set text(font: font-special.font, size: 1em)
// Quotes
set quote(block: true, quotes: true)
show quote: q => {
set align(left)
set text(style: "italic")
q
}
// Reference, show heading name & page number
show ref: ref => if ref.element.func() != heading {
ref
} else {
let label = ref.target
let heading = ref.element
link(
label,
["#heading.body"
(#languages.at(language).page #heading.location().page())],
)
}
// Table of contents
set outline(indent: 0em)
// Table of contents, header level 1
show outline.entry.where(level: 1): entry => {
v(1.1em, weak: true)
strong(entry)
}
// Title page configuration
let subtitle(subt) = [
#set text(..font-special, size: 1.2em)
#pad(bottom: 1.3em, subt)
]
// == Page Content ==
// title row
if (display-title-footer) {
align(left)[
#text(..font-special, size: 1.8em, fach-long + " | " + fach)
#v(1em, weak: true)
#subtitle[Zusammenfassung]
]
}
// Table of contents
if (tableofcontents.enabled) {
// Generate language-specific ToC header spanning the whole page
heading(outlined: false, numbering: none, languages.at(language).toc)
columns(
// Set number of columns for ToC
tableofcontents.at("columns", default: 1),
outline(
depth: tableofcontents.at("depth", default: none),
title: none,
),
)
pagebreak()
}
// Main body
set par(justify: true)
body
// Appendix Documents
counter(heading).update(0)
set heading(numbering: "I.I")
for document in appendix {
pagebreak()
include document
}
}
// Additional formatting templates
// "Zusätzlicher Hinweis"-Vorlage
#let hinweis(style: "italic", t) = {
set text(style: style, size: 0.8em)
show raw: set text(font: "JetBrains Mono", size: 1.05em)
t
}
// "Definition"-Vorlage
#let definition(t) = {
rect(stroke: 0.13em + colors.hellblau, inset: 0.73em, columns(1, t), width: 100%)
}
// Kommentar
#let comment(t) = {
set text(style: "italic", weight: "bold", fill: colors.comment)
t
}
// Small text, #hinweis without italic
#let small(t) = {
hinweis(style: "normal", t)
}
// Text added by Jannis
#let jannis(t) = {
set text(fill: colors.orange)
t
}
// Text added by Nina
#let nina(t) = {
set text(weight: "bold", fill: colors.rot)
t
}
// Set a text color from the color dict for a math formula
#let fxcolor(subcolor, x) = {
text(fill: colors.at(subcolor), $bold(#x)$)
}
// Set a text color from the color dict for regular text
#let tcolor(subcolor, x) = {
text(fill: colors.at(subcolor), style: "italic", strong(x))
}