1
0
mirror of https://gitlab.cvh-server.de/skrause/flashcards.git synced 2025-12-12 06:41:38 +01:00
Files
flashcards/docs/template.typ
2025-10-28 12:37:03 +01:00

84 lines
1.6 KiB
Typst

#import "@preview/hydra:0.6.1": hydra
#let project(title: "", subtitle: "", authors: ((name: "", id: ""),), profs: ("",), submitted_at: none, logo: none, body) = {
// Basic properties
set document(author: "a", title: title)
set text(lang: "de")
set heading(numbering: "1.1")
// Title page
set align(center)
v(1fr)
// Logo
if logo != none {
image(logo, width: 50%)
}
v(3em)
// Title
text(2em, weight: 700, title)
v(1em)
// Subtitle
text(2em, weight: 400, subtitle)
v(1fr)
set align(left)
// Author
let authors_title
if authors.len() == 1 {
authors_title = "Autor*in"
} else {
authors_title = "Autor*innen"
}
text(weight: 700, authors_title + " (Matrikelnummer):")
grid(
gutter: 1em,
..authors.map(author => author.name + " (" + author.id + ")").flatten()
)
// Profs
let profs_title
if profs.len() == 1 {
profs_title = "Prüfer*in"
} else {
profs_title = "Prüfer*innen"
}
text(weight: 700, profs_title + ":")
grid(
gutter: 1em,
..profs,
)
// Abgabedatum
if submitted_at != none {
text(weight: 700, "Abgabedatum: ")
text(submitted_at.display("[day].[month].[year]"))
}
// Table of contents
set align(left)
set page(numbering: "I", number-align: center)
outline(depth: 3)
pagebreak()
// Header
let show-header(ctx, c) = {
emph(c.body)
v(-0.8em)
line(length: 100%, stroke: 0.5pt)
}
// Main body
set page(numbering: "1", header: context {
hydra(1, skip-starting: false, display: show-header)
})
counter(page).update(1)
set par(justify: true)
body
pagebreak()
bibliography("bibliography.yml")
}