Skip to content

Ability to wrap every page in a custom frame #1412

Open

Description

@teenjuna

Description

I don't know how to put that in the words, but here is an example of a document:

image

This is the outline page for a semester project report in my Uni. As you can see, the page content is wrapped in a frame, in this case with additional tables. Almost every page of the report (except the title page and some pages in the end) must be put in such a frame. The frame contains page number and a lot of cells for some additional info.

There's no way to implement it in Typst at the moment. As @laurmaedje said, maybe it's possible to implement, so I created the issue.

If I had to guess, the possible API might look like what we have with figures. We can modify the way the figures are presented using a show rule. Show argument contains properties such as kind, body, supplement, counter, and you can use them however you like.

With page, it could be something like this (simplest example with pages inside a rectangle):

show page: it => {
    place(
        bottom + center,
        it.counter.display(it.numbering),
    )
    rect(
        width: 100%,
        height: 95%,
        it.body
    )
}

However, there's also a problem that right now you can't pagebreak() inside other elements, which needs to be addressed.

Use Case

In my case, it's required to generate a university report.

Activity

  1. added
    feature request
    on Jun 5, 2023
  2. Enivex commented on Jun 5, 2023

    @Enivex
    Collaborator

    You can do this by putting it in the page background

  3. teenjuna commented on Jun 5, 2023

    @teenjuna
    ContributorAuthor

    I didn't think of that. Perhaps it's possible to do it using the page background, but still it looks like a hack, since we would need to adjust the borders of the page to not touch the background frame. Do I get it right?

  4. Enivex commented on Jun 5, 2023

    @Enivex
    Collaborator

    I didn't think of that. Perhaps it's possible to do it using the page background, but still it looks like a hack, since we would need to adjust the borders of the page to not touch the background frame. Do I get it right?

    I wouldn't go as far as calling it a hack, but you would have to take into account a few things, yes.

  5. added
    layout
    on Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestlayout

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions