KScript 문서
KO

언어

영어에서 자동 번역되었습니다. 원문은 영어입니다.

KScript.Document

LaTeX 수식이 포함된 논문, 보고서, 편지, 청구서를 TeX 설치 없이 PDF, LaTeX, Word, Markdown 또는 HTML로 저장해요.

스크립트 맨 위에서 가져옵니다:

<import package="KScript.Document" />
import KScript.Document

루트 요소가 <KScript.Document>인 파일은 이를 자동으로 가져와요.

확장자가 .kscript인 파일에서는 import 구문에 패키지 이름을 Document { }로만 써요. KScript.Document { }로 쓰지 마세요.

KScript.Document는 PDF와 Word 파일을 만들기 때문에 문서 안에서 예제를 실행할 수 없어요. 예제를 .ks.xml 파일에 복사한 뒤 kscript로 실행해 보세요.

요소문

#<Abstract>Abstract

제목 아래에 있는 요약이에요. 빈 줄을 넣으면 새 단락이 시작돼요.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Abstract>We measure how gliders move.</Abstract>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Abstract "We measure how gliders move."
}

#<Author>Author

소속과 이메일이 있는 저자예요. 텍스트가 이름이 돼요.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
affiliationstring이 있는 { }근무하거나 공부하는 곳이에요.
emailstring이 있는 { }이메일 주소예요.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Author affiliation="University of Cambridge" email="ada@example.org">Ada Lovelace</Author>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Author(affiliation: 'University of Cambridge', email: 'ada@example.org') "Ada Lovelace"
}

#<Bibliography>Bibliography

[@key]로 인용한 문헌 목록이에요. BibTeX 파일, 그 안의 Source 요소, 또는 둘 다에서 가져와요. 없으면 목록은 문서 끝에 놓여요.

구문을 담아요.{ }에 구문을 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
path파일 경로스크립트를 기준으로 한 BibTeX(.bib) 파일 경로예요.
titlestring이 있는 { }제목이에요(기본값 References).
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Paragraph>Life is universal [@berlekamp1982].</Paragraph>
  <Bibliography path="refs.bib" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Paragraph "Life is universal [@berlekamp1982]."
  Bibliography(path: 'refs.bib')
}

#<Code>Code

고정폭 글꼴로 표시되는 소스 코드 블록이며, 작성한 그대로 사용해요.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
idstring이 있는 { }[#id] 상호 참조에 쓸 이름이에요. 예: id: "intro"
languagestring이 있는 { }Markdown과 HTML에서 사용하는 언어예요. 예: python
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Code language="python">print('Hello')</Code>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Code(language: 'python') "print('Hello')"
}

#<Contents>Contents

목차예요. PDF에서는 페이지 번호가 함께 표시돼요.

자체 닫힘 태그예요.단독으로 쓰는 구문이에요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
titlestring이 있는 { }제목이에요(기본값 Contents).
depth표현식표시할 단계 수예요. 2이면 섹션과 하위 섹션을 나열해요(기본값 3).
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Contents depth="2" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Contents(depth: 2)
}

#<KScript.Document>Document

문서예요. 내용(Section, Paragraph, List, Table, Figure, Math 등)은 템플릿에 따라 배치되고, where: 로 지정한 위치에 저장하거나 into:에 담아 두어요. for, if, let 같은 구문을 내부에서 쓸 수 있어요.

문을 담습니다.문을 { } 안에 담습니다. 스크립트에서만 사용합니다.

