Skip to content

Section name should be after section number in reference in Chinese #5102

Open

Description

@peng1999

Description

In Chinese, when referring to a section, it should be xx 小节 instead of 小节 xx. (One can search "小节" in The Not So Short Introduction To LaTeX2ε (Chinese Edition) to verify that.)
So the following code

#set text(lang: "zh")
#set heading(numbering: "1.1")

= Section <xxx>

@xxx

should produce 1 小节 rather than 小节 1.

Reproduction URL

No response

Operating system

No response

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Oct 3, 2024
  2. added
    model
    on Oct 6, 2024
  3. changed the title [-]Section name should put after the section number in reference in Chinese[/-] [+]Section name should be after section number in reference in Chinese[/+] on Oct 8, 2024
  4. YDX-2147483647 commented on Jun 20, 2025

    @YDX-2147483647
    Contributor

    Relates-to: #2485 — A similar issue on Figures/Tables, and some other recommended 第1节.

    See also w3c/i18n-issues#10 and clreq-gap for typst.

  5. YDX-2147483647 commented on Jul 30, 2025

    @YDX-2147483647
    Contributor

    Workaround (for typst v0.13.1)

    Here's a real dark magic that solves #5778 together.

    = 要求:第一节约,第二不知 <sec:1>
    正如@sec:1\所说。
    
    = 标题正是第二节
    也如@sec:1\所说。
    #import "@preview/numbly:0.1.0": numbly
    #set heading(
      numbering: numbly("第{1:一}节"), // the numbering for reference
      supplement: it => none,
    )
    
    #let _matched = state("matched", false)
    #let once(fn) = {
      original => context if not _matched.get() {
        fn(original)
        _matched.update(true)
      } else {
        original
      }
    }
    #let reset() = _matched.update(false)
    
    #show heading: it => {
      show counter(heading).display(it.numbering): once(it => none)
      reset()
    
      show h.where(amount: 0.3em): counter(heading).display("一、") // the numbering for display
      it
    }

    Features:

    • No show ref: ….
    • Headings are not reconstructed.
    • Works for more than 5 headings.
  6. voroskoi commented on Oct 23, 2025

    @voroskoi

    Hi,

    I would like to add that this is also an issue in Hungarian. I have started creating a package for Hungarian support in Typst and it is full of rewriting these rules:

    • images
    • tables
    • raw
    • equations

    Beside figure rules You have to rewrite ref, outline etc. show rules as well. While I fix these God knows how many issues I create because not using the standard rules means one have to keep these packages updated while the ecosystem changes.
    For example outline.entry has the prefix() method, but that also returns numbering and supplement, which means these languages have to re-implement everything.

    I think this should be global setting if You want to use the noun-number or the number-noun style.

    Chinese, Japanese, Korean, Turkish, Hungarian and probably a couple more languages would all benefit from this.

    Thanks,

  7. Shuenhoy commented on Dec 1, 2025

    @Shuenhoy

    It seems that the feature request described by #2990 can be a solution for this

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

    bugmodel

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions