I have backgrounds that, you can clearly see have a different shape top to bottom.
my question is, is there a way of changing the vertical margins top and bottom differently
I have backgrounds that, you can clearly see have a different shape top to bottom.
Hi and welcome to the forum!
There is no way to change the margins to be of different sizes on the same page, but if all you want is that the text at the top is narrower at the top, you can, for example, wrap the narrower text in a block
element.
For example,
#let content-at-top(cnt) = [
#block(width: 5cm)[#cnt]
]
// use it like so
#content-at-top[
= The Common Benedictions to the Gods for Words of Power:
]
makes it so the title text is 5cm wide.
And if the text at the top is always e.g. a top level heading, you can set a show rule that does the same thing for easier use:
#show heading.where(level: 1): it => [
#block(width: 5cm)[#it]
]
// use it like so
= The Common Benedictions to the Gods for Words of Power:
Both ways will look identical, but note that the latter will make all top level headings narrower.
sorry to be a pain, can that do shorter too?
If you mean the height, yes you can set the height by block(width: 5cm, height: 2cm)
. (Note that if they are too short there might be overlap with the text underneath)
You can also add nested #show
rules to apply special e.g. text features like line spacing to only apply to the top text, if that’s something you’re interested in. They work the same way as normal, just place them inside the show rules
Thank you, most kind. Ive never used LaTeX or Typst before and I’ve accidently given myself a complicated task of making an illuminated manuscript
DoH
What do you mean by that? I may be missing something but if we’re talking about the page margins you can pass a dictionary that specifies different margins on each side (see documentation) so you can do
#set page(margin: (top: 3cm, bottom: 5cm))
Top
#v(1fr)
Bottom
Yes I should have been more clear. What I meant was that the margins are a constant length throught a page, i.e. you can’t have the top half of the page have a margin of x: 5cm
and the bottom have a margin of x: 1cm
(as far as I know)
This is what I meant. where the two vertical margins are different with the same horizontal margin (x=same, y= different top and bottom)
Hey @Alistair_Shaw, welcome to the forum! I’ve changed your question post’s title to better fit our guidelines: How to post in the Questions category
For future posts, make sure your title is a question you’d ask to a friend about Typst.
thank you, it reads much more clear now :) the two responses were very helpful