속성옵션값설명
templateplain|paper|report|letter|invoice문서의 모양이에요. plain(기본값), paper, report, letter, invoice 중에서 고를 수 있어요.
titlestring이 있는 { }문서의 제목이에요.
subtitlestring이 있는 { }제목 아래에 있는 한 줄이에요.
authorstring이 있는 { }저자예요. 여러 명이면 ;로 구분해요(Author 요소로 소속과 이메일을 추가할 수 있어요).
datestring이 있는 { }제목 아래에 표시되는 날짜예요. 예: { @now()->format('d MMMM yyyy') }
keywordsstring이 있는 { }키워드를 목록으로 적어요: ['cellular automata', 'Game of Life'](XML에서는 cellular automata, Game of Life). 요약 아래에 표시되고 파일 속성에도 저장돼요.
tostring이 있는 { }확장자별 저장 위치예요: paper.pdf, paper.tex, paper.docx, paper.md 또는 paper.html. 목록으로 여러 개를 저장할 수 있어요: [paper.pdf, paper.docx].
into새 변수의 이름문서를 담는 변수예요. 나중에 ->save(), ->pages() 또는 ->convert(to: markdown)에 사용할 수 있어요.
papera4 | a3 | a5 | b5 | letter | legal용지 크기예요: a4(기본값), a3, a5, b5, letter, legal 또는 '15cm x 20cm'처럼 지정해요.
landscapetrue 또는 falsetrue이면 용지를 가로 방향으로 돌려요.
marginstring이 있는 { }여백이에요. 한 가지 값(2.5cm)이나 CSS처럼 위/오른쪽/아래/왼쪽을 지정해요('2cm 2.5cm').
fontserif|sans|mono본문 글꼴이에요: serif(Times), sans(Helvetica) 또는 mono(Courier).
heading_fontserif|sans|mono제목 글꼴이에요: serif, sans 또는 mono.
sizestring이 있는 { }본문 글자 크기예요(포인트 단위, 예: 11).
line_heightstring이 있는 { }기준선 간의 간격이에요. 글자 크기의 배수로 지정해요(예: 1.4).
alignjustify|left|center|right본문 정렬이에요: justify, left, center 또는 right.
accentstring이 있는 { }제목과 표지의 색이에요: '#1f4e79' 또는 'navy'와 같은 이름.
numberedtrue 또는 falsefalse이면 섹션에 번호를 붙이지 않아요.
title_pagetrue 또는 falsetrue이면 제목, 저자, 날짜, 요약을 별도의 페이지에 놓아요.
chapterstrue 또는 falsetrue이면 최상위 섹션마다 새 페이지에서 시작해요.
citationsnumeric|author-yearnumeric([1]) 또는 author-year((Conway, 1970))예요.
headerstring이 있는 { }페이지 머리글이에요: '왼쪽 | 가운데 | 오른쪽' 형식이며, [page], [pages], [title], [author], [date]를 쓸 수 있어요.
footerstring이 있는 { }페이지 바닥글이에요. 머리글과 같은 방식이며, 기본값은 페이지 번호를 표시해요.
rulesbooktabs|grid|none표의 선이에요: booktabs(위, 아래, 머리글 아래), grid 또는 none.
languagestring이 있는 { }Word와 HTML에서 쓰는 언어 코드예요. 예: en 또는 en-GB.
예시
<KScript.Document template="paper" title="Gliders" author="Ada Lovelace" to="gliders.pdf">
  <Section title="Introduction">
    <Paragraph>A glider moves one cell every \( 4 \) generations.</Paragraph>
  </Section>
</KScript.Document>
import KScript.Document

Document(template: paper, title: 'Gliders', author: 'Ada Lovelace', to: 'gliders.pdf') {
  Section(title: 'Introduction') {
    Paragraph "A glider moves one cell every \( 4 \) generations."
  }
}

#<Figure>Figure

캡션이 있는 이미지(PNG 또는 JPEG)예요. 캡션이 있는 그림에는 번호가 매겨져요.

