Skip to content

Numbering patterns "一" and "壹" don't respect text region setting #6484

Open

Description

@wensimehrp

Description

#set text(lang: "zh", region: "tw", font: "Noto Serif CJK TC")
#set page(width: auto, height: auto, margin: 2em)

```typst
#set text(
  lang: "zh",
  region: "tw",
  font: "Noto Serif CJK TC"
)
#numbering("壹", 123456789123)\
#numbering("一", 123456789123)\
```
 
Expected:

壹仟貳佰叄拾肆億伍仟陸佰柒拾捌萬玖仟壹佰貳拾叄\
一千二百三十四億五千六百七十八萬九千一百二十三

Actual:

#numbering("壹", 123456789123)\
#numbering("一", 123456789123)\

Image

The numbering pattern only works for zh_CN and zh_SG.

zh_TW and zh_CN uses different characters for those numbering patterns. zh_CN uses "零壹贰叁肆伍陆柒捌玖拾佰仟万亿一二三四五六七八九十"(萬億), whilst zh_TW uses "零壹貳叄(參)肆伍陸柒捌玖拾佰仟萬億一二三四五六七八九十"。The numbering function should respect the regional differences.

A workaround is to run the .replace method several times.

Reproduction URL

https://typst.app/project/plLY4S1B6caZuC3sNdkNnr

Operating system

Webapp

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Jun 23, 2025
  2. Andrew15-5 commented on Jun 23, 2025

    @Andrew15-5
    Contributor

    The link is private.

  3. wensimehrp commented on Jun 23, 2025

    @wensimehrp
    Author

    The link is private.

    Oops sorry.
    But it's basically jusy the code I have up there

  4. MDLC01 commented on Jun 24, 2025

    @MDLC01
    Collaborator

    Numbering patterns return strings, which can't depend on the context. This issue should be solved by adding a separate numbering pattern1 instead of by making numbering contextual. Let's repurpose this issue as a request for the addition of the missing Chinese numbering patterns.

    Footnotes

    1. See related work: https://github.com/typst/typst/pull/6379. ↩

  5. added
    feature request
    text
    and removed
    bug
    on Jun 24, 2025
  6. YDX-2147483647 commented on Jul 3, 2025

    @YDX-2147483647
    Contributor

    zh-TW and zh-CN uses different characters for numbering patterns.

    Previously mentioned in #717 (comment) and #1000.

    See also https://crates.io/crates/chinese-number and codex::numeral_systems::NumeralSystem::Chinese.

  7. goyalyashpal commented on Aug 5, 2025

    @goyalyashpal

    instead of by making numbering contextual. Let's repurpose this issue as a request for the addition of the missing Chinese numbering patterns.

    - @ MDLC01 #6484 (comment)

    this aligns with what i thought. that there should be capability to define custom numberings.

    it seems very trivial thing and depending on typst core version update to provide a simple numbering sequence seems absurd and wasteful.

    see also:

  8. changed the title [-]Numbering patterns "一" and "壹" doesn't respect text region setting[/-] [+]Numbering patterns "一" and "壹" don't respect text region setting[/+] on Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requesttext

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions