Hello
For a project where i create a student song book, i need to apply different type of margin based on the fact that the page number is odd or even.
At the moment i manually set the margin by passing parameters (here a dictionary) by value.
Due to the constraint on the page number i’m limited to use context function like this :
// in utils.typ
#let set_margin_type() = context {
let page_num = here().position().at("page")//counter(page).get().first()
let margin = value_odd_even(page_num, constant.odd_margin , constant.even_margin)
}
is there a way to correctly do it such that i can do something like this :
// in format.typ
#let formatable_song(
margin_type,
title,
body_list,
body_list_format,
header_tune : none,
header_tune_author : none,
header_lyrics : none,
header_lyrics_pseudo : none,
header_comments : none,
) = {
set page(margin : MARGIN_DICT, footer: utils.get_footer_alignemnt())
}
For better context here’s my project, the file utils.typ, format.typ and main.typ are probably the most usefull:
https://typst.app/project/rxJdkxQZb6FrIuv59NVJxS
Thank you in advance for your help