如何在Quarto Typst文档中引用章节时显示编号加名称而非仅编号?
要实现英文下引用显示“A link to chapter 2 Second chp”,只需修改YAML配置,调整章节编号类型和交叉引用格式:
--- format: typst section-numbering: "chapter" crossref: chapters: ref-format: "number-title" --- # First chp A link to @sec-chp2 # Second chp {#sec-chp2}
关键修改点:
- 将
section-numbering: "1"改为"chapter",让一级标题被识别为**章节(chapter)**而非小节(section),引用前缀会从"Section"变为"chapter"。 - 添加
crossref配置,设置ref-format: "number-title",让引用同时显示章节编号和标题内容。
如果需要切换为中文显示(比如“链接到第2章 第二章”),只需补充语言设置和中文前缀后缀:
--- format: typst section-numbering: "chapter" language: zh-CN crossref: chapters: ref-prefix: "第" ref-suffix: "章" ref-format: "number-title" --- # 第一章 链接到 @sec-chp2 # 第二章 {#sec-chp2}
内容的提问来源于stack exchange,提问作者MartineJ
相关产品推荐
相关产品推荐

