How not to reference the dot in numbly

Short description

I use numbly to customize the numbering of my headings and my numberings end with a dot, but when I reference a heading, I do not want these dots unwanted dots.

Minimal working example

With the code

#import "@preview/numbly:0.1.0": numbly
#let sectionnumbering = ("{1:I.}", "{1:I.}{2:1}.")
#set heading(numbering: numbly(..sectionnumbering))

= Test<sec:sec1>
== Test
In @sec:sec1 we showed, ...

I get the output:

If I instead use

#set heading(numbering: "I.")

= Test<sec:sec1>
== Test
In @sec:sec1 we showed, ...

I get the output


so in the reference there is no dot after the numbering.

Final question

How can I still use numbly, but get rid of the unwanted dots?

In your case, numbly is unnecessary, and "I.1." will just work.
Refer to Numbering Function โ€“ Typst Documentation for explanation.

#set heading(numbering: "I.1.")

= Alpha <a>
== Beta <b>
- Alpha: @a
- Beta: @b

If you want full customization, please refer to Reference Function โ€“ Typst Documentation.
For example:

#import "@preview/numbly:0.1.0": numbly
#set heading(
  numbering: numbly("{1:I} ๐Ÿ˜บ", "{1:I}.{2:1} ๐Ÿ˜บ"),
  // Or simply `numbering: "I.1."`
)

#show ref: it => {
  let el = it.element
  if el != none or el.func() == heading {
    // Override heading references.
    [Section ]
    numbering(
      numbly("๐Ÿ‘ป {1:I}", "๐Ÿ‘ป {1:I}.{2:1}"),
      ..counter(heading).at(el.location()),
    )
  } else {
    // Keep other references untouched.
    it
  }
}

= Alpha <a>
== Beta <b>
- Alpha: @a
- Beta: @b

Notes for developers

More flexible separators in numbering patterns ยท Issue #905 ยท typst/typst ยท GitHub?

1 Like

No, I mean the suffix is trimmed ("I.1." โ†’ "I.1") when a numbering pattern is referenced.

1 Like

I guess it would go here.