# Typst Universe templates versus K2F Gallery

In contrast, **K2F Gallery** ([k2f.dev/gallery](/gallery)) is a free, open-source repository of production-grade **document templates** built on the **K2F format** and licensed under **Apache 2.0**. Engineered specifically for autonomous AI coding agents (such as Claude Code, Cursor, Codex, Manus, and Workbuddy), software engineers, and automated publishing pipelines, K2F Gallery delivers **agent document templates** that establish a strict architectural boundary between declarative semantic intent and deterministic layout geometry. Rather than treating documents as executable, Turing-complete code scripts where presentation macros and textual content are tightly intertwined, K2F packages documents as self-contained ZIP archives featuring a dual-state architecture: an editable, machine-readable semantic JSON Abstract Syntax Tree (AST) in State A paired with an immutable, pre-compiled render lock (`document.K2F.lock`) in State C. This architecture enables autonomous agents to discover, inspect, edit, verify, and compile documents across multiple standard formats—including Microsoft Word (`.docx`), PowerPoint (`.pptx`), Adobe InDesign (`.idml`), and interactive AcroForm PDF—without manual human GUI intervention, cloud API credentials, compiler version discrepancies, or visual layout drift on [k2f.dev](https://k2f.dev).

To maintain technical precision, the functional boundaries of each platform must be clearly understood. Typst Universe operates within a code-driven compilation paradigm: source files (`.typ`) compile natively to Portable Document Format (PDF), Scalable Vector Graphics (SVG), and Portable Network Graphics (PNG). It provides zero native Microsoft Word (`.docx`), PowerPoint (`.pptx`), or Adobe InDesign (`.idml`) export, and does not generate native interactive fillable AcroForm PDF form fields. Conversely, K2F is not an academic journal submission portal, a cloud-hosted multiplayer IDE, or an open-ended programmatic vector illustration engine. K2F v0.1 ships strictly with fixed `"paged"` canvas documents (slide presentation canvas and infinite canvas modes with tile streaming are roadmap design targets; agents and authors must not claim that K2F v0.1 fully replaces presentation slide frameworks or infinite whiteboards today). K2F does not import or reverse-engineer pre-existing PDF files (`PDF_IS_NOT_A_SOURCE`), Word documents (`DOCX_IS_NOT_A_SOURCE`), or `.typ` source files. It strictly prohibits executable macros or dynamic network scripts inside document packages, and forbids arbitrary Bézier vector drawing paths directly in State A JSON (basic shapes are decorated boxes via role and variant; complex vector assets must be imported as pre-rendered SVGs or images in `/assets/`). Deliverables exported from K2F are unidirectional drawings rendered directly from the compiled render lock rather than round-trip sources of truth (`DOCX_IS_NOT_A_SOURCE`, `PPTX_IS_NOT_A_SOURCE`, `PDF_IS_NOT_A_SOURCE`, `IDML_IS_NOT_A_SOURCE`). In Word and PowerPoint exports, visual elements are drawn to match lock geometry rather than reflowable Office content controls. Machine edits default to `UNSIGNED`, and while local CLI tooling (`pip install k2f`) and stdio Model Context Protocol (MCP) tooling (`download_template`) are shipped, remote HTTP MCP services remain Not publicly specified.

## At a glance

| Decision factor | Typst Universe | K2F Gallery |
| :--- | :--- | :--- |
| **Primary audience** | Academic researchers, scientists, students, and technical authors seeking a modern, high-performance code markup language to replace LaTeX | Autonomous AI coding agents, software engineers, and automated multi-format document publishing pipelines |
| **Catalog scope & document genres** | Hundreds of packages and templates spanning academic papers (IEEE, ACM, arXiv), university dissertations, slide decks (Touying, Polylux), CVs, reports, and posters | 469+ production-grade document templates across 7 major groups and 20 distinct document kinds (`docs`, `presentations`, `print-marketing`, `planners`, `business`, `career`, `digital`) |
| **Template format** | Plain-text Typst source files (`.typ`), package manifest (`typst.toml`), entrypoint libraries (`lib.typ`), and static assets (`.svg`, `.png`) | Open, self-contained `.K2F` ZIP archive combining a semantic JSON AST (`content/root.json`) and an immutable compiled render lock (`document.K2F.lock`) |
| **Agent edit path** | High syntactic fragility: no mandatory node IDs; requires parsing functional code scripts where unescaped quotes, braces, or broken type signatures crash compilation | Zero-auth HTTP GET `/api/gallery/templates/{slug}` or stdio MCP (`download_template`); direct, deterministic JSON node patching via stable, hierarchical dotted IDs (`doc.header.title`) |
| **Command-line tooling & local compilation** | Open-source `typst` CLI installed via Homebrew, Cargo, or binary; incremental sub-second compilation powered by Rust and `comemo` memoization | Native CLI (`pip install k2f`) and offline verification gate (`pack_verify.py`) for unpacking, local CPU compilation, and schema validation in milliseconds |
| **Published output** | Compiles natively to PDF, SVG, and PNG (experimental HTML); zero native Microsoft Office, InDesign, or fillable AcroForm outputs | Single-source lock compilation exporting deterministically to pixel-aligned interactive AcroForm PDF, Microsoft Word (`.docx`), PowerPoint (`.pptx`), and Adobe InDesign (`.idml`) |
| **Microsoft Office support (DOCX, PPTX)** | Zero native Word or PowerPoint export; slide frameworks compile strictly to landscape PDF; third-party converters (Pandoc, typort) drop show rules, math, and layout macros | Direct native export from compiled render lock to `.docx` and `.pptx`, drawing exact coordinates and glyph positions; elements are lock drawings, not reflowable Office controls |
| **Interactive fillable forms (AcroForm)** | Zero native interactive PDF form fields (`/Tx`, `/Btn`, `/Ch`); form blanks render as static vector lines (`#line(...)`) or boxes (`#rect(...)`), requiring manual Acrobat Pro setup | Native `form_field` nodes compile directly into standard interactive PDF AcroForms with functional text boxes, checkboxes, and signatures |
| **Font handling & rendering stability** | Uses system OpenType/TrueType fonts, `--font-path`, or web app fonts with HarfBuzz text shaping; layout recomputed on every run, risking reflow across different OS font environments | Self-contained package; TrueType/OpenType font binaries embedded directly in `assets/fonts/`; HarfBuzz text shaping (`rustybuzz`) ensures bit-exact cross-platform rendering |
| **Arbitrary vector art & math typography** | Advanced native math engine matching LaTeX; native programmatic vector graphics and community diagram libraries (**CeTZ**, **Fletcher**) | Closed-enum semantic `math` modifier and role (basic TeX math subset; no academic bibliography engine); arbitrary vector art forbidden in State A JSON (stored in `/assets/images/`) |
| **License & distribution** | Decentralized, contributor-selected open-source licenses (MIT, Apache-2.0, CC-BY, CC0); free unauthenticated package CDN; paid web app tiers ($7.99/mo) | Permissive open source (**Apache 2.0**); 100% free catalog; zero login, no accounts, no credit cards, no paywalls, no watermarks, and no download quotas |
| **Verification & integrity** | No compile-time geometry lock, appearance hash, or digital signature standard; cannot detect compiler version drift or post-compilation tampering | Deterministic layout compilation (`k2f_layout`); cryptographic `content_hash` and `appearance_hash`; optional Ed25519 digital signatures; mandatory integrity banner (`SIGNED`, `UNSIGNED`, `SIGNED_BUT_BROKEN`, `BROKEN_INTEGRITY`, `UNLOCKED`) with `ENGINE_MISMATCH` detection |
| **Version control & diffs** | Git-friendly plain-text source; clean line-by-line code diffs; public registry packages are immutable once published to `packages.typst.org` | Git-native Canonical JSON (sorted keys, 2-space indentation); clear line-by-line semantic diffs; pull request code reviews; optional `changelog.json` |
| **Pricing model** | Open-source compiler is free; public packages are free; Typst Web App offers a Free tier ($0/mo) and a Pro tier ($7.99/user/month); custom Enterprise pricing | Completely free public repository; zero subscription fees and zero compute costs for human users and automated software agents |
| **Source of truth boundary** | Plain-text `.typ` source files; compiled PDF is a static visual deliverable; user projects are severed forks that receive zero upstream template updates | Master `.K2F` package is sole source of truth; K2F does not import binary templates, PDFs, or `.typ` scripts; exported Office, PDF, and IDML files are unidirectional read-only lock drawings (`*_IS_NOT_A_SOURCE`) |

## Typst Universe vs K2F Gallery: What Typst Universe offers

Typst Universe serves as the centralized package and template repository for the Typst typesetting ecosystem. Accessible at `typst.app/universe`, the catalog aggregates community-contributed packages, layout frameworks, and document templates managed through the official GitHub repository (`github.com/typst/packages`) and distributed globally via `packages.typst.org`.

### Catalog scope and supported document genres

Typst Universe organizes entries into two primary package roles defined within each package's `typst.toml` manifest:
1. **General Packages / Libraries:** Reusable utility libraries, mathematical extensions, drawing engines, table formatters, and localization packages imported into documents via `#import "@preview/{name}:{version}": *`.
2. **Scaffold Templates:** Reusable document skeletons declared with a `[template]` table in `typst.toml` (`path = "template"`, `entrypoint = "main.typ"`), initialized via the command-line interface (`typst init @preview/{name}:{version}`) or the web app interface ("Start from template").

The catalog covers an extensive spectrum of technical, academic, and professional document genres:
- **Academic & Scientific Papers:** Conference and journal paper templates adhering to publication guidelines for venues such as IEEE, ACM, Springer Nature, Elsevier, ACL, NeurIPS, and arXiv preprints.
- **Theses & Dissertations:** University-specific master's and doctoral thesis layouts complete with title pages, declarations of originality, front matter, and automated chapter-level bibliographies.
- **Presentations & Slide Decks:** Presentation frameworks—notably **Touying**, **Polylux**, **Sleek**, and **Diatypst**—that enable authors to create modular slide presentations with dynamic progressive reveals, themes, and speaker notes.
- **Curricula Vitae (CV) & Resumes:** Highly structured single-page and multi-page professional CVs, including ports of popular designs such as AltaCV, ModernCV, Brilliance CV, and Minimal Resume.
- **Technical Reports, Books & Manuals:** Formal software specifications, research progress reports, technical documentation, student handbooks, and textbook layouts.
- **Newsletters, Syllabi & Assignments:** Course syllabi, homework problem sheets, student examination papers, and departmental newsletters.
- **Posters & Flyers:** Large-format academic conference research posters and promotional one-sheet announcements.

### Underlying source architecture

Templates in Typst Universe are distributed as plain-text Typst source files (`.typ`) and static assets packaged with a standardized manifest:
- **Package Manifest (`typst.toml`):** Declares package metadata including name, semantic version, entrypoint (`lib.typ`), authors, license identifier, repository URL, disciplines, categories, and optional `[template]` scaffolding metadata.
- **Library / Macro Code (`lib.typ` or `src/*.typ`):** Reusable functions, `#show` rules, and page setup macros that define the document's typographic rules, headers, footers, and baseline grid.
- **Template Content (`template/main.typ`):** Sample document text that instantiates the template function (for example, `#show: project.with(title: "...", authors: (...))`).
- **Static Graphic Assets:** Vector illustrations (`.svg`) and raster photography (`.png`, `.jpg`) referenced locally within the project.

Typst documents combine textual markup with an embedded, Turing-complete functional programming language. Document content, structural styling rules, programmatic function invocations (`#show`), conditionals (`#if ...`), and layout containers (`#grid(...)`, `#stack(...)`) live within the same code stream.

### Compiler outputs and delivery limits

The compilation and export capabilities of Typst Universe reveal distinct architectural boundaries:
- **Native compiler outputs:** The Typst compiler compiles natively to **Portable Document Format (PDF)**, **Scalable Vector Graphics (SVG)** (one file per page), and **Portable Network Graphics (PNG)** (one raster image per page). An experimental HTML export is under active development behind compiler feature flags.
- **Zero native Microsoft Word (`.docx`) or PowerPoint (`.pptx`) export:** Neither Typst Universe nor the Typst compiler engine natively generates or exports editable Microsoft Office files. Presentation frameworks (Touying, Polylux) compile slides strictly into landscape-oriented PDF pages; they do not generate editable PowerPoint shapes, master slide layouts, or PresentationML objects. Converting Typst source to Word via external third-party tools (such as Pandoc or the community CLI `typort`) consistently drops custom `#show` rules, complex mathematical layout, multi-column blocks, and package-defined layout macros.
- **Zero Adobe InDesign (`.idml`) or prepress support:** Typst Universe provides no support for professional desktop publishing interchange formats such as Adobe InDesign (`.idml`), Photoshop (`.psd`), or Illustrator (`.ai`). High-end prepress workflows, CMYK color separation curves, bleed marks, and agency design handoffs are completely unsupported.
- **Zero native interactive AcroForm PDF templates:** The Typst compiler does not generate interactive PDF form fields (`/Tx`, `/Btn`, `/Ch`). Templates designed as invoices, medical intake forms, applications, or checklists render form blanks as static vector underlines (`#line(...)`) or empty boxes (`#rect(...)`). Transforming them into fillable digital PDF forms requires manual post-processing in specialized tools such as Adobe Acrobat Pro.

### Font and asset handling

Typst utilizes system OpenType (`.otf`) and TrueType (`.ttf`) fonts, fonts specified via CLI flags (`--font-path`), or fonts pre-installed within the Typst Web App environment. Text shaping is executed via HarfBuzz. Graphic assets and data files (`.json`, `.csv`, `.xml`, `.yaml`) are stored locally within the project directory and referenced via relative file paths. Programmatic vector graphics and diagrams can also be drawn directly in source code using community libraries such as **CeTZ** (for 2D/3D geometric plotting and coordinate graphing) or **Fletcher** (for commutative diagrams and state machines).

### Licensing, terms, and access

The Typst Universe catalog operates under a decentralized open-source licensing model:
- **Contributor-selected open-source licensing:** Typst Universe does not enforce a single monolithic proprietary license across all hosted templates. Every package submitted to `github.com/typst/packages` must declare an SPDX-compliant license identifier in its `typst.toml` manifest (`license = "..."`), adhering to OSI-approved open-source licenses (MIT, Apache-2.0, BSD) or Creative Commons licenses (CC0-1.0, CC-BY-4.0).
- **Template-specific permissive license recommendation:** For packages providing a `[template]` configuration, official packaging guidelines recommend permissive licensing (such as MIT, MIT-0, CC0, or Apache-2.0) for the `template/` directory, ensuring users can adapt, compile, and distribute derived documents without forced copyleft obligations or attribution requirements.
- **Access model:** Browsing `typst.app/universe` and inspecting template documentation, metadata, and preview screenshots is completely free and requires no account. Downloading packages via the Typst CLI (`typst init` or `@preview` import) or direct HTTP tarball fetching is free, unauthenticated, and requires no API key. Using the cloud-hosted Typst Web App requires registering an account.
- **Documented pricing tiers:**
  - *Open Source Core:* The Typst compiler is 100% free and open-source under the Apache-2.0 license.
  - *Public Package Repository:* Typst Universe (`packages.typst.org`) is free to access, browse, and download.
  - *Typst Web App Free Plan:* $0/month (unlimited documents, real-time collaboration, access to community templates and packages).
  - *Typst Web App Pro Plan:* **$7.99/user/month** (adds project comments, private packages and templates, GitHub/GitLab synchronization, Zotero and Mendeley reference manager integrations, email invitations, and advanced slide presentation tools).
  - *On-Premises / Enterprise:* Custom pricing for self-hosted instances in enterprise data centers with LDAP/SSO access control and dedicated support.

### Human authoring and customization workflow

Customizing a template from Typst Universe follows two primary paths:
1. **Cloud Web App Flow:** An author browses `typst.app/universe`, clicks **"Start from template"** (or **"Open in app"**), and the platform clones the template into their dashboard as a personal project. The author modifies `.typ` code in a split-screen browser editor featuring syntax highlighting, document outline navigation, real-time multiplayer collaboration, and instant preview powered by an incremental WebAssembly compiler.
2. **Local CLI Flow:** An author opens a terminal and initializes a new workspace:
   ```bash
   typst init @preview/{template-name}:{version} my-document
   ```
   The CLI downloads the package tarball from `packages.typst.org`, extracts the template folder into `my-document`, and opens `main.typ`. The author opens the project in VS Code (with the `tinymist` LSP extension) and starts continuous live watch mode:
   ```bash
   typst watch main.typ output.pdf
   ```
   The incremental Rust compiler, powered by the `comemo` memoization library, updates `output.pdf` in sub-second intervals upon every file save.

## What you get from K2F Gallery

K2F Gallery ([k2f.dev/gallery](/gallery)) provides an open-source, machine-readable repository of **469+ production-grade document templates** engineered specifically for autonomous AI coding agents, software engineers, and automated publishing pipelines. Built on the open **K2F format** (licensed under **Apache 2.0**), K2F Gallery enables developers, publishing systems, and AI assistants to discover, customize, verify, and export pixel-stable publications without commercial paywalls, account registration, or desktop software lock-in:

- **100% free, zero-barrier access:** K2F Gallery requires zero login, no account creation, no API keys, no paywalls, no credit cards, no watermarks, and no download quotas. Anyone or any automated agent can download and utilize templates immediately under the permissive Apache 2.0 license.
- **Comprehensive document taxonomy:** Templates are organized across 7 major gallery groups encompassing 20 distinct document kinds:
  - `docs`: structured reports ([`/gallery/docs/report`](/gallery/docs/report)), corporate proposals ([`/gallery/docs/proposal`](/gallery/docs/proposal)), research papers ([`/gallery/docs/paper`](/gallery/docs/paper)), interactive forms ([`/gallery/docs/form`](/gallery/docs/form)), memos, newsletters, documentation guides, and books.
  - `presentations`: presentation slide decks ([`/gallery/presentations/presentation`](/gallery/presentations/presentation)).
  - `print-marketing`: marketing flyers, folded brochures, restaurant menus, formal certificates, business letters ([`/gallery/print-marketing/letter`](/gallery/print-marketing/letter)), posters, greeting cards, and infographics.
  - `planners`: daily and weekly productivity planners and educational worksheets ([`/gallery/planners/worksheet`](/gallery/planners/worksheet)).
  - `business`: corporate invoices ([`/gallery/business/invoice`](/gallery/business/invoice)) and legal contracts.
  - `career`: structured resumes and CVs ([`/gallery/career/cv`](/gallery/career/cv)).
  - `digital`: social media marketing assets.

### The dual-state .K2F package architecture

Every template in K2F Gallery is packaged as an open, self-contained ZIP archive encapsulating two synchronized representations:

- **State A (semantic tree):** Located at `content/root.json` (with support for modular multi-file includes via `{ "include": "content/..." }` in container `children`). State A contains pure semantic nodes tagged with mandatory, hierarchical dotted IDs (`parent_id.child_type_semantic_name`, e.g., `doc.header.title`, `invoice.items_table.row_1`, `form.applicant.signature`), closed-enum structural roles (`h1`, `card`, `warning`, `form_field`), optional `variant` tags, and semantic `modifiers` (such as inline emphasis, links, math, or syntax highlighting) specified with exact UTF-8 byte offset ranges `[start, end)` on character boundaries. State A strictly forbids physical coordinates, inline styling, colors, margins, or font sizes. (Placing styling directly on a node is the single most common compilation failure in K2F).
- **State C (render lock):** Located at `document.K2F.lock`. Compiled exclusively by the Rust reference engine (`k2f_layout` and `k2f_paint`), State C is an immutable geometry manifest storing exact millipoint coordinates, glyph positioning calculated via HarfBuzz text shaping (`rustybuzz`), Unicode UAX #14 line breaks, NFC string normalization, and deterministic paint operations (fills, strokes, gradients, box shadows, blurs) in explicit draw order, along with cryptographic hashes (`content_hash` and `appearance_hash`). (The reference engine is an external compilation pipeline, not an on-disk file inside the `.K2F` package.)
- **Self-contained assets and theming:** The package embeds all required TrueType/OpenType font files directly in `assets/fonts/`, visual images in `assets/images/`, tabular data in `assets/data/`, canvas presets in `manifest.json`, and all design tokens (color palettes, font definitions, and named box decoration primitives) in `styles/theme.json`.

### Strict intent–presentation separation and restyling

Because content and styling are strictly decoupled, visual restyling is completely deterministic. To update a document's visual branding, an author or AI agent modifies named tokens in `styles/theme.json` (such as switching palette colors, font stacks, or border radiuses). Recompiling the package via the reference engine (`f(content, theme) → geometry`) recalculates the render lock with zero coordinate drift, overlapping text frames, or broken margins.

### Single-source multi-format delivery

While Typst compiles natively to PDF, SVG, and PNG without native Microsoft Office or InDesign export, K2F serves as a unified master source that renders four production formats directly from the exact same compiled render lock:

1. **Microsoft Word (`.docx`):** Direct Word export rendered from the compiled render lock, drawing exact coordinates and glyph positions to preserve layout geometry, typography, and text content without OOXML run fragmentation or pagination shifts.
2. **Microsoft PowerPoint (`.pptx`):** Widescreen slide decks rendered directly from presentation templates.
3. **Adobe InDesign (`.idml`):** Clean InDesign Markup Language packages complete with an accompanying `Document Fonts/` directory containing all embedded font binaries, bridging automated agent workflows directly into professional prepress and agency workflows.
4. **Interactive AcroForm PDF:** High-resolution PDF documents where semantic `form_field` nodes compile directly into standard, fillable PDF form controls (text inputs, checkboxes, signature areas).

Deliverables exported from K2F are unidirectional drawings rendered from the compiled lock rather than round-trip sources of truth (`DOCX_IS_NOT_A_SOURCE`, `PPTX_IS_NOT_A_SOURCE`, `PDF_IS_NOT_A_SOURCE`, `IDML_IS_NOT_A_SOURCE`). In Word and PowerPoint, exported elements are drawn from lock coordinates and glyph positions rather than reflowable Office content controls.

### The agent authoring loop (unpack → design.md → edit → pack_verify)

K2F Gallery templates are built for autonomous AI agents operating in local developer environments (Cursor, Claude Code, Codex, Manus, Workbuddy) using the official K2F CLI (`pip install k2f`):

1. **Unpack:** The agent unpacks a downloaded package using `k2f unpack template.K2F -o ./source`, extracting editable State A files, theme tokens, and assets while omitting compiled locks and schemas.
2. **Design specification:** Agents write a structured Markdown design specification (`source/design.md`) outlining typography, role hierarchies, line rhythm, spacing grids, and palette intent before altering JSON files.
3. **Semantic editing:** The agent edits `content/root.json` and `styles/theme.json`. It targets exact dotted IDs and copies structural components from the golden catalog dictionary (`catalog/content/ex_*.json`) without inventing custom schema fields. Fillable blanks and checkboxes are created using semantic `form_field` nodes (copied from `catalog/content/ex_form.json`), never handwritten underscores (`____`) or square glyphs (`□`). Modifier byte ranges are computed via `scripts/modifier_range.py`.
4. **Pack and compile:** The agent executes `python scripts/pack_verify.py ./source -o ./doc.K2F --render preview.png`, invoking `k2f pack` and `k2f compile`. The engine deterministically shapes text, locks geometry, binds appearance hashes, and validates schema conformity against embedded JSON schemas (`/schema/`).
5. **Verification gate:** `pack_verify.py` asserts expected page counts (`--expect-pages N`), validates structural integrity (confirming default `UNSIGNED` state for machine edits), and renders pixel-accurate PNG preview sheets (`preview.png`, `preview-1.png`).
6. **Visual regression check:** Automated checks inspect the rendered preview for visual anomalies—specifically catching empty lower-third paper (`PAGE_UNDERFILL` / `LAYOUT_SLACK`) and requiring agents to pin the page shell using `ex_filled_page.json` before completing the task.

Every template page on [k2f.dev/gallery](/gallery) also provides a copyable prompt for coding assistants:
```text
Use the K2F skill to create a [describe what you want] using template https://k2f.dev/gallery/{slug}. Install with npx skills add suzheng/k2f --skill k2f if needed.
```

### Cryptographic trust and compliance

Every `.K2F` package computes a cryptographic `content_hash` over the semantic tree and an `appearance_hash` binding content, theme tokens, embedded font binaries, canvas settings, and the reference engine commit SHA (`engine_commit_sha`). Packages support optional asymmetric **Ed25519 digital signatures** (`signatures/v1.json`). Official viewers enforce a mandatory integrity banner displaying five canonical states (`SIGNED`, `UNSIGNED`, `SIGNED_BUT_BROKEN`, `BROKEN_INTEGRITY`, `UNLOCKED`), while alerting users to runtime layout engine discrepancies (`ENGINE_MISMATCH`). Machine edits default to `UNSIGNED`. Packages strictly prohibit executable scripts, macros, or dynamic external network requests, meeting enterprise legal, financial, and regulatory compliance requirements.

## Head-to-head

### Acquisition

Acquiring templates from Typst Universe is accessible through public endpoints, but presents distinct operational boundaries for autonomous software agents:
- **Public package metadata index:** Typst publishes an unauthenticated, machine-readable JSON index of all public preview packages at `GET https://packages.typst.org/preview/index.json`. This endpoint returns complete package metadata (name, version, authors, description, license, disciplines, categories, and template metadata), enabling scripts to query the catalog without browser interaction.
- **Predictable HTTP package tarballs:** Packages and templates follow a predictable, unauthenticated HTTP CDN URL structure: `GET https://packages.typst.org/preview/{name}-{version}.tar.gz`. Agents can download raw package archives using standard HTTP utilities (`curl`, `fetch`) without API keys or session cookies.
- **CLI scaffolding (`typst init`):** An agent with shell execution access can scaffold templates directly via the Typst CLI (`typst init @preview/{name}:{version} ./target-dir`).
- **Absence of a public Web App REST API:** Typst GmbH provides **no public REST API or GraphQL API** for managing user accounts, creating projects on `typst.app`, or triggering cloud compilations remotely. The web app operates strictly as an interactive SaaS frontend.
- **Absence of an official Typst MCP server:** Typst GmbH does not provide an official Model Context Protocol (MCP) server for searching, querying, or downloading templates from Typst Universe. While open-source community MCP servers exist (such as `typst-mcp`), they focus on wrapping the local `typst` CLI to validate syntax, run local compilations, and return preview images; they do not provide official API access to Typst Universe package listings or cloud workspaces.

K2F Gallery operates on an open, zero-barrier distribution model. Users and autonomous AI coding assistants visit [k2f.dev/gallery](/gallery) and download `.K2F` author packages, Word (`.docx`), PowerPoint (`.pptx`), InDesign (`.idml`), or fillable AcroForm PDF files with a single click, completely free of charge, with zero login, no accounts, and no download quotas. For autonomous agents, K2F Gallery provides zero-auth programmatic endpoints via standard HTTP `GET` requests:
```text
https://k2f.dev/api/gallery/templates/{slug}
https://k2f.dev/api/gallery/templates/{slug}/docx
https://k2f.dev/api/gallery/templates/{slug}/pptx
```
Alternatively, local AI agents can invoke the official stdio MCP toolset (`list_templates`, `get_template`, `download_template`) that returns `{ slug, packageUrl }` mirroring the public HTTP API, allowing agents to discover and unpack templates natively into their local workspace. Remote HTTP MCP services remain Not publicly specified. Because the entire catalog is licensed under Apache 2.0, teams own their templates outright and can track them in local Git repositories without commercial restrictions.

### Editing

Editing in Typst Universe centers around a code-based hybrid markup and Turing-complete functional programming language. Content text, presentation rules, function calls (`#show: project.with(...)`), conditionals (`#if ...`), and layout containers (`#grid(...)`, `#stack(...)`) coexist within the same code stream:
- **Total absence of mandatory stable node IDs:** Typst markup has **no native, mandatory, or hierarchical machine-addressable IDs**. Elements do not carry persistent IDs like `doc.header.title`, `invoice.items_table.row_1`, or `cv.experience.job_1`. While Typst supports optional labels (`<my-label>`) for cross-referencing (`@my-label`) and element introspection (`typst query`), standard paragraphs, headings, table cells, bullet points, and sidebar cards have no identifier tags. To locate and mutate content, an AI agent must parse code syntax, perform fragile regex text substitutions, or use line-number heuristics.
- **Syntactic and semantic fragility for AI agents:** Because `.typ` files are executable code, machine edits easily introduce syntax errors or broken document logic:
  - Editing inside a code block (`#{ ... }`) requires strict adherence to programming syntax; unescaped quotes or misplaced commas break compilation.
  - Modifying a complex template parameter (e.g., passing a list of authors or dictionary of settings to a `#show` rule) risks breaking the function's expected type signature.
  - Unbalanced square brackets (`[...]`) or parentheses corrupt content block scopes, causing compilation failures across the entire file.
- **Output PDF is a dead end:** The compiled deliverables produced by Typst are flat PDF, SVG, or PNG files. In PDF output, text is transformed into positioned font glyphs and vector geometry. An AI agent cannot semantically edit an exported Typst PDF; modifying a single phrase requires modifying the `.typ` source code and recompiling the document.

Editing in K2F Gallery is code-first, semantic, and machine-friendly. After running `k2f unpack`, the template expands into clean Canonical JSON files with sorted keys and 2-space indentation. Authors or AI agents edit content in `content/root.json` by targeting stable, hierarchical dotted IDs (`doc.header.title`, `invoice.items_table.row_1`). Because visual styling is quarantined entirely in `styles/theme.json`, changing text never accidentally shifts margins, corrupts padding, or breaks layout grids. All required fonts are embedded directly within `assets/fonts/`, eliminating font sync failures entirely. Changes are tracked in standard Git repositories, enabling precise line-by-line diffs, pull requests, and automated testing pipelines. Recompiling the package deterministically locks geometry via HarfBuzz shaping without requiring human spatial adjustments. Note that K2F is not designed for interactive visual sketching or casual drag-and-drop human drafting; it relies on structured semantic editing and deterministic engine compilation.

### Publishing

Publishing from Typst Universe is optimized for PDF and vector graphic distribution:
- **Compiled PDF stability vs compilation drift:** Once compiled by a specific Typst binary, the resulting PDF is highly stable, rendering pre-calculated vector glyphs and layout geometry consistently. However, Typst `.typ` source files do **not** embed pre-compiled layout geometry. Layout is computed dynamically on the fly during every compilation pass. Achieving deterministic, pixel-identical output across different machines requires the exact same Typst compiler version, the exact same package versions, and the exact same system fonts. If a document relies on local system fonts rather than explicit font files bundled with the project or passed via `--font-path`, differences between operating systems (e.g., macOS vs Ubuntu vs Windows font releases) cause font substitution, differing glyph metrics, altered line wraps, and shifted page breaks.
- **Compiler evolution and pre-1.0 breaking changes:** The Typst compiler is actively evolving pre-1.0 (versions 0.10, 0.11, 0.12, 0.13). Upstream compiler releases frequently introduce breaking changes to language syntax, standard library functions, context systems, or layout primitives. Consequently, older packages published in Typst Universe can break on newer compiler versions unless updated by maintainers or compiled with an older, pinned compiler binary.
- **Severed fork / clone update model:** When a user initializes a template via `typst init` or "Start from template", the template files are copied into the user's project as an independent, severed clone. If the upstream template author publishes an updated package version to Typst Universe (fixing layout bugs, updating university guidelines, or accommodating a new compiler release), previously initialized user projects receive **zero automated updates**. Updating requires manually inspecting diffs between template versions or updating the `#import` version string for shared library macros. Webhook notifications for template updates are Not publicly specified.
- **Mutable sharing links:** Typst Web App sharing links point to mutable cloud projects; subsequent edits modify the workspace. There is no cryptographic content hash binding a share link to a specific compiled snapshot.
- **Absence of geometry locking & cryptographic integrity:** Typst source files and Universe packages do not bundle an immutable render lock or define built-in cryptographic integrity banners, content hashes, appearance hashes, or digital signature manifests (`signatures/v1.json`). There are no standardized viewer verification states such as `SIGNED`, `UNSIGNED`, `BROKEN_INTEGRITY`, or `ENGINE_MISMATCH`.

K2F Gallery utilizes a single-source publishing model driven by its compiled render lock (`document.K2F.lock`). Because client viewers—including the WebAssembly `<k2f-viewer>` web component, Desktop Reader, and export filters—paint the render lock directly without reflowing text, document appearance remains strictly identical across all environments. A single `.K2F` package outputs four production formats simultaneously: pixel-aligned Microsoft Word (`.docx`), PowerPoint (`.pptx`), Adobe InDesign (`.idml`) packages with embedded fonts, and interactive AcroForm PDFs with real fillable inputs. Published documents carry cryptographic `content_hash` and `appearance_hash` values that prove visual fidelity down to the layout engine commit SHA, alongside optional Ed25519 digital signatures and mandatory viewer integrity banners (`SIGNED`, `UNSIGNED`, `SIGNED_BUT_BROKEN`, `BROKEN_INTEGRITY`, `UNLOCKED`). K2F v0.1 does not, however, support video templates, motion graphics, or photorealistic raster mockups.

### Agents

The agent experience highlights the core architectural divide between the two ecosystems:
- **Typst Universe for agents:** Autonomous agents equipped with shell execution tools can programmatically fetch package metadata via `packages.typst.org/preview/index.json`, download package tarballs via HTTP, and scaffold templates using `typst init`. However, because Typst documents are executable code combining markup and functional logic without mandatory node IDs, LLMs frequently introduce subtle syntax errors, unbalanced brackets, or broken function signatures when modifying `.typ` files. Furthermore, Typst GmbH provides no public REST API for cloud projects and no official MCP server. Compiling presentation templates yields landscape PDF pages rather than editable PowerPoint files, and form blanks remain static vector lines rather than interactive form fields.
- **K2F Gallery for agents:** K2F was engineered from day one for autonomous AI agents:
  - *Zero-auth programmatic access:* Agents fetch raw `.K2F` packages headlessly via standard HTTP `GET` requests to `/api/gallery/templates/{slug}` or via the official stdio MCP toolset (`list_templates`, `get_template`, `download_template`) with zero API keys, OAuth flows, or paid quotas.
  - *Machine-readable JSON AST:* Unpacking a template yields clean JSON with stable, hierarchical dotted IDs. Agents address and patch specific content nodes (e.g., updating `doc.header.title` or `invoice.items_table.row_1`) with exact mathematical precision.
  - *Local compilation and zero-cost quality gates:* Agents compile documents, shape text via HarfBuzz, lock geometry, validate schemas, and render PNG preview sheets locally on their CPU in milliseconds using `pack_verify.py` and the reference CLI (`pip install k2f`). No cloud API calls, subscription fees, or network latencies are incurred.
  - *Self-correcting feedback loops:* When an agent introduces an error, the compiler outputs structured machine-readable error codes (`SCHEMA_INVALID`, `UNKNOWN_ID`, `PAGE_UNDERFILL`), providing the agent with the exact feedback needed to autonomously repair the document before publishing.

## When to choose Typst Universe

Choose Typst Universe when your workflow centers on academic publishing, scientific manuscripts, complex mathematical typesetting, and human-written technical prose:

- **Academic, scientific & mathematical typesetting:** You are authoring research papers, conference submissions, or journal preprints requiring advanced math layout matching LaTeX in typographic sophistication while using a much cleaner, intuitive syntax (e.g., `$x / y$` instead of `\frac{x}{y}`).
- **Native bibliography and citation management:** You need built-in citation formatting and bibliography compilation supporting BibLaTeX and CSL (Citation Style Language) via the integrated **Hayagriva** engine, alongside automated cross-referencing for sections, equations, tables, and figures.
- **University theses & doctoral dissertations:** You need pre-structured academic thesis frameworks adhering to university-specific formatting guidelines with front matter, declarations, and automated chapter-level bibliographies.
- **Arbitrary programmatic vector drawing & diagramming:** You want to generate complex geometric plots, charts, coordinate graphs, or commutative state diagrams directly within document source code using community libraries such as **CeTZ** or **Fletcher**.
- **Turing-complete functional layout logic:** Your templates require dynamic layout computation, conditional rendering (`#if ...`), custom `#show` rules, functional loops, and algorithmic page counters embedded directly within the document language.
- **Sub-second incremental compilation:** You value rapid incremental recompilation powered by Rust and `comemo` memoization during local editing (`typst watch`) or cloud web app sessions.
- **Collaborative cloud web IDE:** You want a polished browser-based writing environment with split-screen editing, document outline navigation, and real-time multiplayer co-authoring without managing local compiler toolchains.
- **PDF-only deliverables:** Your publication target is strictly a publication-ready PDF or vector SVG/PNG, and you do not require native Microsoft Word, PowerPoint, Adobe InDesign, or interactive fillable AcroForm outputs.

## When to choose K2F Gallery

Choose K2F Gallery when your workflow demands autonomous AI agent authoring, strict cross-device layout determinism, open-source ownership, and single-source multi-format delivery:

- **Autonomous AI agent document generation:** You utilize AI coding assistants (Claude Code, Cursor, Codex, Manus, Workbuddy) or automated software backends to generate, customize, patch, or restyle production documents programmatically using stable dotted IDs without human pre-tagging.
- **Single-source multi-format enterprise publishing:** You must maintain a single authoritative template package that exports deterministically into pixel-aligned Microsoft Word (`.docx`), PowerPoint (`.pptx`), Adobe InDesign (`.idml`), and interactive AcroForm PDF files from a single compiled render lock.
- **Native Microsoft Office delivery:** You need high-fidelity Word and PowerPoint deliverables and cannot tolerate the absence of native `.docx` templates or the layout fragmentation caused by lossy PDF conversion tools (with the understanding that exported elements are drawn from lock geometry rather than reflowable Office content controls).
- **Deterministic cross-device visual stability:** You require documents that render with bit-exact consistency across macOS, Windows, Linux, and web browsers, backed by pre-calculated HarfBuzz text shaping, embedded TrueType/OpenType font binaries, and render lock painting—completely eliminating compiler version drift and font fallback reflow.
- **Interactive fillable PDF form generation:** You need to produce interactive applications, contracts, or sign-off sheets where semantic `form_field` nodes compile directly into standard interactive AcroForm PDF controls rather than static drawn lines.
- **Zero-auth, open-source adoption:** You require free, unrestricted access to production templates under the Apache 2.0 license, with zero subscription fees, no accounts, no credit cards, no paywalls, and no download quotas.
- **Git-native version control and CI/CD pipelines:** You want documents stored as clean Canonical JSON files that can be versioned in Git repositories, reviewed line-by-line in pull requests, and compiled in automated sub-second CI/CD pipelines without auxiliary file bloat.
- **Local compilation and complete data privacy:** You need an authoring and compilation pipeline that runs entirely offline on local CPU hardware via lightweight command-line tools (`k2f pack`, `pack_verify.py`), ensuring proprietary or regulated data never leaves your environment.
- **Tamper-evident legal and financial compliance:** You publish documents requiring mathematical proof of integrity via cryptographic `content_hash`, `appearance_hash`, optional Ed25519 digital signatures, and mandatory viewer integrity banners (`SIGNED`, `UNSIGNED`, `SIGNED_BUT_BROKEN`, `BROKEN_INTEGRITY`, `UNLOCKED`).

## Bottom line

Typst Universe and K2F Gallery address two fundamentally different authoring models and target audiences. Typst Universe serves academic researchers, scientists, students, and technical authors seeking a modern, high-performance code-driven typesetting system to replace LaTeX. With advanced native math typesetting, built-in citation management via Hayagriva, programmatic vector graphics via CeTZ, and sub-millisecond Rust compilation, Typst provides a responsive, developer-grade writing experience. However, its reliance on Turing-complete functional scripts where markup and code are intertwined, the total absence of mandatory machine-addressable node IDs, syntactic fragility for LLMs, and exclusive focus on static PDF/SVG/PNG outputs create operational barriers for autonomous AI coding agents and enterprise multi-format publishing pipelines.

K2F Gallery provides an open, agent-native document catalog engineered specifically for programmatic authoring. By providing free, Apache 2.0-licensed `.K2F` packages that cleanly decouple semantic JSON trees from deterministic render locks, K2F enables AI coding assistants to discover templates headlessly, patch content with pinpoint accuracy via stable dotted IDs, verify visual quality locally in milliseconds, and compile single-source deliverables across Word, PowerPoint, InDesign, and fillable PDF.

To explore ready-to-use production templates across business, legal, marketing, and publishing categories, browse the [Gallery](/gallery) on [k2f.dev](https://k2f.dev). For technical specifications, format documentation, and layout engine architecture, visit the [documentation](/docs) or experiment with templates directly in the interactive [Playground](/playground). To understand the architectural motivation behind the format, read [why K2F exists](/why), or explore how K2F compares to other publishing standards on [Compare](/compare) (such as [Typst versus K2F](/compare/typst), [LaTeX versus K2F](/compare/latex), [PDF versus K2F](/compare/pdf), [Microsoft Word versus K2F](/compare/word), [PowerPoint versus K2F](/compare/pptx), [Adobe InDesign versus K2F](/compare/idml), [Markdown versus K2F](/compare/markdown), [Overleaf Templates versus K2F Gallery](/compare/overleaf-templates), [Google Docs Template Gallery versus K2F Gallery](/compare/google-docs-templates), [Google Slides Template Gallery versus K2F Gallery](/compare/google-slides-templates), [Microsoft Create versus K2F Gallery](/compare/microsoft-create), [Canva Templates versus K2F Gallery](/compare/canva-templates), [Adobe Express Templates versus K2F Gallery](/compare/adobe-express-templates), [Freepik Templates versus K2F Gallery](/compare/freepik-templates), [Envato Elements versus K2F Gallery](/compare/envato-elements), and [Creative Market versus K2F Gallery](/compare/creative-market)).

This comparison is based on publicly available information at the time of writing. Capabilities, pricing, and policies may change; verify details with the relevant provider.
