-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Citation numbers are flying over their brackets in the superscript #6513
Description
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.
#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()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

