KScript 文档
ZH

文档:KScript.Document

引用与参考文献

使用 [@key] 进行引用。引用来源可以来自 BibTeX 文件、Source 元素,或两者兼用:

<KScript.Document template="paper" title="Cited" to="'cited.pdf'">
  <Paragraph>Life is universal [@berlekamp1982; @rendell2002].</Paragraph>

  <Bibliography path="refs.bib">
    <Source id="rendell2002" type="inproceedings" author="Paul Rendell" title="Turing Universality of the Game of Life" booktitle="Collision-Based Computing" year="2002" />
  </Bibliography>
</KScript.Document>
import KScript.Document

Document(template: paper, title: 'Cited', to: 'cited.pdf') {
  Paragraph "Life is universal [@berlekamp1982; @rendell2002]."

  Bibliography(path: 'refs.bib') {
    Source(id: 'rendell2002', type: 'inproceedings', author: 'Paul Rendell', title: 'Turing Universality of the Game of Life', booktitle: "Collision-Based Computing", year: 2002)
  }
}

仅列出已被引用的来源。使用 citations: numeric(默认)时,按首次被引用的顺序编号,显示为 [1]。使用 citations: author-year 时,显示为 (Berlekamp et al., 1982),列表按作者排序。Source 接受任何 BibTeX 字段作为属性;author 用于分隔多个人名,使用 and。如果你引用了来源但未写 Bibliography,参考文献将放在文末。

引用或交叉引用指向不存在的 id 是错误,同一个 id 被使用两次也是错误。id: 与其他文本一样,因此循环可以为每个条目生成一个:Section(title: $chapter.title, id: "ch-{ $chapter.number }")。