typst
typst copied to clipboard
Cyrillic numbering (Russian)
Description
I thought, that adding #set enum(numbering: "а)" | "А)" | "а." |"А.")
numbering patterns would be perfect. But it's only for Cyrillic (which is my main issue). Maybe adding custom numbering — string (where each char is indexed enum label) or list of strings — would be a more flexible and universal solution.
Note: in Cyrillic enum list, next letters are de facto excluded: ё, й, ъ, ы, ь (source).
Use Case
Everyone would be able to easily create new numbering styles (emoji, Cyrillic, Japanese etc.).
You can already provide an arbitrary function to that argument
Nice. Thank you!
Here is my MWE:
#let ru_alph(pattern: "а)") = {
let alphabet = "абвгдежзиклмнопрстуфхцчшщэюя".split("")
let f(i) = {
let letter = alphabet.at(i)
let str = ""
for char in pattern {
if char == "а" {
str += letter
}
else if char == "А" {
str += upper(letter)
}
else {
str += char
}
}
str
}
f
}
#set enum(numbering: ru_alph()) // or
#set enum(numbering: ru_alph(pattern: "А."))
I think the original issue is still relevant, though. There should be a cyrillic numbering kind.
I mean, for convenience — yes. But is it the only one which should be added — probably not. Although I don't know if every language uses its own alphabet/syllabary in enumerated lists.
The search for a solution to the same problem brought me here. If numbering patterns should support several alphabets (except English, Japanese, etc.), then it would be great for me to see support for Cyrillic alphabet out of the box as well. Otherwise, we are back to the fundamental problems of LaTeX.
Anyway, Typst is great!
@syroezhkin, I think I haven't opened an issue asking for all numbering styles (not only Russian ones) because I have found this package: https://github.com/typst/packages/tree/main/packages/preview/numberingx/0.0.1 https://github.com/edhebi/numberingx
Which implements all the "predefined counter styles" listed here: https://www.w3.org/TR/predefined-counter-styles/. So I tried it and it works. Here is a MWE that covers all use cases (in a form of 2 examples) for Russian (case, excluded letters, [.)]
suffix):
#import "@preview/numberingx:0.0.1"
#columns(2, {
set enum(numbering: numberingx.formatter("{lower-russian})"))
enum(..range(28).map(it => enum.item[]))
colbreak()
set enum(numbering: numberingx.formatter("{upper-russian-full})"))
enum(..range(33).map(it => enum.item[]))
})
output
Although I never really had to use it in my documents. Nevertheless, it would be nice if not only Russian, but all the standard counter styles were to be added directly into Typst. You can open an issue about it, if it doesn't exist yet.
I'll re-open this issue, because the provided solutions are more of a workaround, than what I described/wanted.
There is already support for English, Japanese and Chinese, IIUC (https://typst.app/docs/reference/model/numbering/#parameters-numbering):
Counting symbols are 1, a, A, i, I, 一, 壹, あ, い, ア, イ, א, 가, ㄱ, and *. They are replaced by the number in the sequence, in the given case.
Since the most common set is the non-full one, I think it's better to include it, instead of the full one.