Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set rule formatting (numbering) #215

Open
Andrew15-5 opened this issue Jan 12, 2025 · 2 comments
Open

Set rule formatting (numbering) #215

Andrew15-5 opened this issue Jan 12, 2025 · 2 comments

Comments

@Andrew15-5
Copy link

I want to have this formatting:

#set figure(numbering: (..num) =>
  numbering("1.1", counter(heading).get().first(), num.pos().first())
)

Instead of this:

#set figure(
  numbering: (..num) => numbering(
    "1.1",
    counter(heading).get().first(),
    num.pos().first(),
  ),
)

Do you think this is possible? I would've written it in only one line if the limit was higher than 80.

typst/typst#1896

@QuadnucYard
Copy link
Collaborator

insteresting. we haven't considered breaking the line after => in args before.
however, to make it behave better, e.g., add more args before numbering: without breaking lines, we still need to develop a better pretty model.

@Myriad-Dreamin
Copy link
Collaborator

Myriad-Dreamin commented Jan 15, 2025

Rustfmt usually adds a pair of brace to the body a lambda spanning multiple lines even if the body is only an expression.

#set figure(numbering: (..num) => {
  numbering("1.1", counter(heading).get().first(), num.pos().first())  
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants