As per How to get differently-sized header or footer depending on page number? - #8 by laurmaedje I’m aware that there is currently no way to adjust the margins dynamically, but I’m looking for the best way to adjust the margin for single pages (chapters/titles) to one setting and then back to another without having to state the explicit values every time.
I was thinking of adding metadata to these pages like:
#let no-margin-page() = {
query(metadata.where(value: "nomargin")).any(m => m.location().page() == here().page())
}
Then adding
#metadata("nomargin")<nomargin>
to the titles/chapters.
And then doing something like:
#set page(
margin: context if no-margin-page() {
(y: 2.5cm, x: 2.5cm)
} else {
(y: 2.5cm, left: 2.5cm, right: 5cm)
}
)
But I still get "expected auto, relative length, or dictionary, found content". What I’m trying to avoid is repeating:
#set page(margin: A)
// the page
#set page(margin: B)
// another page
all throughout the document. What would be the best way to do that?