자체 닫힘 태그예요.단독으로 쓰는 구문이에요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
path 필수파일 경로스크립트를 기준으로 한 이미지 경로예요.
captionstring이 있는 { }아래에 'Figure 1: ...' 형식으로 표시되는 캡션이에요.
idstring이 있는 { }[#id] 상호 참조에 쓸 이름이에요. 예: id: "intro"
width표현식본문 너비에서 차지하는 비율이에요. 0에서 1 사이 값 또는 '60%'로 지정해요.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Figure path="glider.png" caption="A glider" id="fig-glider" width="0.5" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Figure(path: 'glider.png', caption: 'A glider', id: 'fig-glider', width: 0.5)
}

#<Invoice>Invoice

청구서예요. 보내는 사람과 받는 사람의 주소, 청구서 번호와 날짜, 항목 표, 소계, 세금, 합계, 비고를 담아요.

자체 닫힘 태그예요.단독으로 쓰는 구문이에요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
items 필수표현식항목 목록이에요. description, quantity(기본값 1), price(또는 amount)를 담은 맵의 목록이에요.
numberstring이 있는 { }인보이스 번호입니다.
fromstring이 있는 { }발신자의 이름과 주소를 한 줄씩 적습니다.
tostring이 있는 { }고객의 이름과 주소입니다.
datestring이 있는 { }인보이스 날짜입니다(기본값: 오늘).
duestring이 있는 { }결제 기한입니다.
currencystring이 있는 { }통화 코드(GBP, USD, EUR, JPY 등) 또는 기호입니다(기본값 GBP).
tax표현식백분율로 나타낸 세율입니다(예: 20). 세금 줄을 넣지 않으려면 생략합니다.
tax_namestring이 있는 { }세금의 명칭입니다(기본값 VAT).
paid표현식이미 지급된 금액으로, 미결제 잔액과 함께 표시됩니다.
notesstring이 있는 { }표 아래에 표시되는 결제 정보 또는 약관입니다.
titlestring이 있는 { }제목입니다(기본값 Invoice).
예시
<KScript.Document template="invoice" to="invoice.pdf">
  <Invoice number="INV-042" from="Life Lab Ltd\n1 High Street" to="Acme plc\n2 Low Road" currency="GBP" tax="20" items="[{ description: 'Consulting', quantity: 3, price: 450 }]" />
</KScript.Document>
import KScript.Document

Document(template: invoice, to: 'invoice.pdf') {
  Invoice(number: 'INV-042', from: 'Life Lab Ltd\n1 High Street', to: 'Acme plc\n2 Low Road', currency: 'GBP', tax: 20, items: [{ description: 'Consulting', quantity: 3, price: 450 }])
}

#<Item>Item

목록의 항목입니다. 텍스트는 Paragraph와 같은 방식으로 동작합니다.

{ } 값이 포함된 텍스트입니다. 스크립트에서만 사용합니다. <List>List 안에 넣습니다.

예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <List>
    <Item>Gliders move by **one cell** diagonally.</Item>
  </List>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  List {
    Item "Gliders move by **one cell** diagonally."
  }
}

#<Latex>Latex

LaTeX 코드로, 텍스트, latex 값 또는 .tex 파일에서 가져옵니다. 문서 부분이 읽는 방식 그대로 읽습니다. 섹션, 단락, 목록, 수식, 인용, 그림 및 일반적인 텍스트 명령을 지원합니다. 텍스트는 작성된 그대로 사용하므로 중괄호는 LaTeX 문법을 따릅니다.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
path파일 경로스크립트를 기준으로 한 상대 경로의 .tex 파일입니다.
value표현식latex 값입니다. 예를 들어 LaTeX 블록을 반환하는 함수가 제공하는 값입니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Latex path="chapters/method.tex" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Latex(path: 'chapters/method.tex')
}

#<Letter>Letter

편지입니다. 오른쪽에 발신자 주소와 날짜, 수신자, 제목, 인사말, 그 안의 본문, 맺음말과 서명이 들어갑니다.

