Hello!
I want to customize the references for line numbers, however, it is somewhat limited.
Problem
#figure(```
line1
line2
```)
<example>
@example:1
@example:1 renders as:
Listing 1-1
Instead, I want it to render as:
Line 1
I can modify the rendering of references with reference-sep and reference-number-format. However, it is not possible to modify the first part, I cannot remove "Listing 1".
Possible Solution
I am not really familiar with typst functions. I hope everything is still clear.
In order to make the whole rendering of the reference modifiable, one could add a setting reference-line-format (and similarly for item). This setting would be a function for rendering the reference and subsumes both reference-sep and reference-number-format.
It would look like this:
reference-line-format: (listing, line) => ...content
The default behavior would be:
reference-line-format: (listing, line) => [#listing-#line]
// or similar to the following if you need backwards compatability
reference-line-format: (listing, line) => [#listing #reference-sep #reference-number-format(line)]
My customized behavior could then be configured like so:
reference-line-format: (listing, line) => [Line #line]
Thanks for taking a look at this!
Hello!
I want to customize the references for line numbers, however, it is somewhat limited.
Problem
@example:1renders as:Listing 1-1
Instead, I want it to render as:
Line 1
I can modify the rendering of references with
reference-sepandreference-number-format. However, it is not possible to modify the first part, I cannot remove "Listing 1".Possible Solution
I am not really familiar with typst functions. I hope everything is still clear.
In order to make the whole rendering of the reference modifiable, one could add a setting
reference-line-format(and similarly for item). This setting would be a function for rendering the reference and subsumes bothreference-sepandreference-number-format.It would look like this:
The default behavior would be:
My customized behavior could then be configured like so:
Thanks for taking a look at this!