IssueRaiser

Ergonomic numbering-by-section

### Description It's pretty standard to have equations/figures/tables/etc in academic work numbered by section or by chapter (i.e. the 23rd equation of section 5 is equation (5.23) ). While Typst makes a lot of things easier than the competition, arranging for numbering by section currently has a lot of friction. Ad-hoc solutions are starting to appear, but with varying amounts of fragility. It seems like numbering-by-section is a feature that should be built in to Typst, and easy to use out-of-the box. This feature request is meant to less than an RFC, but a home for discussing solutions that might improve the user experience. In a perfect world, something like ``` set math.equation( numbering: "({h1}.1))", supplement: none) ``` would be enough to get equation numbers numbered by section, in parentheses, and at the same time have a reference `@profound-eq` yield `(5.23)` for equation 23 of section 5. To make number-by-section happen currently for equations: 1) A show rule for `heading` needs to be established to resent the equation counter when a new level 1 heading begins. 2) A custom numbering function needs to be assigned to `math.equation`. Because numbering functions only receive counter values and no other info, the numbering function can only add the section number based on its call site using `location`. Also, the numbering function needs to be careful to format the section number so that if appendix numbering by A, B, C begins, then this is correctly detec

Posted by damaxwell on Aug 9, 2023, 3:42 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

github (Other)

Ergonomic numbering-by-section

damaxwellAug 9, 2023, 3:42 AM

### Description It's pretty standard to have equations/figures/tables/etc in academic work numbered by section or by chapter (i.e. the 23rd equation of section 5 is equation (5.23) ). While Typst makes a lot of things easier than the competition, arranging for numbering by section currently has a lot of friction. Ad-hoc solutions are starting to appear, but with varying amounts of fragility. It seems like numbering-by-section is a feature that should be built in to Typst, and easy to use out-of-the box. This feature request is meant to less than an RFC, but a home for discussing solutions that might improve the user experience. In a perfect world, something like ``` set math.equation( numbering: "({h1}.1))", supplement: none) ``` would be enough to get equation numbers numbered by section, in parentheses, and at the same time have a reference `@profound-eq` yield `(5.23)` for equation 23 of section 5. To make number-by-section happen currently for equations: 1) A show rule for `heading` needs to be established to resent the equation counter when a new level 1 heading begins. 2) A custom numbering function needs to be assigned to `math.equation`. Because numbering functions only receive counter values and no other info, the numbering function can only add the section number based on its call site using `location`. Also, the numbering function needs to be careful to format the section number so that if appendix numbering by A, B, C begins, then this is correctly detec

Comments (0)

No comments yet. Start the discussion.

Comment on this issue