I have made a typst research document (10 chapters), and I need to dynamically add the chapter name to the footer for each chapter. Can you please help me with this. Thank you.
Hi there @Andrew_Duncan, welcome to the Typst Forum.
Packages like chic-hdr – Typst Universe and hydra – Typst Universe will provide the functionality you are looking for.
Also, if you search on the forum for either footer or header, you will find lots of examples relating to your question, such as:
Also: Page setup guide – Typst Documentation will give you hints on how to achieve this manually.
Thank you for the clarifications.
@Andrew_Duncan also check this post Why does my header code no longer work in Typst 0.13? - #2 by Andrew which has a useful snippet if you want to do it without a package:
#let current-chapter-title() = context {
let headings = query(heading.where(level: 1).before(here()))
if headings == () { panic("At least one heading must be defined.") }
headings.last().body
}
#set page(footer: current-chapter-title())
= Heading
Have you found a solution that works for you?
Thank you for the hint. This solution is simple, it shows the current chapter title in the footer. Typst package chic-hdr looks good as well.
Please mark the post you consider the closest answer to your question with a to flag it as a solution for others to find it in the future
Tks