Your page numbering is in the footer, and by design in Typst, this is configured by defining options for page
, in particular the option “footer”.
If you are writing in a LTR language, then everything is mostly left-aligned by default. Hence, when you are setting the page footer, the content is counter(page).display()
, but left-aligned. Then, you can simply define the content alignment with an align
element.
As for the context expression, understand it conceptually as wrapping location-dependent code. Location is not provided to normal code, so you need it wrapped in context.
As for the trick used here, very briefly, because a pagebreak
is also an element, then you can re-define it to also raise a “start” and an “end” flag (metadata), and return “yes, the page is empty”, if you are currently between any of these two flags.