flaribbit / numbly

A package that helps you to specify different numbering formats for different levels of headings.
MIT License
9 stars 1 forks source link

Can we change numbly behavior with a flag? #3

Open Doom4535 opened 13 hours ago

Doom4535 commented 13 hours ago

Is it possible to add a behavior type flag that numbly can pickup to change the behavior (for things such as appendixes?) something along the lines of:

= Conclusions
My conclusions

= Matlab files #:Appendix: #t
== ustep.m #:Appendix: #t
#let text = read("matlab/ustep.m")
#raw(text, lang: "matlab")
flaribbit commented 5 hours ago

Hello, put flag in headings seems strange to me, I would suggest something like this:

#import "@preview/numbly:0.1.0": numbly
#set heading(numbering: "1.")
#outline(indent: 2em)
= Introduction
= Related Work
= Proposed Method
= Experiments
= Conclusions

#set heading(numbering: numbly("Appendix {1:A}.", "File {1:A}.{2}.")) // change numbering format of headings
#counter(heading).update(0) // reset heading counter

= Matlab files
== ustep.m
== main.m

You will get image

flaribbit commented 5 hours ago

If you have more complex requirements, you can refer to

https://typst-doc-cn.github.io/guide/FAQ/heading-various-format.html

https://typst-doc-cn.github.io/guide/FAQ/variant-heading.html