This issue was originally reported by 液氦杯面🍜 in the Chinese community.
A CSL may specify vertical-align="sup" to render citations in superscripts. gb-7714-2015-numeric is an example.
For such styles, cite(form: "prose") puts the citation number in a superscript, but puts the affixes on the baseline. That looks ugly.
I suggest we include the affixes in the superscript.
Minimal example
test.csl
<?xml version="1.0" encoding="utf-8"?>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0">
<info>
<title/>
<id/>
<category citation-format="numeric"/>
</info>
<citation>
<layout vertical-align="sup" prefix="[" suffix="]">
<text variable="citation-number"/>
</layout>
</citation>
<bibliography >
<layout>
<names variable="author"/>
</layout>
</bibliography>
</style>
- Normal form @a
- Prose form: #cite(<a>, form: "prose")
#bibliography(
bytes("@article{a, author = {Author}}"),
style: "test.csl",
)
Typst v0.15.1 paged output:
Typst v0.15.1 HTML output (This eliminates the possibility of font issues):
<ul>
<li>Normal form<sup role="doc-biblioref">[</sup><a href="#loc-1" role="doc-biblioref"><sup>1</sup></a><sup role="doc-biblioref">]</sup></li>
<li>Prose form: <a href="#loc-1" role="doc-biblioref">Author [<sup>1</sup>]</a></li>
</ul>
Expected output:
Relevant code
|
// Print the label. |
|
if let Some(prefix) = self.csl.citation.layout.prefix.as_ref() { |
|
ctx.push_str(prefix); |
|
} |
|
do_regular(&mut ctx); |
|
if let Some(suffix) = self.csl.citation.layout.suffix.as_ref() { |
|
ctx.push_str(suffix); |
|
} |
A CSL may specify
vertical-align="sup"to render citations in superscripts.gb-7714-2015-numericis an example.For such styles,
cite(form: "prose")puts the citation number in a superscript, but puts the affixes on the baseline. That looks ugly.I suggest we include the affixes in the superscript.
Minimal example
test.csl
Typst v0.15.1 paged output:
Typst v0.15.1 HTML output (This eliminates the possibility of font issues):
Expected output:
Relevant code
hayagriva/src/csl/mod.rs
Lines 1847 to 1854 in 9781848