I’m a newbie, learning by example from the documentation and guides.
In my company template (in Word) that I want to mimic in Typst, the footer is wider than the body of the text.
Is it possible to have a horizontal page margin (say 5mm left and right) to allow for a wide footer and have the body typeset with larger horizontal margins (say 19mm)?
Or can I have a fake footer for which I would place elements absolutely on every page (except on the titlepage)?
You can insert a block with a custom width into the footer:
#set page(
// needs center alignment, otherwise the block
// will trail off the right edge of the page
footer: context align(
center,
block(
width: page.width - 2 * 5mm,
// alignment is inherited, so you probably
// want to reset it to left
align(left)[
This footer is wider than the text area.
]
)
)
)
Drawing a little is useful to see what’s going on. I used your desired margin of 19mm, but with a smaller page size just to make demonstration easier.
As you can see we can add negative padding to the footer, that should pull it out horizontally so that effectively there’s only 5 mm x-margin left for the footer while rest of the page uses the configured 19mm margin.
Thank you for your quick responses. So far, three solutions (TIMTOWTDI :-) ). As a newbie, I have no idea how similar they are conceptually and if there is a “preference” for one of the three…
bluss sets the width manually based on your numbers
ssotoen uses context and page.width
Andrew uses context andpage.margin
The first is a bit simpler, until you change the margins. Then having the context will save you some extra work.
How to size the footer:
ssotoen just overflows the footer: the block is explicitly wider than the footer. For that to work, the block is centered (so it overflows equally on both sides), and then inside the block, content is left-aligned again.
bluss and Andrew both use padding to fit more into the footer space. IMO this is the cleaner solution, since it works without overflowing.
In total I’d probably go with Andrew’s solution. It’s basically the same as bluss’s, but it is more “automatic” by using context