Add automatic pagebreak on top-level headers

This commit is contained in:
Laurenz 2024-03-11 19:57:27 +01:00
parent fd9f81e7b4
commit fba4a1f643
No known key found for this signature in database
GPG key ID: FF04836F2CF8C139
3 changed files with 21 additions and 19 deletions

Binary file not shown.

View file

@ -108,22 +108,28 @@
// modify the spacing between various headings and the content below them // modify the spacing between various headings and the content below them
#show heading: it => { #show heading: it => {
let sizes = if it.level == 1 { let sizes = if it.level == 1 {
(64pt, 24pt, 24pt) (64pt, 24pt, 24pt)
} else if it.level == 2 { } else if it.level == 2 {
(32pt, 20pt, 18pt) (32pt, 20pt, 18pt)
} else { } else {
(24pt, 16pt, 14pt) (24pt, 16pt, 14pt)
} }
[ // On top-level headers, do a weak pagebreak
#set text(size: sizes.at(2)) // (weak = no pagebreak on already blank pages)
#v(sizes.at(0)) if it.level == 1 {
#if it.numbering != none [ pagebreak(weak: true)
#counter(heading).display(it.numbering) #h(4pt) #it.body }
] else [#it.body]
#v(sizes.at(1)) [
] #set text(size: sizes.at(2))
#v(sizes.at(0))
#if it.numbering != none [
#counter(heading).display(it.numbering) #h(4pt) #it.body
] else [#it.body]
#v(sizes.at(1))
]
} }
// Alternative formating for headdings // Alternative formating for headdings
// #show heading: it => { // #show heading: it => {

View file

@ -18,9 +18,6 @@
// - 25-35 pages without directories und attachments // - 25-35 pages without directories und attachments
// incl. graphics and tables // incl. graphics and tables
// - must document: task, process of implementation, solutions and results // - must document: task, process of implementation, solutions and results
// - proof that a connection between theoretical and practical was made
// and that the holy theory taught by the DHBW is of relevance
// - No
= Introduction = Introduction
@ -35,7 +32,6 @@
You can use #link("https://github.com/crate-ci/typos")[Typos], You can use #link("https://github.com/crate-ci/typos")[Typos],
but I am too lazy to explain. but I am too lazy to explain.
#pagebreak()
= Summary and Conclusion = Summary and Conclusion
#lorem(100) #lorem(100)