Generate idiomatic Typst (.typ) code, edit existing Typst files, and answer Typst syntax questions. Use when working with Typst files (*.typ) or when the user mentions Typst markup, document creation, or formatting.
This skill helps agents generate, edit, and reason about Typst documents. It provides quick‑start examples, detailed workflows, and links to the full Typst documentation (guides, tutorials, reference).
#set document(title: "My Document", author: "Author Name")
#set page(numbering: "1")
#set text(lang: "en")
// Enable paragraph justification and character-level justification
#set par(
justify: true,
justification-limits: (
tracking: (min: -0.012em, max: 0.012em),
spacing: (min: 75%, max: 120%),
)
)
#title[My Document]
= Heading 1
This is a paragraph in Typst.
== Heading 2
#lorem(50)
.typset rule, show rule, and custom themes.docs/guides/*.mddocs/tutorial/*.mddocs/reference/**/*.mddocs/ folder before generating code.Read/Grep/Glob on the paths above)..typ source according to the user's request.typst compile (if tool access is allowed)..typ content and optionally a rendered preview (PDF/HTML).(item1, item2) (parentheses). See docs/reference/foundations/array.md.(key: value, key2: value2) (parentheses with colons). See docs/reference/foundations/dictionary.md.[markup content] (square brackets). See docs/reference/foundations/content.md.# to start a code expression inside markup or content blocks; it disambiguates code from text. This is required for content-producing function calls and field access in markup: #figure[...], #image("file.png"), text(...)[#numbering(...)].# inside code contexts (argument lists, code blocks, show-rule bodies). Example: #figure(image("file.png")) (no # before image).// Incorrect (missing # inside content block)
text(...)[(numbering(...))]
// Correct
text(...)[(#numbering(...))]
set: Set rule to configure optional parameters on element functions (style defaults scoped to the current block or file).show: Show rule to target selected elements and apply a set rule or transform/replace the element output.set for common styling; use show for selective or structural changes (e.g., heading.where(level: 1), labels, text, regex).// Set rule: configure optional parameters for an element type
#set heading(numbering: "I.")
#set text(font: "New Computer Modern")
// Show-set rule: apply a set rule only to selected elements
#show heading: set text(navy)
// Show transform rule: replace/reshape element output
#show heading: it => block[#emph(it.body)]
[] for arrays (use () instead).arr[0] (use arr.at(0)).# in markup/content blocks (e.g., text(...)[numbering(...)] should be text(...)[#numbering(...)]).# inside code contexts (e.g., figure(#image("x.png")) in an argument list).[] with code blocks {}.color.hsl instead of just hsl).\begin{...}, \section, or other LaTeX commands).tabular does not exist; use table).When working on large projects, consider organizing the project across multiple files.
#include "file.typ" to split into multiple filesIf you see "unknown font family" warnings, remove the font specification to use system defaults. Note: Font warnings don't prevent compilation; the document will use fallback fonts.
If import fails with "package not found":
@preview/package:version syntax.Common fixes:
#{ } or use proper syntax.# (or #(...)) in markup/content blocks.() for both, dictionaries need key: value, singleton arrays are (elem,).