# Overleaf 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 cleanly separate declarative semantic intent from deterministic geometry. Rather than treating a document as an unstructured stream of Turing-complete LaTeX macros or a static, write-only PDF drawing file, 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 tokens, TeX engine 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. Overleaf Templates operates within the traditional TeX typesetting paradigm: source code compiles exclusively to Portable Document Format (PDF) via cloud TeX engines (`pdflatex`, `xelatex`, or `lualatex`). It provides zero native Microsoft Word (`.docx`), PowerPoint (`.pptx`), or Adobe InDesign (`.idml`) export, and does not produce native interactive fillable AcroForm PDFs. Conversely, K2F is not an academic journal submission portal, a cloud-hosted browser IDE, or a replacement for specialized mathematical macro packages like TikZ or ChemFig. 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 Beamer slide decks or interactive 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 legacy LaTeX source trees (`LATEX_IS_NOT_A_SOURCE`). 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 | Overleaf Templates | K2F Gallery |
| :--- | :--- | :--- |
| **Primary audience** | Academic researchers, scientists, university faculty, PhD candidates, and technical authors preparing manuscripts, dissertations, and conference presentations | Autonomous AI coding agents, software engineers, and automated multi-format document publishing pipelines |
| **Catalog scope & document genres** | Thousands of templates spanning academic journals, university theses/dissertations, Beamer slides, posters (`tikzposter`), CVs (`moderncv`), and monographs | 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 LaTeX source trees (`.tex`, `.cls`, `.sty`, `.bib`, `.bst`) bundled with static image assets (`.pdf`, `.eps`, `.png`, `.jpg`) | 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 headless automation barrier: no public template REST API; requires authenticated browser sessions or fragile regex/macro parsing prone to catastrophic catcode crashes | 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** | No local Overleaf CLI; compiling offline requires installing a 4 GB to 8 GB TeX Live distribution, managing multi-pass build scripts (`latexmk`, `bibtex`), and resolving CTAN package dependencies | 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 exclusively to Portable Document Format (PDF); 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 generation; Beamer slides render strictly as slide-dimensioned PDF pages; third-party conversions (Pandoc) break custom macros and math | 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)** | Virtual absence of interactive forms; blank fields render as static vector lines (`\rule{...}{...}`); requires manual post-processing in Adobe Acrobat Pro | Native `form_field` nodes compile directly into standard interactive PDF AcroForms (`/Tx`, `/Btn`, `/Ch`) with functional text boxes, checkboxes, and signatures |
| **Font handling & rendering stability** | pdfLaTeX relies on legacy TeX Font Metrics (TFM) and Type 1 fonts; XeLaTeX/LuaLaTeX support OpenType via `fontspec` but are restricted to pre-installed cloud TeX Live fonts; source drifts across TeX releases | 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** | Unrivaled global gold standard for complex mathematical formulas, tensor calculus, algorithmic pseudocode, and programmatic vector graphics via TikZ/PGFPlots | Closed-enum semantic `math` modifier and role (supporting a basic TeX math subset; no native academic bibliography engine); basic shapes use role and variant box decoration; complex vector assets must be imported as pre-rendered SVGs or images in `/assets/` |
| **License & distribution** | Heterogeneous contributor licensing (LPPL v1.3c, CC BY 4.0, MIT/BSD, publisher-restricted copyright); free personal browsing; paid plans ($199–$399/yr); automated scraping prohibited | 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 source-to-PDF compilation 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** | Proprietary cloud revision history; premium Git bridge (`git.overleaf.com`) and GitHub sync; Git repos often suffer bloat from auxiliary TeX files (`.aux`, `.bbl`, `.fls`, `.log`) | Git-native Canonical JSON (sorted keys, 2-space indentation); clear line-by-line semantic diffs; pull request code reviews; optional `changelog.json` |
| **Pricing model** | Free plan ($0/mo, 1 collaborator); Standard plan (~$199/yr or $21–$25/mo); Professional plan (~$399/yr or $35–$40/mo); Institutional Commons (campus licenses) | Completely free public repository; zero subscription fees and zero compute costs for human users and automated software agents |
| **Source of truth boundary** | Plain-text LaTeX source trees; compiled PDF is a static, write-only 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 LaTeX (`PDF_IS_NOT_A_SOURCE`, `DOCX_IS_NOT_A_SOURCE`, `LATEX_IS_NOT_A_SOURCE`); exported Office, PDF, and IDML files are unidirectional read-only lock drawings (`*_IS_NOT_A_SOURCE`) |

