소개
KScript.Document는 논문, 보고서, 편지, 송장 같은 과학 및 전문 문서를 작성해요. 스크립트 하나로 같은 문서를 PDF, Word(.docx), LaTeX(.tex), Markdown, HTML로 저장할 수 있어요. LaTeX 수식, 번호가 매겨진 섹션, 표와 그림, BibTeX 인용, 각주, 상호 참조를 지원해요. PDF는 KScript 자체가 생성하므로 TeX, Word 또는 다른 프로그램을 설치할 필요가 없어요.
<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)
}
}시작하려면 import KScript.Document를 가져오세요. 이 명령은 Document와 그 안에 들어가는 요소들을 불러옵니다. Document 블록 안의 모든 내용은 일반 KScript이므로 for, if, 변수, 함수를 요소 사이에서 사용할 수 있습니다. 예를 들어 표는 데이터에서 만들 수 있고, 섹션은 목록의 각 항목마다 반복될 수 있습니다.
samples/documents 폴더에는 전체 논문, 보고서, 편지, 송장이 들어 있어요. kscript make document은 새 문서를 시작해요.