See also §6.1 for features such as column layout, page turning direction, etc. that are affected by text direction.
分栏布局、翻页方向等也受文本方向影响,这些请参阅§6.1.
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Chinese Layout Gap Analysis for Typst.
分析 Typst 与中文排版的差距。
Typst is a markup-based typesetting software, and this document describes gaps or shortcomings for the support of the Chinese script within Typst. In particular, it is concerned with text layout and bibliography. It examines whether needed features are supported by the typst compiler, and provides information on potential workarounds.
Typst 是一款基于标记的排版软件,这份文档描述了它在中文支持方面的差距,特别是排版和参考文献著录。本文会检查 typst 编译器是否支持所需功能,并介绍可能的临时解决方案。
This document also attempts to prioritize the gaps in terms of the impact on Chinese end authors. The prioritization is indicated by colour, as shown in Table 1.
根据对中文最终作者的影响程度,本文还尝试给这些差距排出优先顺序。优先级用颜色表示,如 Table 1 所示。
⚠ This document is only an early draft. Additionally, it is not endorsed by either W3C or Typst GmbH. Please refer to it with caution.
⚠ 这份文档仅是早期草稿。此外,本文并无 W3C 或 Typst GmbH 背书。请谨慎参考。
See also §6.1 for features such as column layout, page turning direction, etc. that are affected by text direction.
分栏布局、翻页方向等也受文本方向影响,这些请参阅§6.1.
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
In what direction does text flow along a line and across a page? (If the basic direction is right-to-left see §1.2.) If the script uses vertically oriented text, what are the requirements? What about if you mix vertical text with scripts that are normally only horizontal? Do you need a switch to use different characters in vertical vs. horizontal text? Does typst support short runs of horizontal text in vertical lines (tate-chu-yoko in Japanese) as expected? Is the orientation of characters and the directional ordering of characters supported as needed?
文本在行内和跨页时分别沿什么方向书写?(若基本方向就时从右到左,请移步§1.2)如果文段可能沿竖直方向排列(直排),有哪些要求?若直排文段中混入其它文字,而这种文字通常水平书写,又如何?是否需要开关以在直排、横排时使用不同字符?typst 能否正常在直排文本中将小段文本按横排插入(日文的“纵中横”)?字符的朝向及排列方向符合需求吗?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced typst#5908
There are two writing modes in Chinese composition:
中文有两种行文模式:
Horizontal writing mode is the mainstream mode in Chinese Mainland, and is also commonly used for books on natural science in Hong Kong, Macao, Taiwan.
横排是中国大陆的主流方法,港澳台的自然科学类书籍也常用横排。
Vertical writing mode is the traditional mode for Chinese publications, and still stands as an important cultural characteristic of regions where Traditional Chinese is used.
直排是中文书籍的传统方法,仍是繁体中文通行地区的重要文化标志。
Compared with horizontal writing mode, vertical writing mode not only changes the direction of the text flow, but also adjusts the form, size, and position of punctuation marks (as shown in Figure 1 and Figure 2). Additionally, it requires adapting to mixed Chinese-Western text, captions of figures, multi-column layout, and more.
与横排相比,直排除了更改行文方向,还会调整标点符号的形态、尺寸、位置(如 Figure 1、Figure 2),此外还需适配中西混排、图表标题、分栏等。
Considering that typst currently struggles even with basic vertical typesetting, we will not cover issues related to vertical writing mode in the following sections.
鉴于 typst 目前连基础直排也难以实现,下文各节将不再讨论直排相关的问题。
If the general inline direction is right-to-left, are there any issues when handling that? Where the inline direction of text is mixed, is this bidirectional text adequately supported? What about numbers and expressions? Do the Unicode bidi controls and typst markup provide the support needed? Is isolation of directional runs problematic?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Not applicable
Do the standard fallback fonts used in typst match expectations? Is it convenient to select fonts?
typst 的标准回落字体符合预期吗?选择字体方便吗?
Advanced typst#5040 typst#5900 fix (doc-cn)
The default main text font in typst does not include Chinese characters. Therefore, when compiling locally, if you write Chinese without configuring any font using #set text(font: …)
, the fallback result may end up mixing fonts of different writing styles (as shown in Figure 3), making the text hard to read. Moreover, there is no warning or hint.
typst的正文默认字体不含汉字。因此本地编译时,若不用#set text(font: …)
配置字体就写中文,回落结果可能混合不同风格的字体(如 Figure 3),难以阅读,且无任何警告或提示。
Advanced typst#3385 fix (doc-cn)
This issue continues the above issue.
这一问题接续上一问题。
Apart from the main text, typst presets another font for raw
code blocks, which does not include Chinese characters either. Currently, this setting takes precedence over the main text font you specified, forcing you to re-declare the Chinese font by #show raw: set text(font: …)
.
在正文之外,typst对raw
代码块预设了另一字体,同样不含汉字。该设置目前优先于你指定的正文字体,导致必须用#show raw: set text(font: …)
再次指定中文字体。
正文汉字 vs. `let foo = "汉字"`
Advanced typst#366 fix (doc-cn)
This is a variant of the above issue in math.equation
.
这是以上问题在math.equation
数学公式的变体。
因此,
$ f(x) = y "(定义8)" $
Basic typst#794
For punctuation marks such as quotation marks (see §4.2), Chinese and Western scripts share the same Unicode code points, but require different glyph forms. Therefore, their fonts must be set respectively.
对于引号(见 §4.2)等标点符号,中西文在Unicode中共用码位w3c/clreq#534 ,但要求不同形态,故必须分开设置字体。
我说:“T'Pol 是‘虚构’人物!”
How are fonts grouped into recognisable writing styles? How is each writing style used? Are special font or OpenType features needed for this script that are not available? What other general, font-related issues arise? The font styles described here refer to alternative types of writing style, such as naskh vs nastaliq; for oblique, italic, and weights see instead §2.5.
字体如何分类成可辨识的字体风格?如何使用各类字体风格?这种文字是否还需要尚不可用的特定字体或 OpenType 特性? 还有哪些字体相关的一般问题?此处“字体风格”是指书写风格的不同变体,例如阿拉伯文中naskh与nastaliq;至于倾斜体(oblique)、意大利体(italic)以及各级字重,请移步§2.5。
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced typst#6295
It is common to use different fonts for Chinese and Western characters, and the visual sizes of different fonts may need to be fine-tuned for alignment.
中西文经常采用不同字体,而不同字体的视觉大小可能需要微调对齐。
共10人
Advanced typst#185 typst#6054 fix (github)
Variable fonts offer more creative possibilities and have higher storage efficiency. Given the vast number of Chinese characters, designing and storing traditional static fonts can be challenging — for example, a static Noto Sans CJK OTF/TTC is often ~100 MB. This makes variable fonts especially valuable for the Chinese language.
可变字体的创意可能性更多,并且存储效率更高。汉字数量庞大,设计、存储传统不可变字体都相对困难——例如不可变思源黑体一般有 ~100 MB,所以可变字体对中文有独特价值。
The current typst will render them as the lightest weight when exporting SVG, and turn them into tofus when exporting PDF or PNG.
目前 typst 导出 SVG 会渲染成最细字重,导出 PDF、PNG 会变成豆腐块。
#set text(font: "Source Han Serif SC VF")
可变字体
If context-sensitive rendering support is needed to shape combinations of letters or position certain glyphs relative to others, is this adequately provided for? Does the script in question require additional user control features to support alterations to the position or shape of glyphs, for example adjusting the distance between the base text and diacritics, or changing the glyphs used in a systematic way? Do you need to be able to compose/decompose conjuncts or ligatures, or show characters that are otherwise hidden, etc? If text is cursive, see the separate §2.4.
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Not applicable
If this script is cursive (ie. letters are generally joined up, like in Arabic, N’Ko, Syriac, etc), are there problems or needed features related to the handling of cursive text? Do cursive links break if parts of a word are marked up or styled? Do Unicode joiner and non-joiner characters behave as expected?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Not applicable
This covers ways of modifying the glyphs for a range of text, such as for italicisation, bolding, oblique, etc. Are italicisation, bolding, oblique, etc relevant? Do italic fonts lean in the right direction? Is synthesised italicisation or oblique problematic? Are there other problems relating to bolding or italicisation - perhaps relating to generalised assumptions of applicability? For alternative writing/font styles, see §2.2.
这节讨论针对一串文本的字形的修改方法,例如意大利体(italic)、粗体、倾斜体(oblique)等。是否有意大利体、粗体、倾斜体的概念?意大利体的倾斜方向正确吗?倾斜体(即伪意大利体)有问题吗?还有其它加粗、倾斜相关的问题吗——也许某些普遍假设并不适用?至于各类字体风格,请移步§2.2。
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Basic typst#394 fix (universe/cuti) fix (doc-cn)
Classic Chinese fonts often have only one level of text weight. Therefore, fake bold is crucial in practice.
传统中文字体通常只有单级字重,所以伪粗体在实用中很关键。
#set text(font: "SimSun")
想做出*最好的*灯泡。
Does your script need special text transforms that are not supported? For example, do you need to to convert between half-width and full-width presentation forms? Does your script convert letters to uppercase, capitalised and lowercase alternatives according to your typographic needs? How about other transforms?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Not applicable
Most languages are now supported by Unicode, but there are still occasional issues. In particular, there may be issues related to ordering of characters, or competing encodings (as in Myanmar), or standardisation of variation selectors or the encoding model (as in Mongolian). Are there any character repertoire issues preventing use of this script in typst? Do variation selectors need attention? Are there any other encoding-related issues?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced typst#5319 typst#5785
Ideographic Variation Sequence (IVS) is a mechanism for plain text specified by Unicode to change the glyph to be used to display a character. For more information, please refer to the FAQ on Unicode.org.
表意文字异体字序列(ideographic variation sequence, IVS)是 Unicode 定义的一种纯文本机制,可以更换某个字符显示用的异体字字形。更多信息请参考 Unicode.org 上的常见问题。
This issue is marked as advanced, because IVS is rarely used and can be replaced by settings such as #set text(lang: …, region: …)
.
这一问题算作 Advanced,因为 IVS 很少用,并且可用#set text(lang: …, region: …)
等设置替代。
Basic typst#6128 fix (universe/percencode)
In the typst document, if the URL of a link uses Chinese characters rather than escape sequences, then it will be wrong when viewing PDF in Safari. The UTF-8 encoded bytes are decoded as Latin-1.
在 typst 文档中设置链接的 URL 时,若不加转义,直接用汉字,那么用 Safari 查看 PDF 时会错。UTF-8 编码的字节被按 Latin-1 解码。
#link("https://w3c.github.io/clreq/home#discussions-讨论-討論")[Discussions 讨论 討論]
This is about how text is divided into graphemes, words, sentences, etc., and behaviour associated with that. Are there special requirements for the following operations: forwards/backwards deletion, cursor movement & selection, character counts, searching & matching, text insertion, line-breaking, justification, case conversions, sorting? Are words separated by spaces, or other characters? Are there special requirements when double-clicking or triple-clicking on the text? Are words hyphenated? (Some of the answers to these questions may be picked up in other sections, such as §5.1, or §5.6.)
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
OK
What characters are used to indicate the boundaries of phrases, sentences, and sections? What about other punctuation, such as dashes, connectors, separators, etc? Are there specific problems related to punctuation or the interaction of the text with punctuation (for example, punctuation that is separated from preceding text but must not be wrapped alone to the next line)? Are there problems related to bracketing information or demarcating things such as proper nouns, etc? Some of these topics have their own sections; see also §4.2, and §4.4.
表示短语、句子或段落的边界用什么字符?破折号、连接符、分隔符等其它标点符号呢?关于标点符号或,或者文字与标点符号相互作用,是否存在特定问题(例如某标点符号与前文分开,但不允许换至下一行)?专有名词等需要明确括住的信息,使用正常吗?其中部分话题有专门章节,参见§4.2、§4.4。
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
This is a subtopic of phrase & section boundaries that is worth handling separately. What characters are used to indicate quotations? Do quotations within quotations use different characters? What characters are used to indicate dialogue? Are the same mechanisms used to cite words, or for scare quotes, etc? What about citing book or article names? Are there any issues when dealing with quotations marks, especially when nested? Should block quotes be indented or handled specially? Do quotation marks take text direction into account appropriately?
有些短语或章节边界需要单独处理,本节讨论这方面话题。引语用什么字符标识?引文中的引文是否要用不同字符?对话用什么字符标识?引用单词(即 scare quotes)的方法相同吗?引用书籍或文章名标题呢?处理引号有无问题,特别是嵌套时?用于整段的引号需要缩进或特别处理吗?引号是否考虑了文本方向?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Basic typst#5858 fix (doc-cn)
Both Chinese and Western quotation marks (and apostrophes) use the same Unicode code points:
中西文的引号(及撇号)都使用相同Unicode码位:
‘
left single quotation mark’
right single quotation mark“
left double quotation mark”
right double quotation markBut punctuation in Chinese is usually supposed to be wider than that in Western languages. This cannot be achieved automatically yet.
但中文的标点通常应该比西文的宽。当前这还无法自动实现。
我说:“T'Pol 是‘虚构’人物!”
How are emphasis and highlighting achieved? If lines or marks are drawn alongside, over or through the text, do they need to be a special distance from the text itself? Is it important to skip characters when underlining, etc? How do things change for vertically set text?
如何强调或突出显示一串文本?若在文字旁边、文字上方上方或穿过文字划线或者做标记,是否需与文字保持特定距离?加下划线时是否需要跳过某些字符?直排时规则又如何?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced typst#1210 typst#1716 (comment) fix (doc-cn)
Unlike the Latin alphabet, Chinese characters have no concept of ascenders and descenders. Therefore, underlines in Chinese should be drawn completely below the glyphs. Additionally, it is common to use different fonts for Chinese and Western characters, creating more difficulties in aligning the underline.
与拉丁字母不同,汉字没有升降部的概念,所以中文的下划线应当完全在字符之下。此外,中西文常用不同字体,导致下划线更难对齐。
#underline[中文和English]
What characters or other methods are used to indicate abbreviation, ellipsis & repetition? Are there problems?
缩写、省略和重复用什么字符或方法表示?有问题吗?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
What mechanisms, if any, are used to create inline notes and annotations? Are the appropriate methods for inline annotations supported for this script? Both Hanyu Pinyin (Romanization) and Bopomofo (Phonetic Symbols) are included. This section deals with inline annotation approaches. For annotation methods where a marker in the text points out to another part of the document, see §6.3.
如果这种文字有行内注与行间注,分别采用什么机制?相关方法是否支持?汉语拼音、注音符号都算在内。本节关注行内注释;至于指向文档其它部分的注释,请参考§6.3。
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced typst#1489
Advanced typst#193 (mentioned)
This section is a catch-all for inline features that do not fit under the previous sections. It can also be used to describe in one place a set of general requirements related to inline features when those features appear in more than one of the sections above. It covers characters or methods (eg. text decoration) that are used to convey information about a range of text. Are all needed forms of highlighting or marking of text available, such as wavy underlining, numeric overbars, etc. If lines are drawn alongside, over or through the text, do they need to be a special distance from the text itself? Is it important to skip characters when underlining, etc? How do things change for vertically set text? Are there other punctuation marks that were not covered in preceding sections? Are lines correctly drawn relative to vertical text?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
Relevant here are formats related to number, currency, dates, personal names, addresses, and so forth. If the script has its own set of number digits, are there any issues in how they are used? Does the script or language use special format patterns that are problematic (eg. 12,34,000 in India)? What about date/time formats and selection - and are non-Gregorian calendars needed? Do percent signs and other symbols associated with number work correctly, and do numbers need special decorations, (like in Ethiopic or Syriac)? How about the management of personal names, addresses, etc. in typst: are there issues?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
OK
#numbering("一", 299792458)
#numbering("壹", 299792458)
Natively supported. Mentioned here to prevent future people from reimplementing it.
内置支持。为避免又有人不知道而重复开发,提及一下。
Advanced typst#6484 fix (universe/conjak)
The characters used for numbers are not identical between traditional and simplified Chinese, but there is no mechanism to distinguish them yet.
繁简中文数字所用字符不完全一致,但尚无机制区分。
#set text(lang: "zh", region: "TW")
#numbering("壹", 2 * calc.pow(10, 8))
The expected output may vary with regions and personal preferences. For example, #numbering("壹", 3)
can be written in multiple ways such as U+53c1 叁
, U+53c3 參
, U+53c4 叄
.
具体期望结果可能还有地区变体和个人偏好变体,例如#numbering("壹", 3)
会有 U+53c1 叁
、U+53c3 參
、U+53c4 叄
多种写法。
Does typst capture the rules about the way text in your script wraps when it hits the end of a line? Does line-breaking wrap whole words at a time, or characters, or something else (such as syllables in Tibetan and Javanese)? What characters should not appear at the end or start of a line, and what should be done to prevent that? Is hyphenation used for your script, or something else? If hyphenation is used, does it work as expected? (Note, this is about line-end hyphenation when text is wrapped, rather than use of the hyphen and related characters as punctuation marks.)
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
OK
When text in a paragraph needs to have flush lines down both sides, does it follow the rules for your script? Does the script need assistance to conform to a grid pattern? Does your script allow punctuation to hang outside the text box at the start or end of a line? Where adjustments are need to make a line flush, how is that done? Do you shrink/stretch space between words and/or letters? Are word baselines stretched, as in Arabic? What about paragraph indents, or the need for logical alignment keywords, such as start/end, rather than left/right? Does the script indent the first line of a paragraph?
若一段内的文字需要两端对齐,结果是否符合这种文字的习惯?文字是否需要辅助才能符合网格模式?这种文字允许标点符号在一行头尾悬挂到文本框以外吗?需要对齐某条线时,应当如何操作?正常会伸缩词间距、字间距吗?是否会像阿拉伯文那样拉伸文字基线?段落缩进如何,而逻辑对齐关键字(例如start
/end
而非left
/right
)又如何?这种文字是否缩进段落首行?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
As the above example, the frame grid is the conventional typesetting mechanism in Chinese. It is difficult to strictly implement the mechanism in current typst. People usually #set par(justify: true)
to achieve similar results. However, this workaround can lead to several issues in this section.
如上例,中文习惯按稿纸网格排版。这目前在 typst 中难以严格实现,通常变通设置#set par(justify: true)
。然而这权宜之计触发了本节若干问题。
Furthermore, as illustrated in the following example, since Chinese characters are square-shaped, simple texts can often be aligned acceptably (and occasionally better) using the default justify: false
. Only in complex cases—such as when text includes numbers, mathematical formulae, acronyms, or Western words—is it necessary to set justify: true
. Nevertheless, for the sake of simplicity and robustness, we will continue to use simple text to demonstrate issues.
此外如下例,由于汉字是方块字,若文本比较简单,默认justify: false
即可对齐(有时效果还更好);只有遇到数字及数学公式、首字母缩写甚至西文单词等复杂情况时,才必须justify: true
。不过为了简洁可靠,以下演示问题仍会采用简单文本。
Advanced typst#6062
#set par(justify: true)
#block(width: 3em)[第1回成段]
Advanced typst#4404
#set par(justify: true)
#block(width: 7.5em)[
天生我材必有用千金散尽还复来烹羊宰牛且为乐会须一饮三百杯
]
The above simple examples demonstrate the principle, and the following complex examples are closer to practicality.
以上简单例子展示了原理,下面的复杂例子更接近实用
#set par(justify: true)
#block(width: 8em)[
天生我材必有用,千金散尽还复来。烹羊宰牛且为乐,会须一饮三百杯。
]
#set par(justify: true)
#block(width: 12em)[
每年的消费量约4,000吨,每年的消费量
]
To be done typst#4011
Advanced typst#2348
#set par(justify: true)
《新生》的出版之期接近了……
#set par(first-line-indent: 2em)
《新生》的出版之期接近了……
Basic typst#3206 fix (doc-cn)
Figures, lists and block equations will break the paragraph, causing the following text to start a new paragraph. This becomes visually noticeable when a first-line indent is applied. In Chinese, it is common practice to use a 2-em first-line indent, making this issue particularly apparent.
图表、列表、块级公式会终结段落,导致后文另起一段。若设置了首行缩进,换段会很明显。而中文出版物普遍设置首行缩进两字,导致这一问题尤为突出。
#set par(first-line-indent: (amount: 2em, all: true))
段首起始该缩进
$ integral f dif x $
此处应当仍在段内,不该缩进。
Advanced fix (doc-cn) fix (universe/tricorder)
Even inter-character spacing means letting several Chinese characters to occupy a fixed width and be evenly distributed.
均排是指让几个汉字占固定宽度并均匀分布。
丁声树 黎锦熙 \
李荣 陆志韦
This section is concerned with spacing that is adjusted around and between characters on a line in ways other than attempts to fit text to a given width (ie. justification). Some scripts create emphasis or other effects by spacing out the words, letters or syllables in a word. Are there requirements for this script/language that are unsupported? If spacing needs to be applied between letters and numbers, is that possible? What about space associated with punctuation, such as the gap before a colon in French? (For justification related spacing, see §5.2.)
本节关注要使文本适应指定长度(对齐)时,如何在字符之间和字符周围添加空隙。有些文字通过空出单词、字母、音阶来表达强调等效果。能否满足这种语言文字的需求?若需在字母、数字间加空,能否做到?像法文冒号前间距那种标点符号相关的空隙呢?(关于对齐相关的间距,请见§5.2。)
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
raw
raw
两边缺少中西间距Advanced typst#2702 fix (doc-cn)
汉字`(code)`汉字
Advanced typst#2703 fix (doc-cn)
汉字$A$汉字
Advanced typst#6539
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.
若在汉字和拉丁字母间手动换行,typst 会插入多余中西间距。如果文本右对齐或居中对齐,这个间距会显现出来。
#set text(cjk-latin-spacing: auto)
#box(width: 3em, stroke: (right: green), align(right, [国国\ TT]))
#show
#show
会打断标点挤压Basic typst#5474
噫)。嘘).唏
#show "。": "."
噫)。嘘).唏
Does typst support requirements for baseline alignment between mixed scripts and in general? Are there issues related to line height or inter-line spacing, etc.? Are the requirements for baseline or line height in vertical text covered?
typst能否对齐多文种的基线?行高、行距等方面有无问题?直排时的基线、行高能否满足要求?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Basic typst#5644 fix (doc-cn)
Unlike the Latin alphabet, Chinese characters have no concept of ascenders and descenders. So even though the numerical values of the leading are the same, the visual spacing of Chinese is smaller than that of Western text.
与拉丁字母不同,汉字没有升降部的概念。所以尽管行距的数值相同,中文的视觉效果会比西文紧。
Typst 国王 \
Typst 国王
Are there list or other counter styles in use? If so, what is the format used and can that be achieved? Are the correct separators available for use after list counters? Are there other aspects related to counters and lists that need to be addressed? Are list counters handled correctly in vertical text?
是否使用列表或其它编号样式?若是,使用什么格式,能否实现?列表编号后的分隔符是否正确?编号、列表的其它方面还有要解决的吗?直排时列表编号是否正常?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
list
和enum
的编号与内容未对齐基线Basic typst#1204 typst#1610 fix (doc-cn)
This issue occurs when the marker and the content have different heights. It is common in mixed Chinese-Western text layouts to use different fonts for Chinese and Western characters. As a result, the height of Western (numeric) markers is likely to differ from that of the Chinese content, triggering the issue.
这一问题的触发条件是编号和内容的高度不同。而中西混排场景中,中西文经常采用不同字体,导致西文(数字)编号与中文内容很可能不一样高,从而触发问题。
#set text(font: (
(name: "New Computer Modern", covers: "latin-in-cjk"),
"SimSun",
))
+ 鲁镇的酒店的格局,是和别处不同的。
Basic typst#5778 fix (doc-cn)
In Chinese, the chapter number and its title are typically separated by the secondary comma U+3001 、
ideographic comma. Unlike the dot .
used in formats like 1. Title
, no extra space should follow the 、
in examples such as 一、标题
. However, typst puts a hard-coded 0.3-em space here.
中文通常习惯用顿号 U+3001 、
ideographic comma 分隔章号和标题。与1. Title
这种格式中的.
不同,一、标题
中的、
后不应再插入空格。然而 typst 在这里硬编码插入了宽 0.3 em 的空格。
#set heading(numbering: "一、")
= 标题
Advanced typst#6527 fix (github)
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., U+3001 、
ideographic comma.
heading.hanging-indent
默认为auto
,表示标题从第二行起按编号的宽度缩进。然而若编号以全宽标点结尾,例如 U+3001 、
ideographic comma,那么auto
得出的宽度并不准确。
#set page(width: 5 * 12pt + 2 * 1em, margin: 1em)
#show heading: set text(12pt)
#set heading(numbering: "一、")
= 寻寻觅觅
Does typst correctly handle special styling of the initial letter of a line or paragraph, such as for drop caps or similar? How about the size relationship between the large letter and the lines alongside? where does the large letter anchor relative to the lines alongside? is it normal to include initial quote marks in the large letter? is the large letter really a syllable? etc. Are all of these things working as expected?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
How are the main text area and ancillary areas positioned and defined? Are there any special requirements here, such as dimensions in characters for the Japanese kihon hanmen? The book cover for scripts that are read right-to-left scripts is on the right of the spine, rather than the left. Is that provided for? When content can flow vertically and to the left or right, how do you specify the location of objects, text, etc. relative to the flow? For example, keywords left
and right
are likely to need to be reversed for pages written in English and page written in Arabic. Do tables and grid layouts work as expected? How do columns work in vertical text? Can you mix block of vertical and horizontal text correctly? Does text scroll in the expected direction? Other topics that belong here include any local requirements for things such as printer marks, tables of contents and indexes. See also §6.2.
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced fix (universe/pointless-size)
号数制 (hào-system, or number system) is the system to specify text size in Chinese and Japanese typesetting. The unit is not linearly related to points: 五号 (size 5) = 10.5 pt, 小四 (size small 4) = 12 pt, 四号 (size 4) = 14 pt… The hào-system is still commonly used in China. An average person may be familiar with the size of 小四, but likely has little intuition about 12 pt without referring to a conversion table..
号数制是中文和日文排版中指定字号的系统。这种单位无法线性转换成点数:五号 = 10.5点,小四 = 12点,四号 = 14点……号数制在中国仍然普遍使用。普通人通常理解小四字多大,但可能对 12 pt 没有直观感受,除非查阅转换表。
The following is a typical conversion table in Chinese.
中文典型转换表如下。
This issue should have been marked as Basic. However, considering that the hào-system was not standardized by the various foundries in the past (for example, nowadays, 四号 is 14 pt in CTeX, MS Word, WPS, and Adobe, but others may prefer 13.75 pt), we mark it as Advanced for the moment.
这一问题本该算作 Basic,但由于号数制当年在各地金属活字厂家并未统一(例如今日 CTeX、MS Word、WPS、Adobe 的四号是14点,但其它可能用13.75点),暂且算作 Advanced。
Advanced
In Chinese typography, line length should be multiples of the character size. Otherwise, several alignment issues described in §5.2 may occur.
中文排版中,一行的行长应为文字尺寸的整数倍,不然容易触发 §5.2 中的若干对齐问题。因此通常“先确定版心,再余出空白”,而不是“先确定边距,再剩出版心”。
// Current:
#set page(paper: "a4", margin: (x: (210mm - 42em) / 2))
// Expected to be easier:
#set page(paper: "a4", inner-width: 42em)
As a subtopic of page layout, does the script have special requirements for character grids or for tables?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
Does your script have special requirements for footnotes, endnotes or other necessary annotations of this kind in the way needed for your culture? (See §4.5 for purely inline annotations, such as ruby or warichu. This section is more about annotation systems that separate the reference marks and the content of the notes.)
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
Are there special conventions for page numbering, or the way that running headers and the like are handled?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
Are vertical form controls well supported? In right-to-left scripts, is it possible to set the base direction for a form field? Is the scroll bar on the correct side? etc. Are there other aspects related to user interaction that need to be addressed?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
To be done
Is there any difficulty in complying with the Chinese national standard GB/T 7714—2015 Information and documentation—Rules for bibliographic references and citations to information resources (PDF)?
遵守中国国家标准 GB/T 7714—2015《信息与文献 参考文献著录规则》(PDF)有无困难?
GB/T 7714—2015 specifies the following three citation styles. Each style uses a dedicated citing format in the main text, and the bibliography list at the end also arranges differently. However, the rules on recording each individual work are identical.
GB/T 7714—2015 规定了以下三种标注方法。各方法采用不同的正文引注样式,末尾参考文献表的排布方式也不尽相同;不过,每项文献的著录规则完全相同。
The first style is the most widely used. The following sections will refer to this method unless otherwise specified.
第一种方法应用最广。下文默认指这种方法。
Is it possible to cite a work in the main text using cite
? Does the result meet expectations?
能否用cite
在正文中标注参考文献?结果符合预期吗?
OK typst#633 typst#6513 typst#4203 typst#5777 fix (doc-cn)
Fixed in dev! (it is Basic in v0.13.1) 已于开发版修复!(v0.13.1 为 Basic)
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.
gb-7714-2015-numeric
样式会用括号包裹引用编号(例:[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")
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.
此一问题由字体不完善导致,但 typst 仍可改进默认处理方式。例如,只有[1]
中所有字符都有专用上标版本时,才使用它。根据下例,#super
已实现此机制,但#cite
分别处理前缀([
)、数字(1
)和后缀(]
),导致绕开了这一机制。
#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()
Basic hayagriva#189 (mentioned)
Compression should start from two citations., but the current threshold is three.
压缩应从两篇文献开始,而目前是从三篇开始。
两篇@a @b \
三篇@a @b @c
#let bib = (
"abc".clusters().map(n => "@misc{[n], title = {Title}}".replace("[n]", n)).sum()
)
#bibliography(bytes(bib), style: "gb-7714-2015-numeric")
Broken fix (doc-cn)
Both the superscript and non-superscript forms are needed in practice.
实际中,上标、非上标两种引用形式都需要。
孔乙己@key,另见#cite(<key>, form: "prose-short")。
Advanced fix (forum)
初次@a[260] \
再次@a[326--329] @b @c @d
#let bib = (
"abcd".clusters().map(n => "@misc{[n], title = {Title}}".replace("[n]", n)).sum()
)
#bibliography(bytes(bib), style: "gb-7714-2015-numeric")
This issue is marked as advanced, because citing with page number is not common. According to GB/T 7714—2015 §10.1.3, in most cases, page numbers should be recorded in the bibliography list. Citing with page number is only necessary when the work is cited multiple times with different page numbers.
这一问题算作 Advanced,因为带页码引用并不常见。根据 GB/T 7714—2015 §10.1.3,大多数情况下页码应当记录在参考文献表中;只有多次引用同一文献的不同页码时,才需在引用处标注页码。
Can bibliography
generate a bibliography / reference listing at the end of the article or the page? Does each entry have all parts? Does the citation format meet the standard?
用bibliography
能否在文末或页脚正常生成参考文献表?著录项目完整吗?著录格式符合标准吗?
et al.
for English and 等
for Chinese 英文用et al.
,中文用等
Broken citationberg#5 hayagriva#291 typst#3168 nju-lug/modern-nju-thesis#3 csimide/SEU-Typst-Template#1 biblatex#78 hayagriva#126 fix (doc-cn) fix (universe/modern-nju-thesis)
It is extremely common to cite both Chinese and English works in an article. For multi-author literature, some authors may be omitted. In such cases, we should use et al.
for English and 等
for Chinese.
一篇文章同时引用中英文献极其常见。多著者文献可能省略部分作者,这时英文应加et al.
,中文应加等
。
Currently, #set text(lang: …)
can select et al.
(en) or 等
(zh) for all entries, but it is not possible to set each entry individually.
当前可用#set text(lang: …)
统一选择et al.
(en)与等
(zh),但无法逐文献设置。
@article{吴伟仁2017,
title = {“嫦娥4号”月球背面软着陆任务设计},
author = {{吴伟仁} and {王琼} and {唐玉华} and {于国斌} and {刘继忠} and {张玮} and {宁远明} and {卢亮亮}},
date = {2017-01},
journaltitle = {深空探测学报},
volume = {4},
number = {2},
pages = {111--117},
doi = {10.15982/j.issn.2095-7777.2017.02.002},
langid = {chinese}
}
@article{su2025,
title = {South {{Pole}}–{{Aitken}} Massive Impact 4.25 Billion Years Ago Revealed by {{Chang}}'e-6 Samples},
author = {Su, Bin and Chen, Yi and Wang, Zeling and Zhang, Di and Chen, Haojie and Gou, Sheng and Yue, Zongyu and Liu, Yanhong and Yuan, Jiangyan and Tang, Guoqiang and Guo, Shun and Li, Qiuli and Lin, Yang-Ting and Li, Xian-Hua and Wu, Fu-Yuan},
date = {2025-03-20},
journaltitle = {National Science Review},
shortjournal = {Natl. Sci. Rev.},
pages = {nwaf103},
issn = {2095-5138},
doi = {10.1093/nsr/nwaf103},
langid = {english},
}
institution
and school
are not shown institution
机构名称和school
学校名称不显示Broken hayagriva#112 fix (doc-cn)
institution
and school
are not recognized as aliases of publisher
, and typst does not understand institute
in CSL either. The school
field is conventionally associated with @thesis
([D]
), and the institute
field with @report
([R]
). These fields should be placed between the location and the date after [D]
/[R]
.
institution
机构名称和school
学校名称未被识别成publisher
的别名,typst 亦不支持解析 CSL 中的 institution
。school
字段常用于学位论文@thesis
([D]
),institute
字段常用于报告@report
([R]
),它们应显示在[D]
/[R]
后的地点与日期之间。
@report{report,
author = {Robert Swearingen},
title = {Morphology and syntax of British sailors’ English},
series = {Technical Report},
number = {249},
institution = {Profanity Institute},
address = {New York},
year = {1985},
}
@thesis{王楠2016,
title = {在“共产主义视镜”下想象科学——“十七年”期间的中国科幻文学与科学话语},
author = {王楠},
date = {2016-08-05},
institution = {新加坡国立大学},
location = {新加坡},
url = {https://scholarbank.nus.edu.sg/handle/10635/132143},
urldate = {2025-02-15},
langid = {chinese}
}
Basic fix (doc-cn)
@phdthesis{alterego,
type = {{超高校级学位论文}},
title = {{基于图书室的笔记本电脑的 Alter Ego 系统}},
author = {不二咲, 千尋},
year = {2010},
address = {某地},
school = {私立希望ヶ峰学園},
publisher = {私立希望ヶ峰学園},
pages = {1--3, 5},
}
gb-7714-2015-author-date
采用gb-7714-2015-author-date
时,中文文献应按著者汉语拼音字顺或笔画笔顺排列Advanced hayagriva#259 hayagriva#193
The style gb-7714-2015-author-date
currently sorts works by Unicode code points. However, according to the standard, when using this style, the cited works should first be grouped by scripts, then arranged by author names and publication dates. For Chinese works, they may be ordered by either pinyin or strokes.
目前gb-7714-2015-author-date
样式按Unicode码位排序。而标准规定,采用这种样式时,各篇文献首先按文种集中,然后按著者字顺和出版年排列,其中中文文献可按著者汉语拼音字顺或笔画笔顺排列。
gb-7714-2015-note
is totally broken gb-7714-2015-note
完全无法使用Advanced hayagriva#189 (mentioned)
The references need only be listed in the footnotes, and should not be repeated at the end of the article. 文献只需在脚注列出,无需在文末重复。
If the same work is cited multiple times, then its footnote should be repeated in most cases. 若一篇文献被重复引用,则大多数情况下,相应脚注也应重复。
孔乙己@key \
上大人@key
#let bib = ```bib
@misc{key,
author = {Author},
title = {Title},
date = {2025-06-17},
}
```.text
#bibliography(bytes(bib), style: "gb-7714-2015-note")
Are there difficulties creating files related to bibliography? Including the database of reference entires (Hayagriva *.yml
, BibTeX *.bib
) and the Citation Style Language style *.csl
.
准备参考文献相关的文件是否存在困难?包括参考文件数据库(Hayagriva *.yml
、BibTeX *.bib
)和 Citation Style Language 样式 *.csl
。
@standard
is not correctly interpreted @standard
被错误解释Basic hayagriva#312
@standard
is the [S]
type in GB/T 7714—2015. It is a regular type in CSL, and a non-standard type in BibTeX (but accepted by biber). However, typst interprets it as @misc
([Z]
) or @webpage
([EB]
).
@standard
是 GB/T 7714—2015 里的[S]
类型文献。它在 CSL 中是个正常类型,不过并非 BibTeX 的标准类型(但 biber 支持)。然而 typst 将它解释为@misc
([Z]
)或@webpage
([EB]
)。
@standard{DASH,
title = {Information Technology — {{Dynamic}} Adaptive Streaming over {{HTTP}} ({{DASH}}) — {{Part}} 1: {{Media}} Presentation Description and Segment Formats},
author = {{ISO/IEC}},
date = {2022-08},
number = {ISO/IEC 23009-1:2022(E)},
publisher = {International Organization for Standardization},
url = {https://www.iso.org/standard/83314.html},
pubstate = {Published},
version = {5},
}
Advanced fix (doc-cn)
The compiler does not support the CSL-M standard yet, nor is it compatible with some extensions of citeproc-js.
编译器暂不支持 CSL-M 标准,也不兼容 citeproc-js 的一些扩展。
Sometimes a script or language does things that are not common outside of its sphere of influence. This is a loose bag of additional items that were not previously mentioned. This section may also be relevant for observations related to locale formats (such as number, date, currency, format support).
有时语言文字会其有特殊做法。本节兜底补充,覆盖上文未提及的特殊情况。本节也可讨论本地化格式(如数字、日期、货币)的支持情况。
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Broken typst#5102 typst#2485 (mentioned)
When referencing chapters and sections in Chinese, it is standard to write 第一章
or 2.1小节
, while forms like 小节2.1
are rarely used, and 章一
is virtually nonexistent. Therefore, the supplement
parameter of ref
or heading
is useless for Chinese, making it inevitable to use #show ref: it => …
.
引用章节时,中文通常写第一章
或2.1小节
,而几乎不写小节2.1
,更不会写章一
。因此,中文无法使用ref
或heading
的supplement
参数,必须#show ref: it => …
。
Literal meanings: 字面含义:
第一章
—— number one chapter2.1小节
—— 2.1 tiny section小节2.1
—— tiny section 2.1章一
—— chapter one#set heading(numbering: "1.1")
== 标题 <sec>
见@sec。
Besides, defining a show rule to replace ref
with link(it.element.location(), …)
will cause other problems, such as difficulty in coloring link
and ref
separately.
此外,若在 show 规则中用link(it.element.location(), …)
替代ref
,又会引发其它问题,例如难以给link
、ref
分别上色。
Advanced fix (doc-cn)
There are many other modules and specifications which may need review for script-specific requirements. What else is likely to cause problems for worldwide usage of typst, and what requirements need to be addressed to make typst function well locally?
(derived from a W3C document under its license) (按相应协议修改自 W3C 文档)
Advanced typst#792 fix (doc-cn) fix (universe/cjk-unbreak)
测试一下,
效果怎么样。
This issue is marked as advanced, because not all people want this behaviour.
这一问题算作 Advanced,因为并非所有人都想要这种行为。
Advanced fix (doc-cn)
The spell checker embedded in the webapp does not support Chinese, marking all characters as misspelled, as shown in Figure 4.
webapp 内嵌的拼写检查器不支持中文,每个字都会被标为拼写错误,如 Figure 4。
Advanced typst#6460
At present, there are no relevant methods, no matter the messages come from the core compiler or third-party packages.
尚无任何相关措施,无论报错发自核心编译器还是第三方包。
Update date 更新日期
2025-07-06
Compiler 编译器
typst v0.13.1
Document version 文档版本
commit 73b3a693 (main) (log)
commit 73b3a693e3623debd682ca985d2904d6055db464
Author: Y.D.X. <73375426+YDX-2147483647@users.noreply.github.com>
AuthorDate: 2025-07-07 06:29:57 +0800
Commit: GitHub <noreply@github.com>
CommitDate: 2025-07-07 06:29:57 +0800
Merge pull request #30 from YDX-2147483647/main
docs: variants of traditional Chinese numbers
Default fonts 默认字体
New Computer Modern, Noto Serif CJK SC
W3C documents W3C 文档
Standards 标准
Reference implementations 参考实现
biblatex-gb7714-2015
, A BibLaTeX implementation of the GB/T 7714—2015 bibliography style for Chinese users 符合 GB/T 7714—2015 标准的 biblatex 参考文献样式 (TeXdoc PDF)Content
Live long
Documentation