Referring to How can I hide the page number on the first page?, it might be easy to skip one or two pages, but my university asks for EVERY page with a chapter’s heading to NOT be numbered.
Is there any solution to automate this?
BTW, I tried using
#show heading.where(level: 1): body => {
set page(numbering: none)
body
}
= Introduction
This is a simple template for a Master's thesis using Typst.
But it is not working the way I want it:
The problem with your approach was that set page
creates a new page by itself, and that page ends at the end of the set page
’s scope (i.e. after the heading). The trick is to keep the page settings the same, and instead make the footer content contextual, so that it can vary by page.
In one of my templates, I have a function is-chapter-page()
that you can use for this:
/// Returns whether the current page is one where a chapter begins. This is
/// used for styling headers and footers.
///
/// This function is contextual.
///
/// -> bool
#let is-chapter-page() = {
// all chapter headings
let chapters = query(heading.where(level: 1))
// return whether one of the chapter headings is on the current page
chapters.any(c => c.location().page() == here().page())
}
I then use this in my headers and footers; you would of course not put anything in the footer if it’s a chapter page:
set page(
footer: context {
if not is-chapter-page() {
...
}
},
)
2 Likes