## Overleaf Templates vs K2F Gallery: What Overleaf Templates offers

Overleaf Templates serves as the premier global template repository for academic, scientific, and mathematical document preparation. Accessible directly at `overleaf.com/latex/templates`, the gallery provides thousands of pre-structured LaTeX project environments maintained by individual researchers, university departments, academic societies, and commercial publishers.

### Catalog scope and academic genres

The Overleaf template directory aggregates extensive template offerings across technical and scholarly disciplines:
- **Academic Journals & Conference Papers:** Official submission templates adhering strictly to publication guidelines for major publishers and preprint repositories, including IEEE, ACM, Springer Nature, Elsevier, American Physical Society (APS), American Mathematical Society (AMS), PLOS, Wiley, Taylor & Francis, arXiv, and bioRxiv.
- **Theses & Dissertations:** University-specific doctoral dissertation, master's thesis, and graduation report templates pre-configured with the formal margin, title page, and front-matter regulations of hundreds of academic institutions worldwide.
- **Presentations & Slide Decks:** LaTeX Beamer presentation decks (`\documentclass{beamer}`) and lecture slide frameworks featuring modular color themes, overlay specifications, structured proof blocks, and equation environments.
- **Posters & Visual Summaries:** Large-format academic conference poster templates built upon specialized packages including `beamerposter`, `tikzposter`, and `sciposter`.
- **Curricula Vitae (CV) & Resumes:** Highly structured academic CVs and technical resumes utilizing popular LaTeX packages such as `moderncv`, `altacv`, `twentysecondcv`, and `europasscv`.
- **Educational Materials:** Course syllabi, assignment cover sheets, problem sets, lab reports, lecture notes, and formal exam papers utilizing `\documentclass{exam}`.
- **Books & Monographs:** Full-length academic textbook and monograph layouts utilizing `\documentclass{book}` or KOMA-Script (`\documentclass{scrbook}`).
- **Formal Correspondence:** Institutional letterheads, formal business correspondence (`\documentclass{letter}`), and cover letters.

### Underlying source architecture

All templates in the Overleaf catalog are packaged as collections of plain-text LaTeX source files and static graphic assets bundled within a cloud project directory:
- Master and modular LaTeX source files (`.tex`).
- Document class definitions (`.cls`) establishing overall page geometry, baseline grids, typographic hierarchies, and layout environments.
- Style package files (`.sty`) supplying specialized command macros, package imports, and custom formatting rules.
- BibTeX and BibLaTeX bibliography database files (`.bib`) paired with bibliography style definitions (`.bst`, `.bbx`, `.cbx`).
- Static graphic assets, including vector diagrams (`.pdf`, `.eps`) and raster photography (`.png`, `.jpg`).

### Output compilation and delivery limits

