← typeset example-letter.typ Download

example-letter.typ

A conformance sample for the Typst implementation — letter() template, justified, page-foot footnote. Rendered below from typeset.typ; the checker compiles it fresh on every commit.

letter, page 1

68 lines · 2.6 KB

1// A conformance check for the letter template, written out part by part.
2// letter() sets the page here and nothing else — closing: none, because the
3// closing is the one part it would otherwise add — and each part of the letter
4// is its own call, in the order a letter takes them. Justified at 12pt, no
5// running head, no folio, and a real footnote at the foot of the page.
6//
7// The same letter in the compact form, with letter() setting every part from
8// its parameters and only the body below the #show line:
9//
10// #show: letter.with(
11// crest: svg-recolor(read("crest-placeholder.svg"), width: 100%),
12// sender: ("Adilson Carvalho", "10 Wentworth Avenue", "Surry Hills NSW 2010", "Australia"),
13// addressee: ("The Registrar", "Institute of Typographic Studies", "88 Rundle Street", "Adelaide SA 5000"),
14// date: "27 August 2026",
15// saint: "St Monica, mother of St Augustine Bishop",
16// salutation: "Registrar",
17// signature: "Adilson Carvalho",
18// enclosures: [typeset.css; two specimen pages],
19// postscript: [The tables were excellent — tabular figures throughout.],
20// )
21#import "typeset.typ": *
22
23#show: letter.with(closing: none)
24
25// A crest is optional. This placeholder is drawn in one ink, so svg-recolor
26// sets it in the accent; read() resolves the path against this file.
27#letter-crest(svg-recolor(read("crest-placeholder.svg"), width: 100%))
28
29#letter-addresses[
30 #letter-address-from[
31 Adilson Carvalho \
32 10 Wentworth Avenue \
33 Surry Hills NSW 2010 \
34 Australia
35 ]
36
37 #letter-address-to[
38 The Registrar \
39 Institute of Typographic Studies \
40 88 Rundle Street \
41 Adelaide SA 5000
42 ]
43]
44
45#letter-date("27 August 2026", saint: "St Monica, mother of St Augustine Bishop")
46
47#letter-salutation[Registrar]
48
49I am writing about the setting of the Institute's annual report, which arrived
50this morning and which I read with rather more attention to its margins than to
51its contents.
52
53The text column runs to something near a hundred and ten
54characters.#footnote[Measured on page four, between the outer margins: 168mm at
55a 10pt body, which is about 112 characters.] By the second page I had lost my
56place twice, and by the fourth I had stopped reading and started measuring.
57
58This is a cheap problem to fix. Narrowing the column to sixty-six characters
59costs one afternoon and no money, and the space it frees on the right can carry
60the marginal notes that are currently crowded into footnotes.
61
62#letter-closing()
63
64#letter-signature[Adilson Carvalho]
65
66#letter-enclosures[typeset.css; two specimen pages]
67
68#letter-postscript[The tables were excellent — tabular figures throughout.]