Einführung
KScript.Document erstellt wissenschaftliche und professionelle Dokumente: Arbeiten, Berichte, Briefe und Rechnungen. Ein einziges Skript kann dasselbe Dokument als PDF, Word (.docx), LaTeX (.tex), Markdown und HTML speichern. Es unterstützt LaTeX-Formeln, nummerierte Abschnitte, Tabellen und Abbildungen, Zitate aus BibTeX, Fußnoten und Querverweise. Das PDF wird von KScript selbst erzeugt, du musst also weder TeX, Word noch etwas anderes installiert haben.
<KScript.Document template="paper" title="How Gliders Move" author="Ada Lovelace" to="'gliders.pdf'">
<Abstract>A glider returns to its own shape every \( p = 4 \) generations, one cell further on.</Abstract>
<Section title="Introduction">
<Paragraph>The Game of Life [@gardner1970] is played on a square grid. Each cell has **eight neighbours**.</Paragraph>
<Math id="eq-speed">v = \frac{\max(|\Delta x|, |\Delta y|)}{p} \, c</Math>
<Paragraph>Equation [#eq-speed] gives a pattern's speed.</Paragraph>
</Section>
<Bibliography>
<Source id="gardner1970" type="article" author="Martin Gardner" title="Mathematical Games" journal="Scientific American" year="1970" />
</Bibliography>
</KScript.Document>import KScript.Document
Document(template: paper, title: 'How Gliders Move', author: 'Ada Lovelace', to: 'gliders.pdf') {
Abstract "A glider returns to its own shape every \( p = 4 \) generations, one cell further on."
Section(title: 'Introduction') {
Paragraph "The Game of Life [@gardner1970] is played on a square grid. Each cell has **eight neighbours**."
Math(id: 'eq-speed') "v = \frac{\max(|\Delta x|, |\Delta y|)}{p} \, c"
Paragraph "Equation [#eq-speed] gives a pattern's speed."
}
Bibliography {
Source(id: 'gardner1970', type: 'article', author: 'Martin Gardner', title: 'Mathematical Games', journal: "Scientific American", year: 1970)
}
}Um loszulegen, import KScript.Document, was Document und die Elemente einbindet, die darin stehen. Alles innerhalb eines Document-Blocks ist gewöhnliches KScript, daher funktionieren for, if, Variablen und Funktionen zwischen den Elementen: Eine Tabelle kann aus Daten entstehen, und ein Abschnitt kann sich für jedes Element einer Liste wiederholen.
Der Ordner samples/documents enthält ein vollständiges Papier, einen Bericht, einen Brief und eine Rechnung. kscript make document startet ein neues Dokument.