구문을 담아요.{ }에 구문을 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
fromstring이 있는 { }발신자의 이름과 주소를 한 줄씩 적습니다.
tostring이 있는 { }수신자의 이름과 주소를 한 줄씩 적습니다.
datestring이 있는 { }날짜입니다(기본값: 오늘, 예: 2026년 11월 20일).
subjectstring이 있는 { }굵게 표시되는 제목 줄입니다.
openingstring이 있는 { }'Dear Sam,'과 같은 인사말입니다.
closingstring이 있는 { }'Yours sincerely,'와 같은 맺음말입니다.
signaturestring이 있는 { }맺음말 아래에 쓰는 이름입니다. 필요하면 직함을 위한 줄을 추가합니다.
예시
<KScript.Document template="letter" to="letter.pdf">
  <Letter from="1 High Street\nCambridge" to="Sam Smith\n2 Low Road\nLeeds" subject="Your order" opening="Dear Sam," closing="Best wishes," signature="Ada">
    <Paragraph>Thank you for your order.</Paragraph>
  </Letter>
</KScript.Document>
import KScript.Document

Document(template: letter, to: 'letter.pdf') {
  Letter(from: '1 High Street\nCambridge', to: 'Sam Smith\n2 Low Road\nLeeds', subject: 'Your order', opening: 'Dear Sam,', closing: 'Best wishes,', signature: 'Ada') {
    Paragraph "Thank you for your order."
  }
}

#<List>List

Item 요소로 이루어진 글머리 기호 또는 번호 목록입니다. Item 바로 뒤에 오는 List는 그 Item 안에 중첩됩니다.

구문을 담아요.{ }에 구문을 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
stylebullet|'number'|letter|romanbullet(기본값), number, letter 또는 roman입니다.
start표현식첫 번호입니다(예: 3).
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <List style="number">
    <Item>Measure</Item>
    <Item>Compare</Item>
  </List>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  List(style: number) {
    Item "Measure"
    Item "Compare"
  }
}

#<Markdown>Markdown

Markdown으로, 텍스트 또는 파일에서 가져옵니다. # 제목은 섹션이 되며, 단락, 목록, 표, 코드, 인용, 이미지, 수식을 포함할 수 있습니다(스크립트에서는 [ ], 파일에서는 $ \(and\) $$ 사용).

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
path파일 경로스크립트를 기준으로 한 상대 경로의 Markdown 파일입니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Markdown path="chapters/results.md" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Markdown(path: 'chapters/results.md')
}

#<Math>Math

LaTeX로 작성한 디스플레이 수식입니다. numbered: false가 아니면 번호가 붙습니다. 텍스트는 작성된 그대로 사용하므로 중괄호는 LaTeX 문법을 따릅니다. matrix, cases, aligned 안에서는 줄바꿈이 행을 구분합니다.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
idstring이 있는 { }[#id] 상호 참조에 쓸 이름이에요. 예: id: "intro"
numberedtrue 또는 falsefalse이면 수식 번호를 붙이지 않습니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Math id="eq-growth">N(t) = N_0 e^{rt}</Math>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Math(id: 'eq-growth') "N(t) = N_0 e^{rt}"
}

#<PageBreak>PageBreak

새 페이지를 시작합니다.

자체 닫힘 태그예요.단독으로 쓰는 구문이에요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <PageBreak />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  PageBreak
}

#<Paragraph>Paragraph

단락입니다. 텍스트에는 bold, italic, code, links, ( 수식 ), [@key] 인용, [#id] 상호 참조, ^[각주]를 포함할 수 있습니다. 빈 줄을 넣으면 새 단락이 시작됩니다.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
idstring이 있는 { }[#id] 상호 참조에 쓸 이름이에요. 예: id: "intro"
alignleft|center|right|justifyleft, center, right 또는 justify입니다(문서 설정이 기본값입니다).
linestrue 또는 falsetrue이면 주소나 시처럼 텍스트의 줄바꿈을 그대로 유지합니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Paragraph>Gliders travel **diagonally**, one cell every \( 4 \) generations.^[Down and to the right.]</Paragraph>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Paragraph "Gliders travel **diagonally**, one cell every \( 4 \) generations.^[Down and to the right.]"
}

#<Quote>Quote

양쪽 여백에서 안으로 들여쓴 인용문입니다.

{ } 값을 가진 텍스트를 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
bystring이 있는 { }누가 한 말인지 나타냅니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Quote by="John Conway">I hate the Game of Life.</Quote>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Quote(by: 'John Conway') "I hate the Game of Life."
}

