Skip to content

Citation numbers are flying over their brackets in the superscript #6513

Closed as duplicate

Description

@YDX-2147483647

Description

The style gb-7714-2015-numeric formats a citation with a number enclosed in square brackets (e.g., [1]) and render them in superscript.
However, some fonts only provide dedicated superscript glyphs for numbers, not for brackets. This can cause misalignment, with the numbers appearing higher than the brackets in the superscript.

Image

#set text(font: "Noto Serif CJK SC")
孔乙己@key\上大人
Full example code

Compiled with typst 0.13.1

#set text(font: "Noto Serif CJK SC")
孔乙己@key\上大人

#let bib = ```bib
@misc{key,
  title = {Title},
}
```.text
#bibliography(bytes(bib), style: "gb-7714-2015-numeric")

Workaround

#show cite: set super(typographic: false)

Suggested change

This issue is caused by an imperfect font, but typst can still provide a better default.
For example, we can use the dedicated superscript glyphs only when all characters in [1] have them.

According to the following example, the mechanism is already implemented for #super, but #cite processes prefix ([), number (1), and suffix (]) separately, thereby ignoring that mechanism.

#set text(font: "Noto Serif CJK SC")

❌国@key
✅国#super("[1]")
❌国#"[1]".clusters().map(super).join()

#set super(typographic: false)

✅国@key
✅国#super("[1]")
✅国#"[1]".clusters().map(super).join()

Image

Background and previous discussion

The unexpected behaviour was described in #4203 and #5852, but they were closed in favor of #4006, which was in turn closed as a duplicate of #633.
However, this issue (occured in single citation) is more basic than #633 (occured in multiple superscripts), and be can be fixed before #633. Therefore, I recreate this one.

This issue was also recorded in §7.1 Citing of clreq-gap for typst.

The suggested change was came up in the forum, starting from this post.

Reproduction URL

No response

Operating system

Windows, Web app

Typst version

  • I am using the latest version of Typst

Activity

  1. added
    bug
    on Jun 27, 2025
  2. Enivex commented on Jun 27, 2025

    @Enivex
    Collaborator

    I'll close this as a duplicate of #633 since it'll soon be closed by #5777 anyway

  3. YDX-2147483647 commented on Jun 27, 2025

    @YDX-2147483647
    ContributorAuthor

    Thank you! I was aware of #5777, but I thought it won't fix this issue because its title seems irrelevant. I've just switched to that branch, and confirmed that it does fix.

    Image

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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions