Skip to content

Commit ee1523a

Browse files
docs: citation form, auto hanging indent, cjk-latin space at \
Relates-to: typst/typst#6527 Relates-to: typst/typst#6539 Closes typst-doc-cn#26
1 parent 9ed8a64 commit ee1523a

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ A simple typst example.
5858

5959
👀 shown as the source, but 🛑 not executed in the preview.
6060

61-
#### Limitations
61+
#### Limitations and caveats
6262

6363
Simple examples are evaluated in a container and their states are shared across the entire document.
6464

@@ -72,9 +72,13 @@ As a result:
7272

7373
- Citations and bibliographies will conflict with other examples.
7474

75+
- The default configuration values are those specified in `raw`, which may differ from the defaults in regular documents.
76+
77+
For example, the default `text.cjk-latin-spacing` is typically `auto`, but here it is `none`.
78+
7579
-
7680

77-
If you need advanced features, please write a page example instead.
81+
If you require advanced features or 100% accuracy, please write a page example instead.
7882

7983
### Page examples (`example-page`)
8084

main.typ

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@
677677
```
678678

679679
```example-page
680-
>>> // This example behaves differently in `example` and `example-page`.
680+
>>> // This example behaves differently in `example` and `example-page` because of cjk-latin-spacing.
681681
>>> #set text(top-edge: "ascender", bottom-edge: "descender")
682682
>>> Current:
683683
#set par(justify: true)
@@ -816,6 +816,25 @@ $ integral f dif x $
816816
>>> 汉字#h(0.25em)$A$#h(0.25em)汉字
817817
```
818818

819+
=== #bbl(en: [Redundant CJK-Latin space at manual line breaks], zh: [人为换行时多余中西间距])
820+
821+
#level.advanced
822+
#issue("typst#6539")
823+
824+
#babel(
825+
en: [If the line is manually broken between a CJK and a Latin character, then typst will insert an extra CJK-Latin space. This space becomes noticeable when text is aligned to the right or center.],
826+
zh: [若在汉字和拉丁字母间手动换行,typst 会插入多余中西间距。如果文本右对齐或居中对齐,这个间距会显现出来。],
827+
)
828+
829+
```example
830+
>>> Current: \
831+
#set text(cjk-latin-spacing: auto)
832+
#box(width: 3em, stroke: (right: green), align(right, [国国\ TT]))
833+
834+
>>> Expected: \
835+
>>> #box(width: 3em, stroke: (right: green), align(right, [国国TT]))
836+
```
837+
819838
=== #bbl(en: [Punctuation compression is interrupted by `#show`], zh: [`#show`会打断标点挤压])
820839

821840
#level.basic
@@ -957,6 +976,31 @@ $ integral f dif x $
957976
>>> = 一、标题
958977
```
959978

979+
=== #bbl(en: [The auto hanging indents of multiline headings are inaccurate], zh: [多行标题的自动悬挂缩进不准确])
980+
981+
#level.advanced
982+
#issue("typst#6527")
983+
#workaround("https://github.com/typst/typst/issues/6527#issuecomment-3026200835")
984+
985+
#babel(
986+
en: [The default value of `heading.hanging-indent` is `auto`, which indicates that the subsequent heading lines will be indented based on the width of the numbering. However, the `auto` width is not accurate if the numbering ends with a full-width punctuation, e.g., #unichar("").],
987+
zh: [`heading.hanging-indent`默认为`auto`,表示标题从第二行起按编号的宽度缩进。然而若编号以全宽标点结尾,例如 #unichar(""),那么`auto`得出的宽度并不准确。],
988+
)
989+
990+
```example-page
991+
#set page(width: 5 * 12pt + 2 * 1em, margin: 1em)
992+
#show heading: set text(12pt)
993+
994+
>>> #show heading: pad.with(top: -0.75em)
995+
>>> Current:
996+
#set heading(numbering: "一、")
997+
= 寻寻觅觅
998+
999+
>>> Expected:
1000+
>>> #set heading(numbering: none, hanging-indent: 2em)
1001+
>>> = 一、寻寻觅觅
1002+
```
1003+
9601004
== Styling initials <initials>
9611005

9621006
#prompt(from-w3c: "https://www.w3.org/TR/clreq-gap/#initials")[
@@ -1232,7 +1276,7 @@ $ integral f dif x $
12321276

12331277
````example-page
12341278
>>> Expected: \
1235-
<<< 孔乙己@key,另见文献~#parencite(<key>)。
1279+
<<< 孔乙己@key,另见#cite(<key>, form: "prose-short")。
12361280
>>> 孔乙己#super[[1]],另见文献#h(0.25em)#[[1]]。
12371281
````
12381282

0 commit comments

Comments
 (0)