How to set numeration style of enums based on ident?

e.g.

1. Topic
  1. Sub topic
2. Topic

should display as

(1) Topic
  1. Sub Topic
(2) Topic

Hello. Use enum.numbering. Though because of More flexible separators in numbering patterns · Issue #905 · typst/typst · GitHub, it’s easier to use numbly.

#import "@preview/numbly:0.1.0": numbly

#set enum(numbering: numbly("(1)", "1."), full: true)

+ Topic
  + Subtopic
+ Topic

Or

#set enum(full: true, numbering: (..n) => {
  numbering(("(1)", "1.").at(n.pos().len() - 1), n.pos().last())
})
1 Like