You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to hide last dot in refs to heading that had custom numbering. #6032
One idea would be to simply add a named parameter trim to the numbering function, which gets passed on to the custom function. In your case, this could for example look like
The ref element could then by default pass trim: true to the numbering. When creating a show rule for references, this would then also allow you to manually get the trimmed numbering, which isn't currently possible. A disadvantage is that this would be a breaking change for cases where the custom function isn't defined with an argument sink (which is often done for equations or figures, as they commonly only have a single number).
Reacted by Ertuğrul Uyar, Hong Jiarong and Moritz Hedtke
One idea would be to simply add a named parameter trim to the numbering function, which gets passed on to the custom function. In your case, this could for example look like
The ref element could then by default pass trim: true to the numbering. When creating a show rule for references, this would then also allow you to manually get the trimmed numbering, which isn't currently possible. A disadvantage is that this would be a breaking change for cases where the custom function isn't defined with an argument sink (which is often done for equations or figures, as they commonly only have a single number).
However it's hard to determine which parts belong to prefix or suffix in the result value of function. I would wonder if we could have a numbering rework 😞
Activity
hongjr03 commentedon Apr 14, 2025
a much simpler example: https://typst.app/project/rGzkNPIy3OGOqT0u2F9FbS
ertugruluyar-github commentedon Apr 15, 2025
@hongjr03 But it is different from
slice()function because slice take the all elements from starting index whileat()function get only one value of the index. See https://typst.app/docs/reference/foundations/array/#definitions-slicehongjr03 commentedon Apr 15, 2025
Oh yes, I didn't notice that. I should fix the example :)
EpicEricEE commentedon Apr 15, 2025
One idea would be to simply add a named parameter
trimto the numbering function, which gets passed on to the custom function. In your case, this could for example look likeThe
refelement could then by default passtrim: trueto the numbering. When creating a show rule for references, this would then also allow you to manually get the trimmed numbering, which isn't currently possible. A disadvantage is that this would be a breaking change for cases where the custom function isn't defined with an argument sink (which is often done for equations or figures, as they commonly only have a single number).hongjr03 commentedon Apr 15, 2025
However it's hard to determine which parts belong to prefix or suffix in the result value of function. I would wonder if we could have a numbering rework 😞
hongjr03 commentedon Apr 16, 2025
Not sure if this is a good idea to start with: hongjr03@37bd77a
In this commit, if the numbering function return a dictionary with
prefix,numberingandsuffixkeys, then it can be trimmed in reference.An example:
Andrew15-5 commentedon Nov 20, 2025
From the forum:
Not sure about edge cases.