I’m programmatically generating documents with typst, and I have a special requirement for one that I don’t know how to handle.
I have a certain content (a table) which should be repeated as often as possible on one page, but only one page (ok, finally that might become 2 pages, not sure yet :)). I don’t know how big that content is beforehand, the only assumption I can really make is that it fits on the page at least once.
Do I need to look into fiddling with sizes manually somehow? Or is there a convenient way? Thanks for any pointers!
As often as possible? What is considered often? You can repeat it so often that your whole page is just a black rectangle across the whole height. One under another, or randomly all over the page? Why do you need to repeat the same thing multiple times? Is this some title page or something?
#set page(paper: "a6")
#let tab = table(
columns: 3,
[A], [B], [C],
..range(1,16).map(str),
)
#let gap = 1em
// Need to measure table height to decide how many times to repeat
// This is a hardcoded version to generate example
#repeat(tab, gap:gap)
#repeat(tab, gap:gap)
Example: the table repeats as much as possible to fill one page only (or perhaps the # of pages could be passed as a parameter):
Sorry if I was unclear. One item should be under the other (they pretty much fill the page horizontally), and then as many as may fit on that page. They’re grade sheets for teachers to use, and they need one for each pupil, but the more I can get on one page, the less printing is needed.
@vmartel08 Thanks for suggesting repeat, I was under the impression that I could use that only to fill space horizontally, not vertically. Hardcoding is a no-go, so thanks for suggesting the measure function, that might just help me over that hill
(e) Just seeing your EDIT, I’d indeed like a vertical repeat function for that exact use case.