typstgenv0.3.0

Quickstart

Compile the example letter from the repository, then set up the same layout in your own project.

Compile the example

The repository contains the documents from the showcase together with their config:

git clone https://github.com/casoon/typstgen
cd typstgen/examples
typstgen compile letter.typ --config typstgen.toml

typstgen prints the path of the PDF it wrote:

letter.pdf

letter.typ imports letterhead.typ, which is not in the same folder but in templates/. typstgen finds it because typstgen.toml names that folder:

template_paths = ["templates"]
use_system_fonts = false

Your own project

  1. Put shared templates into a folder, for example templates/.

  2. Add a typstgen.toml next to where you run typstgen:

    template_paths = ["templates"]
  3. Import templates by file name and compile:

    #import "letterhead.typ": letterhead
    typstgen compile letter.typ

Without --output, the PDF gets the input’s name with a .pdf extension, in the same folder. ./typstgen.toml is picked up automatically; use --config for a file elsewhere.

Paths in typstgen.toml are relative to the working directory. Template directories are optional: a document without imports compiles without any. The templates guide explains the lookup in detail.

Edit this page on GitHub · Docs for v0.3.0