Generate idiomatic Typst (.typ) code, edit existing Typst files, and answer Typst syntax questions...
This skill helps agents generate, edit, and reason about Typst documents. It provides quickβstart examples, detailed workflows, and links to the Typst documentation (overview, 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)
.typ file(s)..typ edit, follow the post-edit formatting checks below when typstyle is available..typ file, follow the post-edit formatting checks below.set rule, show rule, selectors, and transformations.docs/overview.md for a high-level introduction, docs/reference/index.md for the reference structure, and docs/tutorial/index.md for the tutorial sequence.docs/tutorial/1-writing.md for basic markup, functions, labels, citations, and math; docs/tutorial/2-formatting.md for set rules, page setup, headings, and text formatting; docs/tutorial/3-advanced.md for templates, show rules, and more complex styling; docs/tutorial/4-template.md for reusable templates and packages.docs/reference/language/syntax.md for markup/math/code modes, comments, escapes, and identifiers.docs/reference/language/scripting.md for expressions, code/content blocks, bindings, conditionals, loops, fields, methods, modules, packages, and operators.docs/reference/language/styling.md for set rules, show rules, selectors, and transformations.docs/reference/language/context.md for style context, location context, nested contexts, and compiler iterations.docs/reference/library/foundations.md for basic types/functions, std, sys.version, and sys.inputs.docs/reference/library/model.md for headings, figures, bibliography, citations, references, numbering, outlines, lists, tables, and document structure.docs/reference/library/layout.md for arranging elements on the page: page, block, box, grid, columns, alignment, spacing, transforms, and measurement.docs/reference/library/text.md for text styling and the text function.docs/reference/library/math.md for math syntax, symbols, equations, alignment, fonts, accessibility, and math functions.docs/reference/library/visualize.md for shapes, image/graphics primitives, color, gradients, strokes, and visual accessibility.docs/reference/library/introspection.md for counters, state, locations, query, and document-aware generated content.docs/reference/library/data-loading.md for loading and encoding external data such as CSV, JSON, TOML, YAML, XML, CBOR, and raw files.docs/reference/library/sym.md for named symbols and shorthands; docs/reference/library/emoji.md for emoji.docs/reference/export/pdf.md for PDF standards and PDF-specific features; docs/reference/export/html.md for HTML export and typed HTML; docs/reference/export/bundle.md for multi-output bundles and assets; docs/reference/export/svg.md and docs/reference/export/png.md for image exports.docs/guides/page-setup.md for pages, margins, headers, footers, numbering, and columns; docs/guides/tables.md for semantic tables and table styling; docs/guides/accessibility.md for semantic structure, alt text, language, PDF accessibility, and export considerations; docs/guides/for-latex-users.md for LaTeX-to-Typst translation.docs/ folder before generating code..typ source according to the user's request..typ file you created or edited in that pass.typst compile after the formatting decision is complete when you created or edited .typ files, or when the user explicitly asks for verification (if tool access is allowed)..typ content only when the user requests it or when direct editing is not possible, and optionally include a rendered preview (PDF/HTML).typst eval instead of creating scratch .typ files. See docs/reference/library/foundations.md for system values and docs/reference/library/introspection.md for contextual document queries.typst eval '1 + 2'typstyle is available with command -v typstyle. If it is unavailable, skip the remaining formatting checks..typ file modification, run typstyle --check <file> for the file you just created or edited.typstyle --check fails, inspect the formatter changes with typstyle --diff <file> before deciding what to do.typstyle -i <file> only when the formatter changes are limited to a newly created file or to code you created or edited in the current task.(item1, item2) (parentheses). See docs/reference/library/foundations.md.(key: value, key2: value2) (parentheses with colons). See docs/reference/library/foundations.md.[markup content] (square brackets). See docs/reference/language/scripting.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. See docs/reference/language/scripting.md for package import syntax and docs/guides/for-latex-users.md for Typst Universe examples.Common fixes:
#{ } or use proper syntax.# (or #(...)) in markup/content blocks.() for both, dictionaries need key: value, singleton arrays are (elem,).