The compilation and deliverable model in Overleaf reveals clear architectural boundaries:
- **Exclusive PDF compilation:** Overleaf templates compile **exclusively to Portable Document Format (PDF)** via sandboxed cloud TeX engines (`pdflatex`, `xelatex`, or `lualatex`).
- **Zero native Microsoft Word (`.docx`) or PowerPoint (`.pptx`) export:** Overleaf does not generate, distribute, or export editable Microsoft Office files. While Beamer templates produce presentation slides, they render strictly as slide-dimensioned PDF pages. They do not generate editable PowerPoint shapes, text boxes, or PresentationML objects. Attempting to convert LaTeX documents to Word using third-party utilities such as Pandoc frequently fails: custom TeX macros expand incorrectly, complex mathematical environments collapse, and custom table alignments break.
- **Zero Adobe InDesign (`.idml`) or prepress support:** Overleaf provides no support for professional desktop publishing interchange formats such as Adobe InDesign (`.idml`), Adobe Photoshop (`.psd`), or Adobe Illustrator (`.ai`). High-end commercial prepress workflows, CMYK color separation curves, bleed marks, and agency design layouts fall outside Overleaf's scope.
- **Virtual absence of interactive AcroForm PDF templates:** Although specialized TeX packages exist to insert form fields (such as `hyperref`'s `\TextField` or `eforms`), Overleaf templates almost universally treat PDF as a static print or viewing medium. Templates designed as worksheets, intake sheets, invoices, or application forms render blanks as static vector underlines (`\rule{...}{...}` or `\hrulefill`). They do not produce native interactive AcroForm fields (`/Tx`, `/Btn`, `/Ch`). Converting them into interactive digital forms requires manual post-processing in specialized tools such as Adobe Acrobat Pro.

### Font and asset handling

Font management in Overleaf is tied to the selected underlying TeX compilation engine:
- **pdfLaTeX Engine:** Relies on traditional TeX Font Metric files (`.tfm`), Virtual Fonts (`.vf`), and PostScript Type 1 font packages (e.g., Computer Modern, Latin Modern, Times, Palatino, Fourier). Standard TrueType (`.ttf`) and OpenType (`.otf`) fonts cannot be loaded directly without complex metric generation.
- **XeLaTeX & LuaLaTeX Engines:** Support modern system and OpenType/TrueType fonts via the `fontspec` macro package. However, available font families are constrained to those pre-installed within Overleaf's cloud TeX Live distribution containers.
- **Asset Hosting:** Figure graphics and data files reside locally within the project directory tree and are referenced via standard relative file paths (`\includegraphics{figures/chart.png}`).

### Licensing, terms, and access

The Overleaf template catalog operates under a decentralized licensing model:
- **Heterogeneous contributor licensing:** Licensing is not uniform across the gallery. Individual authors, university departments, and publishers designate terms for their respective submissions.
- **Prevalent license models:** Common licenses include the LaTeX Project Public License (LPPL v1.3c)—which permits inspection, copying, and modification, but requires derivative works to change the file name to prevent namespace collision across TeX installations—along with Creative Commons Attribution (CC BY 4.0 / CC BY-SA), MIT, and BSD licenses. Official journal templates (IEEE, ACM, Springer Nature, Elsevier) remain the intellectual property of the publishers; while freely available for drafting submissions to those specific venues, commercial redistribution or bundling into commercial products is prohibited under publisher copyright policies.
- **Platform terms & redistribution restrictions:** Under the Overleaf Terms of Service, users retain copyright in their original prose and uploaded assets. Reselling or distributing the raw Overleaf template catalog as a competing standalone repository is prohibited. Overleaf Terms of Service explicitly prohibit automated crawling, scraping, or bot extraction of gallery pages, project workspaces, and internal compiler endpoints outside authorized interfaces.
- **Access model:** Browsing the template catalog and inspecting live PDF previews is freely available without an account. However, clicking "Open as Template" to instantiate a project or downloading its source files requires creating or signing into an Overleaf account (personal, Google SSO, ORCID, or institutional SSO).
- **Documented pricing tiers:**
  - *Free Plan:* $0/month (unlimited projects, 1 collaborator per project, standard compilation timeout, basic Overleaf AI credits).
  - *Standard Plan:* Approximately **$199/year** (or ~$21–$25/month billed monthly); includes up to 10 collaborators per project, full version history, Track Changes, GitHub synchronization, Dropbox integration, reference manager integrations (Zotero/Mendeley), and increased compilation timeouts.
  - *Professional Plan:* Approximately **$399/year** (or ~$35–$40/month billed monthly); includes unlimited collaborators per project, priority compilation servers, priority support, and maximum Overleaf AI credits.
  - *Institutional Commons:* Free premium access provided to faculty, researchers, and students through participating university campus licenses.

### Human customization and multiplayer collaboration workflow

Customizing an Overleaf template is centered around a cloud-based human authoring workflow:
1. **Discovery & instantiation:** The user browses categories at `overleaf.com/latex/templates`, selects a template card, and clicks **"Open as Template"**. Overleaf provisions a new cloud project within the user's dashboard, creating an isolated, severed clone of the source file tree.
2. **Cloud editing environment:** Authors work within a split-screen browser interface featuring a code editor with syntax highlighting, macro autocomplete, citation lookups, and linting. A "Visual Editor" mode provides a semi-WYSIWYG surface for non-technical co-authors, rendering formatted headings, tables, and inline math while retaining underlying LaTeX code.
3. **Cloud compilation:** Clicking **"Recompile"** dispatches the source tree to a sandboxed TeX Live backend. Compilation logs report warnings (such as Overfull `\hbox` and Underfull `\vbox`) and syntax errors with line jump shortcuts.
4. **Real-time collaboration:** Research teams utilize multiplayer co-authoring with colored cursor presence, granular Track Changes (proposing, accepting, or rejecting edits), threaded inline comments, and shared bibliography libraries (Zotero, Mendeley).
5. **Delivery channels:** Authors download compiled PDFs directly, export source bundles as `.zip` archives via `Menu → Download → Source`, submit manuscripts directly to publisher portals (IEEE, Springer Nature, arXiv, bioRxiv), share read-only or editable cloud links, or synchronize code via the Git bridge (`git clone https://git.overleaf.com/...`) or GitHub sync on premium tiers.

## 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 Overleaf compiles exclusively to PDF and cannot export native Microsoft Word, PowerPoint, or Adobe InDesign files, 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 → 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 a template from Overleaf Templates is designed as an interactive human browser journey. A researcher visits `overleaf.com/latex/templates`, browses taxonomy cards, and clicks "Open as Template," which clones the project source into their cloud dashboard. However, for programmatic engineering workflows and autonomous AI coding agents, Overleaf presents severe operational barriers:
- **Absence of a public REST / GraphQL API:** Overleaf provides **no public developer API, no GraphQL endpoint, and no programmatic interface** to search, query, inspect, or download template source trees from its gallery catalog.
- **The "Overleaf API" misnomer:** While Overleaf documents what it terms the "Overleaf API" (`overleaf.com/devs`), this is not a programmatic manipulation or extraction API. It is strictly an inbound URL button generator (`https://www.overleaf.com/docs?snip_uri=...` or `project_uri=...`) that allows external websites or journals to redirect a user's browser into an Overleaf editing session with an ingested `.tex` or `.zip` file. It cannot be used by an agent to query catalog items, download templates headlessly, or trigger cloud compilation.
- **Zero Model Context Protocol (MCP) support:** There is no official MCP server for Overleaf. An autonomous AI agent connected via MCP cannot discover, inspect, or download templates from Overleaf.
- **Scripted download barriers:** Overleaf template pages provide no unauthenticated direct download URLs (such as `GET /api/templates/{slug}`) to fetch project archives via `curl` or `fetch`. Attempting to script downloads requires orchestrating browser sessions, managing authenticated session cookies, and reverse-engineering private WebSocket/RPC calls, which violates Overleaf's Terms of Service against automated scraping and breaks whenever frontend assets update.
- **Local compilation overhead:** Because Overleaf provides no headless cloud compiler API for external scripts, an agent that manages to download a template archive must compile it locally. This requires maintaining a 4 GB to 8 GB TeX Live distribution, resolving complex CTAN dependencies, and orchestrating multi-pass build tools (`latexmk`, `bibtex`).

K2F Gallery operates on a frictionless, 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 stdio MCP tool (`download_template`) to retrieve template packages directly into their workspace. 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 Overleaf is centered around a human split-screen code and visual editor. A human author writes LaTeX commands, types mathematics, imports packages in the preamble, and reviews the compiled PDF pane. However, for autonomous AI coding agents, LaTeX presents severe syntactic and structural hazards:
- **Turing-complete macro expansion:** LaTeX source code in `.tex` files is an expansion-based, Turing-complete macro language. Document content, structural metadata, typographic directives, and programmatic macro definitions coexist within an unstructured text stream. It is not an Abstract Syntax Tree (AST) and not a structured JSON document.
- **Total absence of persistent node IDs:** In LaTeX, document elements have **no native, mandatory, or hierarchical machine-addressable IDs**. There is no `id: "doc.header.title"`, no `id: "invoice.items_table.row_1"`, and no `id: "cv.experience.job_1"`. While LaTeX supports cross-referencing labels (`\label{sec:intro}`), these are used solely by the compiler to resolve section and equation counters (`\ref`). Paragraphs, table rows, and callout blocks lack identifier tags. To modify text, an AI agent must rely on fragile regex patterns or line-number heuristics, which easily mutate the wrong section or corrupt adjacent markup.
- **Lexical and catcode fragility:** TeX tokenization is governed by 16 dynamic category codes ("catcodes"). Unescaped characters routinely crash compilation: an unescaped percent sign (`%`) treats the remainder of the line as a comment, silently deleting content; unescaped underscores (`_`), ampersands (`&`), hashes (`#`), or dollar signs (`$`) trigger fatal compiler aborts (e.g., `! Missing $ inserted`); and mismatched curly braces (`{ ... }`) corrupt macro argument scoping across entire files. LLM agents inserting realistic text containing business symbols (`$100`, `user_name`, `50%`, `AT&T`) consistently break LaTeX compilation unless exhaustive character escaping is performed.
- **Non-decidable parsing:** Because macros can dynamically alter catcodes at runtime, parsing arbitrary LaTeX source without executing the full TeX engine is mathematically undecidable. Third-party AST parsers (such as `TexSoup` or Pandoc) only parse limited subsets and frequently mangle custom macros, drop spacing, or fail completely.
- **Moving arguments:** Commands placed inside section headings, captions, or table of contents entries expand prematurely during write-out to `.aux` files, corrupting subsequent compilation passes unless shielded with `\protect`.
- **Output PDF is a dead end:** The compiled deliverable is a static PDF. PDF is a write-only visual drawing format where text is converted into flat glyph coordinates. An AI agent cannot semantically edit an exported PDF; modifying a single sentence requires recompiling the underlying TeX source or attempting lossy text extraction.

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 seamlessly 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 Overleaf is optimized for academic journal transmission and print-ready PDF distribution:
- **Cloud TeX compilation to PDF:** Overleaf projects compile to PDF via server-side TeX engines. While the compiled PDF provides fixed visual output in standard PDF readers, the underlying `.tex` source code is **fundamentally not pixel-stable across different environments or time**:
  1. *TeX Live release variances:* Compiling the exact same `.tex` project on TeX Live 2021 versus TeX Live 2024 frequently yields different paragraph line breaks, altered page counts, and displaced floating figures due to subtle updates in core CTAN packages and micro-typography algorithms.
  2. *Engine incompatibilities:* Compiling under `pdflatex`, `xelatex`, or `lualatex` invokes distinct font shaping engines, altering glyph boundaries and text wrapping.
  3. *System font discrepancies:* In XeLaTeX/LuaLaTeX projects using `fontspec`, differences in local font files across machines cause unpredictable text reflow.
- **Severed fork / clone update model:** When a user clicks "Open as Template," Overleaf creates an isolated, severed clone within the user's account. If the upstream author or publisher updates the template (e.g., updating journal guidelines, fixing macro bugs, or modifying class files), existing user projects receive **zero updates**. There is no package manager, no semantic versioning (`v1.2.0`), and no upstream merge mechanism. Webhook notifications for template updates are Not publicly specified.
- **Mutable sharing links:** Overleaf sharing links point to mutable cloud projects; subsequent edits modify the workspace. There is no cryptographic content hash binding a link to a specific compiled snapshot.
- **Absence of geometry locking & cryptographic integrity:** Overleaf source code does not bundle an embedded geometry manifest. Producing identical visual output requires re-running the entire multi-pass layout engine every time. Overleaf templates provide no cryptographic checksums (`content_hash` or `appearance_hash`) binding semantic text to visual layout, and no embedded asymmetric digital signatures (such as Ed25519) to alert readers to modifications (`BROKEN_INTEGRITY`, `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. Overleaf Templates is separated from autonomous AI coding agents by an architectural divide between interactive human web portals and headless automated workflows:
- **No public template API or discovery tools:** Agents cannot query, browse, or instantiate templates programmatically.
- **No headless cloud compiler API:** Overleaf provides no API endpoint to dispatch TeX compilation jobs headlessly. An agent cannot send source files to Overleaf's backend and receive a compiled PDF.
- **Heavy local compilation overhead:** To compile downloaded LaTeX templates locally, an agent must operate within an environment containing a 4 GB to 8 GB TeX Live distribution, execute multi-pass build scripts (`latexmk`, `bibtex`, `makeindex`), and navigate platform-specific font metric failures.
- **Cryptic compilation failures:** When an LLM introduces a syntax error (such as an unescaped `%` or unbalanced brace), TeX compiler error logs can be cryptic, non-local, and difficult for an autonomous agent to diagnose and repair deterministically.

K2F Gallery 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 stdio MCP tool (`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 `proposal.budget_table.row_1`) with exact 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 Overleaf Templates

Choose Overleaf Templates when your workflow centers on peer-reviewed academic publishing, formal mathematical notation, and real-time multiplayer co-authoring across institutional research groups:

- **Peer-reviewed academic & scientific journal publishing:** You are preparing manuscripts for submission to IEEE, ACM, Springer Nature, Elsevier, American Physical Society (APS), American Mathematical Society (AMS), PLOS, Wiley, or preprint servers (arXiv, bioRxiv) and must comply with publisher-certified LaTeX class files (`.cls`).
- **Direct journal submission integration:** You want to transmit completed manuscripts directly from your writing environment into publisher editorial systems (such as Editorial Manager or ScholarOne) without manual file packaging.
- **Advanced mathematical and scientific typesetting:** Your document relies on Donald Knuth's TeX typesetting engine for complex mathematical formulas, tensor calculus, multi-line equation alignment, and formal mathematical proofs.
- **Specialized scientific macro packages:** You require domain-specific LaTeX packages, including `algorithmicx` or `algorithm2e` for pseudocode, `chemfig` for chemical structures, `circuitikz` for electrical circuits, `feynman` for quantum field diagrams, or `tikz` and `pgfplots` for programmatic vector data plotting.
- **Comprehensive bibliography and citation management:** You need battle-tested citation formatting across thousands of publisher citation styles (BibTeX, BibLaTeX with Biber) with dynamic reference numbering, glossaries, and multi-level indexes.
- **University-approved doctoral dissertations:** You need pre-configured thesis layouts that satisfy the strict graduate school formatting regulations of hundreds of global universities.
- **Real-time academic co-authoring & institutional access:** You collaborate synchronously with academic co-authors, utilizing live multiplayer cursors, Track Changes, inline comments, reference manager integrations (Zotero, Mendeley), and free campus-wide access via Overleaf Commons Single Sign-On (SSO).
- **PDF-only deliverables:** Your publication target is strictly a static, publication-ready PDF where Microsoft Word, PowerPoint, or Adobe InDesign formats are not required.

## 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 font binaries, and render lock painting—completely eliminating the compiler engine and font fallback drift of raw `.tex` files.
- **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 (`.aux`, `.bbl`, `.fls`, `.log`).
- **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

Overleaf Templates and K2F Gallery address two fundamentally different authoring models and audiences. Overleaf Templates serves academic researchers, scientists, and university faculty seeking a collaborative, cloud-hosted LaTeX platform backed by decades of typesetting heritage, official publisher-certified journal templates, and seamless integrations with academic editorial systems. However, its reliance on Turing-complete, macro-expansion source trees lacking machine-addressable node IDs, the complete absence of a public template API or headless compilation API, dynamic catcode fragility, and exclusive focus on static PDF output create severe bottlenecks for autonomous AI coding assistants and modern 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 [LaTeX versus K2F](/compare/latex), [Typst versus K2F](/compare/typst), [PDF versus K2F](/compare/pdf), [Microsoft Word versus K2F](/compare/docx), [PowerPoint versus K2F](/compare/pptx), [Adobe InDesign versus K2F](/compare/idml), [Markdown versus K2F](/compare/markdown), [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.
