mirror of
https://gitlab.cvh-server.de/skrause/flashcards.git
synced 2025-12-12 07:51:38 +01:00
replace deprecated classes, update code, fix errors, add missing stuff
This commit is contained in:
100
docs/template.typ
Normal file
100
docs/template.typ
Normal file
@@ -0,0 +1,100 @@
|
||||
// The project function defines how your document looks.
|
||||
// It takes your content and some metadata and formats it.
|
||||
// Go ahead and customize it to your liking!
|
||||
#let project(title: "", subtitle: "", authors: (), logo: none, body) = {
|
||||
|
||||
// Set the document's basic properties.
|
||||
set document(author: authors, title: title)
|
||||
set text(font: "Linux Libertine", lang: "de")
|
||||
set heading(numbering: "1.1")
|
||||
|
||||
set align(center)
|
||||
|
||||
// Title page.
|
||||
v(1fr)
|
||||
|
||||
// Logo
|
||||
if logo != none {
|
||||
image(logo, width: 50%)
|
||||
}
|
||||
v(3em)
|
||||
|
||||
// Title
|
||||
text(2em, weight: 700, title)
|
||||
|
||||
linebreak()
|
||||
v(0.1em)
|
||||
|
||||
// Subtitle
|
||||
text(2em, weight: 400, subtitle)
|
||||
|
||||
v(1em)
|
||||
|
||||
// Author
|
||||
grid(
|
||||
..authors,
|
||||
)
|
||||
|
||||
v(1fr)
|
||||
pagebreak()
|
||||
|
||||
set align(left)
|
||||
|
||||
set page(numbering: "I", number-align: center)
|
||||
|
||||
let ht-first = state("page-first-section", [])
|
||||
let ht-last = state("page-last-section", [])
|
||||
|
||||
set page(
|
||||
header: {
|
||||
locate(loc => {
|
||||
// find first heading of level 1 on current page
|
||||
let first-heading = query(
|
||||
heading.where(level: 1), loc)
|
||||
.find(h => h.location().page() == loc.page())
|
||||
// find last heading of level 1 on current page
|
||||
let last-heading = query(
|
||||
heading.where(level: 1), loc)
|
||||
.rev()
|
||||
.find(h => h.location().page() == loc.page())
|
||||
// test if the find function returned none (i.e. no headings on this page)
|
||||
{
|
||||
if not first-heading == none {
|
||||
ht-first.update([
|
||||
// change style here if update needed section per section
|
||||
#first-heading.body
|
||||
])
|
||||
ht-last.update([
|
||||
// change style here if update needed section per section
|
||||
#last-heading.body
|
||||
])
|
||||
|
||||
// if one or more headings on the page, use first heading
|
||||
// change style here if update needed page per page
|
||||
ht-first.display()
|
||||
} else {
|
||||
// no headings on the page, use last heading from variable
|
||||
// change style here if update needed page per page
|
||||
ht-last.display()
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
v(-0.8em)
|
||||
line(length: 100%, stroke: 0.5pt)
|
||||
}
|
||||
)
|
||||
|
||||
// Table of contents
|
||||
outline(depth: 3, indent: true)
|
||||
pagebreak()
|
||||
|
||||
set page(numbering: "1")
|
||||
counter(page).update(1)
|
||||
|
||||
// Main body
|
||||
set par(justify: true)
|
||||
|
||||
body
|
||||
}
|
||||
Reference in New Issue
Block a user