#<Rule>Rule

텍스트를 가로지르는 수평선입니다.

자체 닫힘 태그예요.단독으로 쓰는 구문이에요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Rule />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Rule
}

#<Section>Section

번호가 붙은 제목이 있는 섹션입니다. Section 안의 Section은 하위 섹션입니다.

구문을 담아요.{ }에 구문을 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
title 필수string이 있는 { }제목입니다. bold, italic, ( 수식 )을 포함할 수 있습니다.
idstring이 있는 { }[#id] 상호 참조에 쓸 이름이에요. 예: id: "intro"
numberedtrue 또는 falsefalse이면 이 섹션에 번호를 붙이지 않습니다.
new_pagetrue 또는 falsetrue이면 이 섹션을 새 페이지에서 시작합니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Section title="Methods" id="methods">
    <Paragraph>We ran each pattern for 1000 generations.</Paragraph>
  </Section>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Section(title: 'Methods', id: 'methods') {
    Paragraph "We ran each pattern for 1000 generations."
  }
}

#<Source>Source

인용할 자료를 상세히 적은 항목입니다. id:는 [@key]에서 쓰는 키이며, 다른 속성은 BibTeX 필드입니다(author, title, year, journal, volume, pages, publisher, url, doi 등).

자체 닫힘 태그입니다.독립된 한 문장입니다. 스크립트에서만 사용합니다. <Bibliography>Bibliography 안에 넣습니다. 그 밖의 속성은 journal, volume, pages, url, doi 등 출처의 추가 필드입니다.그 밖의 옵션은 journal, volume, pages, url, doi 등 출처의 추가 필드입니다.

속성옵션값설명
id 필수string이 있는 { }[@conway1970]에서 쓰는 인용 키입니다.
typea stringarticle, book, inproceedings, misc 등입니다.
authorstring이 있는 { }BibTeX와 같이 ' and '로 구분한 저자 목록입니다.
titlestring이 있는 { }제목입니다.
yearstring이 있는 { }발행 연도입니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Paragraph>Life was first described in 1970 [@gardner1970].</Paragraph>
  <Bibliography>
    <Source id="gardner1970" type="article" author="Martin Gardner" title="Mathematical Games" journal="Scientific American" year="1970" volume="223" pages="120--123" />
  </Bibliography>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Paragraph "Life was first described in 1970 [@gardner1970]."
  Bibliography {
    Source(id: 'gardner1970', type: 'article', author: 'Martin Gardner', title: 'Mathematical Games', journal: 'Scientific American', year: 1970, volume: 223, pages: '120--123')
  }
}

#<Table>Table

표입니다. rows: 또는 그 안의 Tr 행에서 만듭니다. 캡션이 있는 표에는 번호가 붙습니다. 터미널의 표와 같은 rows, columns, align, header를 사용합니다.

