From 568e4a8db93ba7ca0109b54bb946e8880d07dc1e Mon Sep 17 00:00:00 2001 From: Sophie Krause Date: Wed, 26 Mar 2025 16:07:59 +0100 Subject: [PATCH] use hydra for heading, cleanup docs template --- docs/main.typ | 3 +++ docs/template.typ | 60 ++++++++++------------------------------------- 2 files changed, 15 insertions(+), 48 deletions(-) diff --git a/docs/main.typ b/docs/main.typ index ff44b01..98d7285 100644 --- a/docs/main.typ +++ b/docs/main.typ @@ -14,5 +14,8 @@ #pagebreak() +#lorem(100) +#pagebreak() + = Fazit #lorem(100) \ No newline at end of file diff --git a/docs/template.typ b/docs/template.typ index f915b6b..b4eb636 100644 --- a/docs/template.typ +++ b/docs/template.typ @@ -1,6 +1,5 @@ -// 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! +#import "@preview/hydra:0.6.0": hydra + #let project(title: "", subtitle: "", authors: (), logo: none, body) = { // Set the document's basic properties. @@ -42,55 +41,20 @@ 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) pagebreak() + let show-header(ctx, candidates) = { + candidates.body + v(-0.8em) + line(length: 100%, stroke: 0.5pt) + } + + set page(header: context { + hydra(1, skip-starting: false, display: show-header) + }) + set page(numbering: "1") counter(page).update(1)