Hi. I'm new to typst, and trying to use it for my thesis.
I want to accumulate some data in every page, and draw them as margin notes at the end. (I need to have it accumulated before drawing them.
#let code_note(content) = {
place(
top,
code_note_inner(side: "outer")[#content],
)
}
This should draw margin notes using some lib called marginalia.
#let print_code_refs() = context {
/* Some data manipulation here */
for (path, names) in grouped_dict.pairs() {
if (path == "x") { continue }
code_note[
#text(path, size: 8pt, font: code_font)
#line()
#names.map(x => text(x, size: 6pt, font: code_font)).join(linebreak())
]
}
}
Then in my document template
#let template(doc) = {
set page(
numbering: "1",
foreground: context {
print_code_refs()
},
footer: context {
print_code_refs()
reset_code_refs()
},
)
/* More settings */
}
When I place it in the footer, it draws the margin notes on the bottom of the margin. (Instead of the top)
However, when I manually place print_code_refs(), it puts the margin notes at the top of the page (just like I want it). I think the footer is at fault.
Ideally, I'd want some equivalent of placing print_code_refs() at the end of every page just before the break.
Thanks a lot for any help, and thanks to the people who responded in the quick questions channel.