Wit

Templates

A template gives a manuscript its pieces — title, author, abstract, chapter — and its look: fonts, page size, margins, page numbers. Reference one at the top.

reference wit/paper

(title Attention as a Moral Practice title)
(author T. Greig author)
(date October 2026 date)

(abstract
This paper argues that attention is a moral act.
abstract)

(h2 Introduction h2)
wit build essay.wit -o essay.pdf

Bundled templates

TemplateForPage
wit/documentthe default word-processor lookLetter
wit/paperan academic articleA4
wit/apaan APA 7 student paperLetter
wit/mlaan MLA 9 paperLetter
wit/thesisa thesis: title page, chapters on new pages, binding marginA4
wit/reporta report: cover, summary page, "Page N of M"A4
wit/lettera formal letterA4
wit/articlea long read for the web—
wit/booka printed book: mirrored margins, drop caps6 × 9 in
wit/manuscriptstandard manuscript format for fictionLetter

The pieces

Every template defines the same pieces, so a manuscript builds with any of them.

PieceUse
title, subtitle, author, affiliation, datethe title block
abstract, summary, keywordsfront matter
dedication, epigraphfront matter for books and theses
chaptera chapter heading; a new page in thesis, report and book
note, warningcallouts
referencesa hand-written reference list with hanging indents — or use citations
from, to, subject, closing, signatureletters
@pagebreak, @scenebreaka new page; a break between scenes

A piece that spans paragraphs opens and closes on lines of its own:

(abstract
First paragraph.

Second paragraph.
abstract)

Switch template without editing

wit build essay.wit --template thesis -o essay.pdf
wit build essay.wit --paper letter -o essay.pdf    # the flag beats the template's size

--template replaces the manuscript's reference wit/… line, or adds one.

Change one piece

Define it yourself; your definition wins over the template's, everywhere.

source
reference wit/paper

#title
@h1(class: wit-title) ::body:: — draft h1@
title#
result

A style block restyles a piece — each has a wit- class:

source
@@style
.wit-doc .wit-title { color: #2b6a4f; }
style@@
result

Your own template

A template is a Wit file of definitions plus a top-level @@style, or a folder with a main.wit and its fonts and images. Put it in .wit/templates/ at the top of your project (or in ~/.wit/templates/ for all your documents) and reference it by name:

my-thesis/
  .wit/templates/acme/main.wit
  chapters/one.wit          ~ reference wit/acme

wit/<name> looks in the nearest .wit/templates above the document, then ~/.wit/templates, then each folder in WIT_TEMPLATES_PATH, then the bundled ones — so a project template named paper replaces the bundled one.

Start from a bundled one: reference wit/document inside your template gives you all the pieces to restyle.