typst

star 7

Modern Typst typesetting patterns for documents, slides, and academic writing. Use this skill when writing Typst markup (.typ files), creating document templates, building slide decks with Quarto, or debugging Typst compilation issues. Covers content blocks, styling, math typesetting, tables, figures, custom functions, citations, and Quarto integration. Also use when the user mentions #set rules, #show rules, Typst page layout, Typst math mode, or wants to convert LaTeX to Typst. Trigger even for brief Typst questions like formatting a table or equation.

statzhero By statzhero schedule Updated 4/30/2026

name: typst description: | Modern Typst typesetting patterns for documents, slides, and academic writing. Use this skill when writing Typst markup (.typ files), creating document templates, building slide decks with Quarto, or debugging Typst compilation issues. Covers content blocks, styling, math typesetting, tables, figures, custom functions, citations, and Quarto integration. Also use when the user mentions #set rules, #show rules, Typst page layout, Typst math mode, or wants to convert LaTeX to Typst. Trigger even for brief Typst questions like formatting a table or equation. license: CC-BY-4.0 metadata: author: Ulrich Atz typst_version: "0.14+" allowed-tools: Read, Edit, Write, Grep, Glob, Bash

Typst Typesetting

Typst is a modern typesetting system designed as a faster, more ergonomic alternative to LaTeX. It uses a markup syntax with scripting capabilities.

Related skills:

  • /typst-touying - Slide presentations with animations and themes
  • /typst-cetz - Diagrams, flowcharts, plots (TikZ-style drawing)

When to use this skill

  • Writing new Typst documents (.typ files)
  • Creating or modifying document templates
  • Typesetting math, tables, figures, or bibliographies
  • Integrating Typst with Quarto (.qmd → Typst output)
  • Debugging Typst compilation errors
  • Styling pages, headings, or custom environments

When NOT to use this skill

  • Slide presentations with animations → use /typst-touying
  • Diagrams or flowcharts → use /typst-cetz
  • LaTeX documents (different system entirely)
  • Quarto HTML/PDF output that does not use Typst backend
  • Tables generated by R's tinytable package → use /write-tinytable

Instructions

Step 1: Classify the request

Category Reference file Trigger
Math math-typesetting.md Equations, symbols, alignment, display math, numbering
Tables & figures tables-figures.md #table, #figure, #image, grids, cross-references
Quarto quarto-integration.md .qmd files, YAML frontmatter, raw Typst blocks, Quarto metadata
Citations citations-bibliography.md @key, #cite, #bibliography, CSL styles, supplements
Layout & styling page-layout-styling.md #set, #show, page setup, headers/footers, colors, custom functions

Step 2: Read the reference file(s)

Use the Read tool to load the relevant reference. For requests that span multiple categories (e.g., "create a document with math and a bibliography"), read multiple files.

Step 3: Verify with Context7

When unsure about Typst syntax or function signatures, use Context7 to check the latest docs:

  • Typst docs: library ID /websites/typst_app (1300+ snippets)
  • Quarto Typst format: library ID /websites/quarto

Step 4: Apply core principles

  1. Use #set rules for global defaults - avoid inline styling
  2. Use #show rules for transformations - customize heading/link/code appearance
  3. Use relative units (1fr, %) over hard-coded sizes
  4. Use labels and cross-references (<label> + @label) over manual numbering
  5. Keep templates modular - separate layout from content

Step 5: Write the code

Follow the quick reference and anti-patterns below. When in doubt, consult the reference files.

Quick reference

Core syntax

// Markup
*bold*  _italic_  `code`
#link("https://example.com")[Link text]

= Heading 1
== Heading 2

- Bullet
+ Numbered
/ Term: Definition

Set and show rules

// Set rules: global defaults
#set text(font: "New Computer Modern", size: 11pt)
#set par(justify: true)
#set page(margin: 2.5cm)

// Show rules: transform content
#show heading.where(level: 1): it => {
  pagebreak(weak: true)
  text(size: 18pt, weight: "bold", it.body)
}

Custom functions

#let note(body) = {
  block(fill: luma(230), inset: 8pt, radius: 4pt, body)
}

Variables and logic

#let draft = true
#if draft [#text(fill: red)[DRAFT]]

#for x in (1, 2, 3) [Item #x. ]

Anti-patterns

Avoid Prefer Reason
Inline styles everywhere #set rules Consistent, maintainable
Hard-coded sizes Relative units (1fr, %) Responsive layout
Manual numbering #counter() and @label Automatic updates
\n for line breaks Blank line or \ More readable
@key for narrative citations #cite(<key>, form: "prose") Correct rendering
Repeating styles per element #show rules Single source of truth

Complete workflow example

// Document setup
#set text(font: "New Computer Modern", size: 11pt)
#set par(justify: true, leading: 0.65em)
#set page(paper: "a4", margin: (x: 2.5cm, y: 3cm))
#set heading(numbering: "1.1")

// Custom environments
#let abstract(body) = {
  align(center)[*Abstract*]
  pad(x: 2em, body)
}

// Title
#align(center)[
  #text(size: 18pt, weight: "bold")[Document Title]
  #v(0.5em)
  Author Name \
  #text(size: 9pt, fill: luma(100))[March 2026]
]

#abstract[
  This paper examines...
]

= Introduction

We study the effect of $X$ on $Y$ using a difference-in-differences design.

= Data

#figure(
  table(
    columns: (auto, 1fr, 1fr),
    stroke: none,
    inset: (x: 10pt, y: 5pt),
    table.hline(stroke: 1.5pt),
    table.header([*Variable*], [*Mean*], [*SD*]),
    table.hline(stroke: 0.5pt),
    [Age], [34.2], [12.1],
    [Income], [52,100], [18,400],
    table.hline(stroke: 1.5pt),
  ),
  caption: [Summary statistics.],
  kind: table,
) <tbl-summary>

As shown in @tbl-summary, the sample includes...

= Results

Our main specification yields $beta = 0.42$ (SE = 0.08), significant at the 1% level.

$ Y_(i t) = alpha + beta D_(i t) + gamma_i + delta_t + epsilon_(i t) $ <eq-main>

@eq-main includes unit and time fixed effects.

#cite(<atz2022>, form: "prose") finds similar results in a related context.

#bibliography("references.bib", style: "apa")

Debugging tips

  1. Compilation errors: Check for unmatched brackets [], (), {}
  2. Layout issues: Use #box(stroke: red, [...]) to visualize bounds
  3. Math errors: Display math needs spaces inside $: $ x^2 $ not $x^2$
  4. Missing content: Ensure content blocks [] are properly closed
  5. Type errors: Use #type(value) to inspect types at compile time

Resources

Install via CLI
npx skills add https://github.com/statzhero/typst-skill --skill typst
Repository Details
star Stars 7
call_split Forks 2
navigation Branch main
article Path SKILL.md
More from Creator