Universe

Create project in app

Briefs is a simple Typst template for letters (German: Briefe). It is inspired by DIN 5008 and targets A4 paper. The address box aligns with the window of a DIN lang envelope.

Example

#import "@preview/briefs:0.4.0": letter

#set text(lang: "de", font: "TeX Gyre Heros")
#show: letter.with(
  sender: (
    [Hilfsorganisation e.V.],
    [Spendengasse 12],
    [12345 Helfershausen]
  ),
  recipient: [
    Frau\
    Erika Mustermann\
    Rathausplatz 37\
    67890 Waldhausen
  ],
  information-extra: [
    \
    Tel.: 01234 5678910
  ],
  location: "Helfershausen",
  subject: [*Vielen Dank für Ihre Spende*]
)

Sehr geehrte Frau Mustermann,

wir bedanken uns herzlich für Ihre großzügige Spende an unseren Verein.
Durch Ihre Unterstützung können wir weiterhin wichtige soziale Projekte
durchführen und Menschen in Not helfen.

Vielen Dank für Ihr Vertrauen und Ihre Mithilfe!

#v(0.5cm)
Mit freundlichen Grüßen

Hilfsorganisation e.V.

An example letter generated with briefs

Additional examples can be found in the tests directory.

Reference

Document Structure

The image below shows the basic document structure. The address box contains sender and recipient. The information box contains supplementary information. By default, it displays the sender, content in information-extra, location, and date. The basic document structure of letter generated with briefs

API

letter(
  sender: (),
  sender-font-size: 8pt,
  sender-separator: [, ],
  recipient: [],
  recipient-top-margin: 12.7mm,
  address-box: (25mm, 50mm, 80mm, 40mm),
  information: auto,
  information-box: (125mm, 25mm, 75mm, 65mm),
  information-extra: none,
  date: auto,
  date-format: auto,
  location: none,
  location-date-separator: [, ],
  subject: none,
  folding-marks: (:),
  hole-punch-marks: (:),
  background: [],
  show-boxes: false,
  numbering-first-page: "always",
  ..page-args,
  body
)

Arguments

sender   array of content   Default: ()
The sender’s address. This address is shown in the address box with font size sender-font-size and concatenated with separator sender-separator. If information is auto, this address is also shown at the top of the information box.

sender-font-size   length   Default: 8pt
The font size for the sender’s address in the address box

sender-separator   content   Default: [, ]
The separator between the sender’s address parts in the address box

recipient   content   Default: []
The recipient’s address. Line breaks must be inserted manually.

recipient-top-margin   length   Default: 12.7mm
The recipient’s top margin in the address box

address-box   array of length   Default: (25mm, 50mm, 80mm, 40mm)
Absolute position and size of the address box in the form (x, y, width, height).

information   auto | content   Default: auto
The content of the information box. If this is auto, the sender, optional content in information-extra, the location, and the date are shown as a default.

information-box   array of length   Default: (125mm, 25mm, 75mm, 65mm)
Absolute position and size of the information box in the form (x, y, width, height).

information-extra   none | content   Default: none
Additional content for the information box (only used if information is auto). This content is displayed after the sender and can be used, for example, to show a phone number or email address.

date   none | auto | datetime | content   Default: auto
The date (only used if information is auto). If this is auto, the current date is shown. If auto or a value of type datetime is provided, the date will be formatted with date-format.

date-format   auto | str   Default: auto
The date format pattern which is applied if date is auto or of type datetime. If date-format is a string, it is passed directly to Typst’s datetime.display() function. If date-format is auto, the pattern passed to datetime.display() is determined as follows:

  • if text.lang = "de": "[day].[month].[year]"
  • if text.lang = "en": "[month repr:long] [day padding:none], [year]"
  • otherwise: auto

location   none | content   Default: none
The location (only used if information is auto)

location-date-separator   content   Default: [, ]
The separator between location and date

subject   none | content   Default: none
The subject

folding-marks   none | dictionary   Default: (:)
Whether folding marks are displayed and how they are rendered. If none, no marks are shown. Otherwise, a dictionary defines how the marks are shown. The dictionary can have the following keys:

  • pages   str
    On which pages the marks are shown: "both", "even", or "odd"
  • length   length
    The length of the marks
  • stroke   stroke
    The stroke of the marks
  • xdist   length
    The distance to the left edge of the page

All keys are optional. If provided, they overwrite their default value.
The default is (pages: "both", length: 5mm, stroke: 0.25pt, xdist: 5mm).

hole-punch-marks   none | dictionary   Default: (:)
Whether hole punch marks are displayed and how they are rendered. See folding-marks for details.
The default is (pages: "both", length: 7mm, stroke: 0.25pt, xdist: 5mm).

background   content   Default: []
Content for the page background. The folding marks and the hole punch marks are placed on the page’s background. If you want to add additional content to the background, provide it here.

show-boxes   bool   Default: false
Whether address box and information box are framed. This is primarily intended for layout debugging.

numbering-first-page   str   Default: "always"
Whether a page number is displayed on the first page:

  • "always": Always, even for single-page letters
  • "multiple": If the letter has multiple pages
  • "never": Never, even for multi-page letters

This argument is used in the default numbering (see numbering in page-args below). If you overwrite numbering, numbering-first-page has no effect.

page-args   any (variadic)
Additional arguments for Typst’s page() function.
Default arguments (can be overwritten):

margin: (left: 25mm, rest: 20mm),
number-align: bottom + right,
numbering: (i, t) => if (numbering-first-page == "always") or
  (numbering-first-page == "multiple" and t > 1) or
  (numbering-first-page == "never" and i > 1) {
    text(10pt, context (localized().page-number)(i, t))
  },

body   content
The letter content