Is it possible to use a custom character for a specific list item?

Hello everyone! Is it possible to specify a custom character for a specific list item?

My document uses a Cyrillic alphabet, and because of this, I try to make my lists to look like

а) foo
б) bar
в) baz

instead of

a) foo
b) bar
c) baz

Currently, Cyrillic is not supported for numbering patterns out of the box (see #1595 and #5597), and this is why I tried to adopt one of the examples from https://typst.app/docs/reference/model/enum/ instead. Here is my version:

#enum(
  enum.item("а)")[foo],
  enum.item("б)")[bar],
  enum.item("в)")[baz]
)

but this doesn’t seem to work.

What I’m doing wrong?

enum.item accepts none or int. You’re better off writing a numbering function instead.

#let cyrillic-numbering(n) = {
  ("а)", "б)", "в)").at(n - 1)
}
#enum(numbering: cyrillic-numbering)[foo][bar][baz]

image

1 Like

A more general solution would be a custom numbering function like this, which starts at the first lowercase cyrillic letter:

#set enum(numbering: n => {
  let cyr = (0x430 + n) - 1
  str.from-unicode(cyr) + ")"
})

A more robust alternative is to use something like numberingx.

3 Likes

@xkevio I love this. Thanks a lot!