As far as I can tell it's not possible to either alter a page's margins dynamically (supplying a function to margins/using locate) nor can I specify the properties of the next page in advance with #set page(margins: ...) without causing a page break immediately. Is there a reason for this behaviour of set, does it lead problems if the parameters can be changed for a subsequent invocation of page?
#Dynamic page margins
6 messages · Page 1 of 1 (latest)
it's not quite a conscious design, and more of an annoying interaction between set, locate, and set page
when you set page a pagebreak essentially happen, meaning that on the code side it makes sense that thing thing directly following a set page is on the page with those properties set
for now you can do this using a show rule on pages
#show page: it => locate(loc => {
set page(margin: if calc.odd(loc.page()) {
(left: 2.5cm, right: 3.5cm)
} else {
(left: 3.5cm, right: 2.5cm)
})
it
})
Is see, this lets you calculate the margins at a particular location, but has the same effect as the set rule: It causes a pagebreak, sets the margin (with the location/page logic), and then all future pages have those margins.