KScript docs
EN

Documents: KScript.Document

Citations and references

Cite with [@key]. Sources come from a BibTeX file, from Source elements, or both:

<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)
  }
}

Only cited sources are listed. With citations: numeric (the default) they are numbered in the order they are first cited, as [1]. With citations: author-year they read (Berlekamp et al., 1982) and the list is sorted by author. A Source takes any BibTeX field as an attribute; author separates people with and. If you cite sources but leave out Bibliography, the references go at the end.

A citation or cross-reference to an id that doesn't exist is an error, as is the same id used twice. An id: is text like any other, so a loop can make one for each item: Section(title: $chapter.title, id: "ch-{ $chapter.number }").