typstgenv0.3.0

Showcase

Each example shows real output produced by typstgen itself, from files in the project repository. Input on the left, output on the right.

Letter from a template

examples/letter.typDetail: Letter from a template →
// The template is not next to this file: typstgen resolves the import
// against `template_paths` from typstgen.toml.
#import "letterhead.typ": letterhead

#show: letterhead.with(
  sender: [Northwind Studio · 1 Harbour Road · Example Town],
  recipient: [
    Ada Example \
    Example Ltd \
    22 Market Street \
    Example City
  ],
  date: [14 September 2026],
  subject: [Your quote request],
)

Dear Ms Example,

thank you for your enquiry. As discussed, we will set up the document
pipeline in two steps: first the templates, then the automated PDF build.

#table(
  columns: (1fr, auto),
  align: (left, right),
  table.header([*Item*], [*Price*]),
  [Letter and invoice templates], [€ 1,200],
  [PDF build in CI], [€ 600],
  [*Total*], [*€ 1,800*],
)

The offer is valid for 30 days. We look forward to hearing from you.

Kind regards \
Northwind Studio

This browser does not show PDFs inline. Use the links below.

Open letter.pdf · Download letter.pdf (19.2 KiB)

  • template import
  • A4

Bundled fonts

examples/fonts.typDetail: Bundled fonts →
// Uses only the fonts that typstgen bundles, so it renders without any
// installed fonts (use_system_fonts = false in typstgen.toml).
#set page(paper: "a5", margin: 18mm)
#set text(size: 10.5pt)

= Bundled fonts

== Libertinus Serif
#text(font: "Libertinus Serif")[
  The quick brown fox jumps over the lazy dog. *Bold*, _italic_, *_both_*.
]

== New Computer Modern
#text(font: "New Computer Modern")[
  The quick brown fox jumps over the lazy dog. *Bold*, _italic_, *_both_*.
]

== New Computer Modern Math
$ integral_0^infinity e^(-x^2) dif x = sqrt(pi) / 2 $

== DejaVu Sans Mono
```rust
let pdf = typstgen::compile(input, &config)?;
```

This browser does not show PDFs inline. Use the links below.

Open fonts.pdf · Download fonts.pdf (46.4 KiB)

  • fonts
  • math
  • A5

Minimal document

examples/hello.typDetail: Minimal document →
// The smallest input: plain Typst markup, no imports.
#set page(paper: "a5", margin: 20mm)

= Hello from typstgen

This page was compiled to PDF by the Typst engine embedded in typstgen.
No `typst` binary was installed or started.

- Headings, lists and paragraphs work as in any Typst document.
- Numbering, tables and math do too.

This browser does not show PDFs inline. Use the links below.

Open hello.pdf · Download hello.pdf (18.7 KiB)

  • no imports
  • A5

Missing import

examples/missing-import.typDetail: Missing import →
// Imports a file that exists in no search root, so compilation fails.
#import "footer.typ": footer

#footer
error: typst compilation failed:
missing-import.typ:2:9: error: file not found (searched at /footer.typ)
  • error
  • exit code 1