구문을 담아요.{ }에 구문을 담아요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
captionstring이 있는 { }표 위에 'Table 1: ...'과 같이 표시되는 캡션입니다.
idstring이 있는 { }[#id] 상호 참조에 쓸 이름이에요. 예: id: "intro"
rows표현식행입니다. 각 행을 나타내는 맵의 목록, 또는 리스트의 목록입니다(첫 번째 리스트가 머리글 행입니다).
columns표현식각 맵에서 순서대로 표시할 값입니다. 키의 목록 ['name', 'age'] 또는 머리글에서 키로 가는 맵 { Name: 'name' }입니다. 기본값은 첫 행의 키입니다.
align표현식각 열의 정렬로, left, center 또는 right를 지정합니다(예: ['left', 'right']). 숫자는 기본적으로 오른쪽 정렬됩니다.
widths표현식페이지 전체에 걸친 표의 상대적인 열 너비입니다(예: [3, 1, 1]).
rulesbooktabs|grid|nonebooktabs, grid 또는 none입니다(문서 설정이 기본값입니다).
headertrue 또는 falsefalse이면 머리글 행이 없습니다.
size표현식본문 대비 상대적인 글자 크기입니다(예: 0.9).
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Table caption="Patterns" rows="$patterns" columns="{ Pattern: 'name', Period: 'period' }" align="['left', 'right']" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Table(caption: 'Patterns', rows: $patterns, columns: { Pattern: 'name', Period: 'period' }, align: ['left', 'right'])
}

#<Tr>Tr

표의 행: 셀은 |로 구분하며, 각 셀은 Paragraph의 텍스트와 같습니다. 셀 안의 |는 | 로 씁니다.

{ } 값이 들어가는 텍스트를 담습니다. 스크립트에서만 사용합니다. <Table>Table 안에 넣습니다.

속성옵션값설명
headertrue 또는 falsetrue로 설정하면 이 행은 제목 행이 되어 각 페이지 맨 위에 반복됩니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <Table caption="Patterns">
    <Tr header="true">Pattern | Period | Speed</Tr>
    <Tr>Glider | 4 | c/4</Tr>
  </Table>
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  Table(caption: 'Patterns') {
    Tr(header: true) "Pattern | Period | Speed"
    Tr "Glider | 4 | c/4"
  }
}

#<VSpace>VSpace

세로 여백입니다.

자체 닫힘 태그예요.단독으로 쓰는 구문이에요. 스크립트에서만 쓸 수 있어요. <KScript.Document>Document 또는 <fn>fn 안에 넣어요.

속성옵션값설명
height 필수string이 있는 { }간격의 크기입니다. '12pt', '5mm', '1cm'처럼 길이로 씁니다.
예시
<KScript.Document title="Gliders" to="gliders.pdf">
  <VSpace height="1cm" />
</KScript.Document>
import KScript.Document

Document(title: 'Gliders', to: 'gliders.pdf') {
  VSpace(height: '1cm')
}

명령

명령은 모든 표현식에서 @로 호출합니다: @name(arguments).

#@document(text, as?: 'markdown'|'latex') → document

Markdown 또는 LaTeX 소스로 문서를 만듭니다. 코드 블록으로 감싼 값은 형식을 지정하고, 일반 문자열은 기본적으로 Markdown으로 처리합니다.
매개변수받는 값
text 필수모든 값
as 선택다음 단어 중 하나입니다: 'markdown'|'latex'

인수는 이름으로 지정할 수 있습니다: @document(…, as: …).

예시
<echo>{ @document('# Notes')->save('notes.pdf') }</echo>
echo @document('# Notes')->save('notes.pdf')

#@document_templates() → map

기본 제공 문서 템플릿과 각 템플릿의 용도입니다: { paper: '...', report: '...' }.
예시
<echo>{ @document_templates()->keys() }</echo>
echo @document_templates()->keys()

#@latex_escape(text) → string

LaTeX 파일에 안전하게 넣을 수 있도록 처리한 텍스트입니다. \ { } $ & % # _ ~ ^ 문자가 이스케이프됩니다.
예시
<echo>{ @latex_escape('50% of $10 &amp; up') }</echo>
echo @latex_escape('50% of $10 & up')

메서드

markdown 값의 경우: ->find(), ->replace(), ->insert(), ->save(), ->pages(), ->words()

latex 값의 경우: ->find(), ->replace(), ->insert(), ->save(), ->pages(), ->words()

document 값의 경우: ->save(), ->bytes(), ->find(), ->replace(), ->insert(), ->pages(), ->words()