AgentSkillsCN

typst-writer

使用 Typst 排版语言生成符合出版标准的文档。支持学术论文(APA 7)、数学符号、CeTZ 绘图以及数据可视化。适用于撰写研究论文、格式化包含复杂数学的文档、生成图表,或将 Markdown 转换为专业 PDF 时使用。默认采用 versatile-apa 模板(西班牙语)。

SKILL.md
--- frontmatter
name: typst-writer
description: >-
  Generates publication-ready documents using Typst typesetting language.
  Supports academic papers (APA 7), mathematical notation, CeTZ plotting, and data visualization.
  Use when creating research papers, formatting documents with complex math, generating plots,
  or converting markdown to professional PDFs. Defaults to versatile-apa template (Spanish).

Typst Writer

Write idiomatic Typst code. Defaults to versatile-apa (Spanish) for academic papers.

🚨 Critical Syntax Rules

FeatureSyntaxExample
Arrays(item1, item2)(1, 2) (Parentheses)
Dictionaries(key: val)(name: "Typst") (Colon)
Content Blocks[markup][*Bold* text] (Square Brackets)
Code Mode#expression#let x = 1 (Hash prefix)
No TuplesN/ATypst ONLY has Arrays

📚 References

ReferencePurpose
references/scripting.mdLogic, Loops, Functions, State
references/layout.mdPage Setup, Grids, Alignment
references/math.mdMath Mode Syntax & Symbols
references/data.mdLoading CSV, JSON, XML
references/plotting.mdDrawing & Plotting (CeTZ)
references/packages.mdPopular packages & search tips
references/bibliography.mdCitations & BibTeX management

📂 Examples

FileDescription
examples/manual-layout.typManual page setup (margins, headers)
examples/academic-paper.typDefault APA 7 Template (Spanish)

🛠️ Common Patterns

Defined Functions:

typst
#let note(body) = rect(fill: yellow, body)

State Management:

typst
#let counter = state("cnt", 0)
#context counter.get()

Loops:

typst
#for item in items [ - #item ]

🔍 Troubleshooting

  • "expected content, found...": You are in code mode but need markup. Wrap in [].
  • "expected expression...": You are in markup but need code. Add #.
  • Unknown font: Typst will fallback. Check font name.