|
9 | 9 |
|
10 | 10 | #babel( |
11 | 11 | en: [ |
12 | | - Typst is a markup-based typesetting software, and this document describes gaps for the support of the Chinese script within Typst. |
| 12 | + Typst is a markup-based typesetting software, and this document describes gaps or shortcomings for the support of the Chinese script within Typst. |
13 | 13 | In particular, it is concerned with #link("https://www.w3.org/TR/clreq/")[text layout] and #link("https://std.samr.gov.cn/gb/search/gbDetailed?id=71F772D8055ED3A7E05397BE0A0AB82A")[bibliography]. |
14 | 14 | It examines whether needed features are supported by the typst compiler, and provides information on potential workarounds. |
15 | 15 | ], |
|
586 | 586 | >>> ] |
587 | 587 | ``` |
588 | 588 |
|
| 589 | +#babel( |
| 590 | + en: [The above simple examples demonstrate the principle, and the following complex examples are closer to practicality.], |
| 591 | + zh: [以上简单例子展示了原理,下面的复杂例子更接近实用], |
| 592 | +) |
| 593 | + |
| 594 | +```example |
| 595 | +>>> #set text(top-edge: "ascender", bottom-edge: "descender") |
| 596 | +>>> Current: |
| 597 | +#set par(justify: true) |
| 598 | +#block(width: 8em)[ |
| 599 | + 天生我材必有用,千金散尽还复来。烹羊宰牛且为乐,会须一饮三百杯。 |
| 600 | +] |
| 601 | +
|
| 602 | +>>> Expected: |
| 603 | +>>> #block(width: 8em)[ |
| 604 | +>>> 天生我材必有用,千金散尽还复来。烹羊宰牛且为乐,会须一饮三百杯#box[。]#linebreak(justify: true) |
| 605 | +>>> ] |
| 606 | +``` |
| 607 | + |
| 608 | +```example-page |
| 609 | +>>> // This example behaves differently in `example` and `example-page`. |
| 610 | +>>> #set text(top-edge: "ascender", bottom-edge: "descender") |
| 611 | +>>> Current: |
| 612 | +#set par(justify: true) |
| 613 | +#block(width: 12em)[ |
| 614 | + 每年的消费量约4,000吨,每年的消费量 |
| 615 | +] |
| 616 | +
|
| 617 | +>>> Expected: |
| 618 | +>>> #block(width: 12em)[ |
| 619 | +>>> 每年的消费量约4,000吨,每年的消费量#hide[约4,000吨#box[。]]#linebreak(justify: true) |
| 620 | +>>> ] |
| 621 | +``` |
| 622 | + |
589 | 623 | === #bbl(en: [Brackets at the beginning of paragraph], zh: [段首的方括号]) |
590 | 624 |
|
591 | 625 | #level.tbd |
@@ -968,6 +1002,35 @@ $ integral f dif x $ |
968 | 1002 | #bibliography(bytes(bib), style: "gb-7714-2015-numeric") |
969 | 1003 | ```` |
970 | 1004 |
|
| 1005 | +#babel( |
| 1006 | + en: [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.], |
| 1007 | + zh: [此一问题由字体不完善导致,但 typst 仍可改进默认处理方式。例如,只有`[1]`中所有字符都有专用上标版本时,才使用它。根据下例,`#super`已实现此机制,但`#cite`分别处理前缀(`[`)、数字(`1`)和后缀(`]`),导致绕开了这一机制。], |
| 1008 | +) |
| 1009 | + |
| 1010 | +````example-page |
| 1011 | +>>> Debug: |
| 1012 | +>>> #show regex("[✅❌]"): set text(fallback: true) |
| 1013 | +#set text(font: "Noto Serif CJK SC") |
| 1014 | +
|
| 1015 | +❌国@key |
| 1016 | +✅国#super("[1]") |
| 1017 | +❌国#"[1]".clusters().map(super).join() |
| 1018 | +
|
| 1019 | +#set super(typographic: false) |
| 1020 | +
|
| 1021 | +✅国@key |
| 1022 | +✅国#super("[1]") |
| 1023 | +✅国#"[1]".clusters().map(super).join() |
| 1024 | +
|
| 1025 | +>>> #show bibliography: none |
| 1026 | +>>> #let bib = ```bib |
| 1027 | +>>> @misc{key, |
| 1028 | +>>> title = {Title}, |
| 1029 | +>>> } |
| 1030 | +>>> ```.text |
| 1031 | +>>> #bibliography(bytes(bib), style: "gb-7714-2015-numeric") |
| 1032 | +```` |
| 1033 | + |
971 | 1034 | === #bbl(en: [Compression of continuous citation numbers], zh: [压缩连续的引用编号]) |
972 | 1035 |
|
973 | 1036 | #level.basic |
|
0 commit comments