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
-
Put shared templates into a folder, for example
templates/. -
Add a
typstgen.tomlnext to where you run typstgen:template_paths = ["templates"] -
Import templates by file name and compile:
#import "letterhead.typ": letterheadtypstgen 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.