You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While the header and footer can depend on the page size using the locate function, this does not seem the case for page margin.
#1308 adds support for inside and outside margins, but I am also interested in influencing the size of header and footer, particularly for a title page.
Feature request:
add an API that allows to set the margin of the page depending on the page number
alternatively, support a dedicated margin setting for the title page
I currently don't know how to build this with Typst.
Reacted by ai25395, Gabriel Rojas, Martin Paul Lücke, Aaron Li, Dennis Soehnen, Michael Sasser, Alexander Wörndl, Mijail Molina Lavrishcheva, Matthias Kunnen and Claudius Ellsel
For the title page, you can simply do #page(margin: ..)[Title page contents] independently from other page set rules. In general, you can change any page setting at any point, but it will force a pagebreak. What you propose would still be useful if margins should change for one continous flow of content. I plan to support that too at some point, but it's difficult to implement.
And that's why I can't do it. The content is supposed to flow over from the first page.
After looking at the current code for a bit, I understand that this is not a straightforward change, as the changes of the margins impact the number of pages required.
I have an additional use case of a letter where the first page has different information in the margins (such as the senders address) than the rest of the letter. Again, the content should seamlessly flow across all pages.
I see, you want the right margin to change while keeping a single flow. That's unfortunately not yet possible because of a fundamental limitation in paragraph layout. I do wonder if/how you would achieve this in LaTeX since it also has some limitations related to paragraphs of changing width (because of the justification algorithm). That said, I do want to support this down the road.
Reacted by Michel Steuwer, NoBrainSkull, Alexander Wörndl, Aaron Cimolini, Rolf Leggewie, jintaxi, Matthias Kunnen, Claudius Ellsel and Paul Adam
In the meantime, I managed to realize @michel-steuwer's letter template: I used the base margins defined on the second page. To get the extra margins for the first page, I used meander's text threading capabilities and placed the side panel and the expanded footer as obstacles.
Reacted by Vincent Martel, Neven Villani, Rolf Leggewie, Claudius Ellsel and Paul Adam
Adding another data point for the same underlying requirement, from formal/business/legal letter templates.
This overlaps strongly with the university/corporate-design letter example above. A common professional letter layout needs:
Page 1 to reserve a right-side information rail for sender/contact/reference metadata.
The main text on page 1 to be narrower because of that rail.
Continuation pages to use a wider text area, often with only a compact running header/footer.
The body text to remain one continuous flow, with normal automatic page breaking.
Manually splitting the source into "first page body" and "continuation body" is not a good fit for this use case because small edits can move the page break, especially in legal or administrative correspondence.
The meander workaround mentioned above sounds promising, but it would still be very useful to have a native way to express this kind of first-page layout difference without giving up automatic flow.
Small clarification: I do not know of another robust way to implement this layout in Typst today while keeping the document as one continuous text flow. If there is already a Typst-native pattern for this that does not require manual page splitting, I would be very interested in learning about it. From what I can tell, though, this issue is what currently blocks this formal-letter use case.
Activity
laurmaedje commentedon Jun 13, 2023
For the title page, you can simply do
#page(margin: ..)[Title page contents]independently from other page set rules. In general, you can change any page setting at any point, but it will force a pagebreak. What you propose would still be useful if margins should change for one continous flow of content. I plan to support that too at some point, but it's difficult to implement.michel-steuwer commentedon Jun 13, 2023
And that's why I can't do it. The content is supposed to flow over from the first page.
After looking at the current code for a bit, I understand that this is not a straightforward change, as the changes of the margins impact the number of pages required.
michel-steuwer commentedon Aug 8, 2023
I have an additional use case of a letter where the first page has different information in the margins (such as the senders address) than the rest of the letter. Again, the content should seamlessly flow across all pages.
laurmaedje commentedon Aug 8, 2023
Does the sender address need to be part of the header? Can't it be in the main flow?
michel-steuwer commentedon Aug 8, 2023
That's not the point.
I currently don't know how to type set a letter that would satisfy the corporate design guidelines of my University.
laurmaedje commentedon Aug 8, 2023
I see, you want the right margin to change while keeping a single flow. That's unfortunately not yet possible because of a fundamental limitation in paragraph layout. I do wonder if/how you would achieve this in LaTeX since it also has some limitations related to paragraphs of changing width (because of the justification algorithm). That said, I do want to support this down the road.
[-]Support for page margins to depend on page number[/-][+]Support for dynamic page margins[/+]jbdyn commentedon Sep 23, 2025
In the meantime, I managed to realize @michel-steuwer's letter template: I used the base margins defined on the second page. To get the extra margins for the first page, I used
meander's text threading capabilities and placed the side panel and the expanded footer as obstacles.claell commentedon May 10, 2026
Adding another data point for the same underlying requirement, from formal/business/legal letter templates.
This overlaps strongly with the university/corporate-design letter example above. A common professional letter layout needs:
Manually splitting the source into "first page body" and "continuation body" is not a good fit for this use case because small edits can move the page break, especially in legal or administrative correspondence.
The
meanderworkaround mentioned above sounds promising, but it would still be very useful to have a native way to express this kind of first-page layout difference without giving up automatic flow.Small clarification: I do not know of another robust way to implement this layout in Typst today while keeping the document as one continuous text flow. If there is already a Typst-native pattern for this that does not require manual page splitting, I would be very interested in learning about it. From what I can tell, though, this issue is what currently blocks this formal-letter use case.