AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(latex): ship LaTeX formula rendering — Strategist-locked manifest, 4-provider fallback
hugohe3de7bc6f9e39a
diff --git a/CLAUDE.md b/CLAUDE.mdindex 576b0b2f..dc055e34 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -63,6 +63,10 @@ python3 skills/ppt-master/scripts/project_manager.py validate <project_path># Image tools and SVG quality checkpython3 skills/ppt-master/scripts/analyze_images.py <project_path>/images+# Formula rendering — manifest written by Strategist after typography confirmation:+python3 skills/ppt-master/scripts/latex_render.py <project_path>+python3 skills/ppt-master/scripts/latex_render.py <project_path> --dry-run+python3 skills/ppt-master/scripts/latex_render.py <project_path> --providers codecogs,quicklatex,mathpad,wikimedia# In-pipeline AI image generation — manifest mode (required, even for 1 image):python3 skills/ppt-master/scripts/image_gen.py --manifest <project_path>/images/image_prompts.jsonpython3 skills/ppt-master/scripts/image_gen.py --render-md <project_path>/images/image_prompts.jsondiff --git a/docs/roadmap.md b/docs/roadmap.mdindex b5f24b20..08f80eb6 100644--- a/docs/roadmap.md+++ b/docs/roadmap.md@@ -41,16 +41,7 @@ The past two months' structural capability growth. Single flags / incremental po- **AI image `custom` escape hatch** — `rendering` / `palette` / hero composition each accept `custom` + a one-paragraph `*_behavior` prose, replacing the false "default to vector-illustration / cool-corporate" fallback; end-to-end contract spans [`image-renderings/_index.md`](../skills/ppt-master/references/image-renderings/_index.md) §1.5, [`image-palettes/_index.md`](../skills/ppt-master/references/image-palettes/_index.md) §2, Strategist h.5 hard-rule (≤1 custom per dimension; one candidate may carry both), spec_lock fields, and Image_Generator Step 2 consumption branch- **Template architecture: three-kind consolidation** ([`docs/templates-architecture.md`](./templates-architecture.md)) — brand / layout / deck split into three independent dirs with per-kind schemas + segment-level fusion + git-style conflict resolution; SKILL.md Step 3 dispatches per `kind`, trigger rule remains "explicit path only"- **Pattern fill PPTX safety net** — `svg_quality_checker.py` now warns on `<pattern>` without `data-pptx-pattern` (silent fallback to `ltUpDiag`) and errors on values outside OOXML `ST_PresetPatternVal` (schema-failed PPTX that won't open); `shared-standards.md §7` documents the closed preset enum and the required `<rect fill="<bg>"/>` child convention-------## Under consideration--Directions identified but not yet prioritized or scheduled — on the radar, not on a timeline.--### LaTeX math formula rendering--LaTeX source files are already accepted on the input side ([SKILL.md](../skills/ppt-master/SKILL.md) Step 1, [faq.md](./faq.md)), but the output side has no dedicated rendering path — math symbols on generated SVG currently fall back to bare Unicode. Formula-heavy decks (academic / engineering / educational) have no native rendering route today.+- **LaTeX math formula rendering shipped** ([`scripts/latex_render.py`](../skills/ppt-master/scripts/latex_render.py)) — Strategist locks one of three policies (`mixed` / `render-all` / `text-only`) inside the Typography confirmation and writes an explicit `images/formula_manifest.json`; the renderer walks a codecogs → quicklatex → mathpad → wikimedia fallback chain and emits transparent PNGs that land in §VIII as `Acquire Via: formula` / `Status: Rendered` rows; formula-heavy decks (academic / engineering / educational) finally have a native rendering route. Formula selection is a Strategist decision — the renderer never scans source files for `$...$` markers---diff --git a/docs/zh/roadmap.md b/docs/zh/roadmap.mdindex 2606ddd0..1db23ec1 100644--- a/docs/zh/roadmap.md+++ b/docs/zh/roadmap.md@@ -41,16 +41,7 @@- **AI 图 `custom` 兜底出口** — `rendering` / `palette` / hero 构图三处允许声明 `custom` + 一段 `*_behavior` prose,替换原"找不到匹配就硬塞 vector-illustration / cool-corporate"的假兜底;端到端契约:[`image-renderings/_index.md`](../../skills/ppt-master/references/image-renderings/_index.md) §1.5 + [`image-palettes/_index.md`](../../skills/ppt-master/references/image-palettes/_index.md) §2 + Strategist h.5 hard-rule(每维 ≤1 custom,单候选可双 custom)+ spec_lock 字段 + Image_Generator Step 2 消费分支- **Template 架构三分类收口**([`docs/zh/templates-architecture.md`](./templates-architecture.md)) — brand / layout / deck 三独立目录 + 每类独立 schema + 段级合成 + git-style 冲突解决;SKILL.md Step 3 按 kind 分支处理,触发规则仍是「显式路径才触发」- **Pattern 填充 PPTX 安全网** — `svg_quality_checker.py` 现在对未标 `data-pptx-pattern` 的 `<pattern>` 元素发 warning(会静默回退 `ltUpDiag` 斜纹)、对超出 OOXML `ST_PresetPatternVal` 枚举的值发 error(schema 校验失败 PPT 无法打开);`shared-standards.md §7` 落地了完整 preset 清单和 `<rect fill="<bg>"/>` 子元素约定-------## 考虑中--已识别但还没排优先级、也没定时间窗口的方向 —— 在雷达上,不在时间表上。--### LaTeX 数学公式渲染--输入端已经接受 LaTeX 源文件([SKILL.md](../../skills/ppt-master/SKILL.md) Step 1、[faq.md](./faq.md)),但输出端没有专门的渲染路径 —— AI 生成 SVG 时数学符号目前只能落回裸 Unicode。公式密集型 deck(学术 / 工程 / 教学)当前没有原生公式渲染路径。+- **LaTeX 数学公式渲染上线**([`scripts/latex_render.py`](../../skills/ppt-master/scripts/latex_render.py)) — Strategist 在 Typography 确认中锁定 `mixed` / `render-all` / `text-only` 三档策略,显式写 `images/formula_manifest.json`;脚本走 codecogs → quicklatex → mathpad → wikimedia 四源 fallback chain,输出透明 PNG 进 §VIII 表的 `Acquire Via: formula` / `Status: Rendered` 行;公式密集型 deck(学术 / 工程 / 教学)首次拥有原生渲染路径,规则面禁止扫源文件 `$...$` 自动渲染(公式选取是 Strategist 决策)---diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.mdindex 72686449..0e4661ef 100644--- a/skills/ppt-master/SKILL.md+++ b/skills/ppt-master/SKILL.md@@ -52,6 +52,7 @@ description: >| `${SKILL_DIR}/scripts/source_to_md/web_to_md.py` | Web page to Markdown (supports WeChat via `curl_cffi`) || `${SKILL_DIR}/scripts/project_manager.py` | Project init / validate / manage || `${SKILL_DIR}/scripts/analyze_images.py` | Image analysis |+| `${SKILL_DIR}/scripts/latex_render.py` | LaTeX formula rendering (manifest-driven PNG assets) || `${SKILL_DIR}/scripts/image_gen.py` | AI image generation (multi-provider) || `${SKILL_DIR}/scripts/svg_quality_checker.py` | SVG quality check || `${SKILL_DIR}/scripts/total_md_split.py` | Speaker notes splitting |@@ -282,7 +283,7 @@ Read references/strategist.md4. Style objective5. Color scheme6. Icon usage approach-7. Typography plan+7. Typography plan, including formula rendering policy8. Image usage approach**Mandatory — split-mode note** (not a ninth confirmation): after listing the eight confirmation details, you MUST append exactly one short line (rendered in the user's language, prefixed with 💡) about generation mode. Pick the variant by qualitative read of Phase A signals — recommended page count, source-material bulk, whether `topic-research` ran with substantial web-fetch accumulation:@@ -294,7 +295,27 @@ Read references/strategist.mdThis line is required output every run — the user must always see the mode choice exists. Whether to act on it is the user's call.-If the user provided images, run analysis **before outputting the design spec**:+**Formula rendering policy lives inside item 7 (Typography plan)**:++| Policy | Behavior |+|---|---|+| `mixed` (default) | Strategist renders complex formula-worthy expressions as PNG assets; simple inline expressions remain editable text / Unicode |+| `render-all` | Strategist renders every formula-worthy expression as PNG assets |+| `text-only` | No formula rendering; formulas remain editable text / Unicode |++After the Eight Confirmations are approved and **before outputting `design_spec.md` / `spec_lock.md`**, if the confirmed formula policy is `mixed` or `render-all` and the content contains formula-worthy expressions, Strategist MUST:++1. Identify explicit LaTeX and any source expressions that should be faithfully structured as formulas.+2. Write `<project_path>/images/formula_manifest.json` with only the formulas selected for rendering.+3. Run:+ ```bash+ python3 ${SKILL_DIR}/scripts/latex_render.py <project_path>+ ```+4. Include the rendered formula PNGs as `Acquire Via: formula`, `Status: Rendered`, `Type: Latex Formula` rows in `design_spec.md §VIII Image Resource List`; also list them in `spec_lock.md images` with `| no-crop`.++The formula renderer uses a provider fallback chain by default: `codecogs,quicklatex,mathpad,wikimedia`. The first three are color-aware; Wikimedia is an availability fallback. Formula PNGs are transparent by default: manifest `background` is the temporary render matte and transparency-removal reference, not a retained final background unless `transparent: false` is set for that item. Do not scan `spec_lock.md` for `$...$` or `$$...$$`. Dollar-delimited math in source material is only a signal for Strategist; the renderer consumes the explicit manifest.++If the user provided images or formula PNGs were rendered, run analysis **before outputting the design spec**:```bashpython3 ${SKILL_DIR}/scripts/analyze_images.py <project_path>/images```@@ -319,9 +340,9 @@ python3 ${SKILL_DIR}/scripts/analyze_images.py <project_path>/images### Step 5: Image Acquisition Phase (Conditional)-🚧 **GATE**: Step 4 complete; Design Specification & Content Outline generated and user confirmed.+🚧 **GATE**: Step 4 complete; Design Specification & Content Outline generated and user confirmed. Any formula rows already have `Acquire Via: formula` and `Status: Rendered`.-> **Trigger**: At least one row in the resource list has `Acquire Via: ai` and/or `Acquire Via: web`. If every row is `user` or `placeholder`, skip to Step 6.+> **Trigger**: At least one row in the resource list has `Acquire Via: ai` and/or `Acquire Via: web`. If every row is `user`, `formula`, or `placeholder`, skip to Step 6.**Always load the common framework**:diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.mdindex 2253f9a7..7dd512cd 100644--- a/skills/ppt-master/references/executor-base.md+++ b/skills/ppt-master/references/executor-base.md@@ -98,6 +98,7 @@ Before the first SVG page, output a confirmation listing: canvas dimensions, bod- Font family from `typography`: use role override (`title_family` / `body_family` / `emphasis_family` / `code_family`) if declared, else fall back to `font_family`- Font sizes follow a **ramp anchored on `typography.body`**, not a closed menu. Use the declared slots when they fit. Intermediate sizes (e.g., 40px hero number, 13px annotation) are allowed if the ratio to `body` falls within the role's band (see `design_spec.md §IV ramp table`). Sizes outside every band require extending the lock first.- Images MUST reference files listed under `images`; no invented filenames+- Formula PNGs are images with `Acquire Via: formula` / `Status: Rendered`; place them only from the listed file path and never recreate the formula as text.If a page needs a value not in `spec_lock.md`, surface it — do not silently invent one.@@ -306,6 +307,7 @@ Handle images by their status in the Design Spec's Image Resource List. Status e| **Existing** | User-provided | Reference images directly from `../images/` directory || **Generated** | Generated by Image_Generator | Reference images directly from `../images/` directory || **Sourced** | Web-acquired by Image_Searcher | Reference from `../images/`. **Read [`image_sources.json`](image-searcher.md) to decide attribution** — see §6.1 below. |+| **Rendered** | Deterministic formula PNG | Reference from `../images/`; use `preserveAspectRatio="xMidYMid meet"` || **Needs-Manual** | Acquisition failed and file is absent | Use dashed border placeholder unless the expected file exists || **Placeholder** | Not yet prepared | Use dashed border placeholder |@@ -315,6 +317,8 @@ Handle images by their status in the Design Spec's Image Resource List. Status e**`no-crop` images**: when a `spec_lock.md images` entry ends with ` | no-crop`, size the container to the image's native ratio (from `analyze_images.py` or file dims) and use `preserveAspectRatio="xMidYMid meet"`. Untagged entries are croppable — default to `slice`.+**Formula images**: rows with `Acquire Via: formula` or `Type: Latex Formula` MUST be treated as no-crop even if a legacy `spec_lock.md` forgot the flag. Use the dimensions from `design_spec.md §VIII`, `image_analysis.csv`, or `images/formula_manifest.json`; do not normalize all formulas to one height unless the spec explicitly states that layout choice.+### 6.1 Inline Attribution for Sourced Images (web path)Whenever the slide uses an image with `Status: Sourced`, look up the corresponding entry in `project/images/image_sources.json` and act on `license_tier`:@@ -336,7 +340,7 @@ Use `attribution_text` from the manifest entry as the **starting point**, then c## 7. Font Usage-Source of truth: `spec_lock.md typography`. Use `font_family` as default; override per role with `title_family` / `body_family` / `emphasis_family` / `code_family` if declared.+Source of truth: `spec_lock.md typography`. Use `font_family` as default; override per role with `title_family` / `body_family` / `emphasis_family` / `code_family` if declared. LaTeX formulas that Strategist rendered are PNG images, not a `code_family` text role.If `spec_lock.md` is absent, consult [`strategist.md`](strategist.md) §g — do not invent a stack.diff --git a/skills/ppt-master/references/image-base.md b/skills/ppt-master/references/image-base.mdindex 74534b53..7ee574f8 100644--- a/skills/ppt-master/references/image-base.md+++ b/skills/ppt-master/references/image-base.md@@ -8,7 +8,7 @@ Shared baseline for both acquisition paths. Path-specific behavior lives in the## 1. Trigger Condition-Active when at least one resource list row has `Acquire Via: ai` or `Acquire Via: web`. Rows with `user` / `placeholder` are skipped.+Active when at least one resource list row has `Acquire Via: ai` or `Acquire Via: web`. Rows with `user` / `formula` / `placeholder` are skipped.| Mode | Trigger ||---|---|@@ -25,6 +25,7 @@ Defined in `design_spec.md §VIII`. Status enum: see [`svg-image-embedding.md`](|---|---|---|---|---|---|---|| cover.png | 1280x720 | Cover background | Background | `ai` | Pending | Modern tech abstract, deep blue gradient #0A2540 || team.jpg | 800x600 | Team photo | Photography | `web` | Pending | Diverse engineering team in modern office |+| formula_001.png | 736x168 | Block equation on P03 | Latex Formula | `formula` | Rendered | `E = mc^2` |**Required per non-skipped row**: `Acquire Via`, `Status`, `Reference`.@@ -39,6 +40,7 @@ For each row with `Status: Pending`:| `ai` | [`image-generator.md`](./image-generator.md) | `image_gen.py` | `Generated` || `web` | [`image-searcher.md`](./image-searcher.md) | `image_search.py` | `Sourced` || `user` | — | — | (already `Existing`) |+| `formula` | — | — | (already `Rendered`) || `placeholder` | — | — | (already `Placeholder`) |> Lazy load: an all-`web` deck never reads `image-generator.md`, and vice versa.diff --git a/skills/ppt-master/references/strategist.md b/skills/ppt-master/references/strategist.mdindex 8ee66868..99d4d1af 100644--- a/skills/ppt-master/references/strategist.md+++ b/skills/ppt-master/references/strategist.md@@ -225,6 +225,55 @@ Baseline choice follows **content density**, not style. Common: `18px` (dense) /> Two baseline columns are illustrative only — for any other baseline (16/20/22/28/32…), multiply the row's ratio. Checker reads live `body` from `spec_lock.md`. Executor may pick any px within a role's band without pre-declaring; values outside **every** band require lock extension first.+#### Formula Rendering Policy++Formula rendering is part of Typography confirmation. Recommend one policy and let the user confirm or override it inside item g.++| Policy | Behavior | Use |+|---|---|---|+| `mixed` (default) | Render complex formula-worthy expressions to PNG; keep simple inline math as editable text / Unicode | Most academic, engineering, educational, and technical decks |+| `render-all` | Render every formula-worthy expression to PNG | Formula-heavy teaching / research decks where visual consistency matters more than editability |+| `text-only` | Do not render formulas; keep expressions as editable text / Unicode | Business decks, light technical briefs, or user preference for editability |++**Hard rule**: `$...$` / `$$...$$` in source material are input signals only. Do not scan output files for dollar-delimited formulas. After confirmation, Strategist decides which source expressions become formula assets and writes them explicitly to `images/formula_manifest.json`.++**Formula-worthy expressions**:++| Render as PNG | Keep as text |+|---|---|+| Fractions, radicals, integrals, sums, limits, matrices, multiline derivations, complex super/subscripts | `O(n log n)`, `x = 3`, single Greek letters, short inline variables, simple percentages / KPIs |++**Forbidden — invented math**: formula assets must faithfully structure source content. Do not create a new equation just to make a slide look more academic.++**Manifest step**: After the Eight Confirmations and before writing `design_spec.md`, if policy is `mixed` or `render-all` and formulas are selected:++```bash+mkdir -p <project_path>/images+python3 skills/ppt-master/scripts/latex_render.py <project_path>+```++Write the manifest first at `<project_path>/images/formula_manifest.json`. Use this shape:++```json+{+ "providers": ["codecogs", "quicklatex", "mathpad", "wikimedia"],+ "items": [+ {+ "id": "formula_001",+ "latex": "E = mc^2",+ "display": "block",+ "color": "#1D1D1F",+ "background": "#FFFFFF",+ "transparent": true,+ "dpi": 400,+ "filename": "formula_001.png"+ }+ ]+}+```++The script renders PNGs into `images/`, trying `codecogs`, `quicklatex`, `mathpad`, then `wikimedia` unless the manifest overrides `providers`. `codecogs`, `quicklatex`, and `mathpad` preserve requested formula color; `wikimedia` is an availability fallback and may require visual checking on dark themes. Formula PNGs are transparent by default: use `background` as the temporary render matte and local background-removal reference. Set `transparent: false` only when the final formula must keep an opaque background. It writes `pixel_width`, `pixel_height`, `ratio`, `file`, `provider`, and `status` back into the manifest. Run `analyze_images.py <project_path>/images` after formula rendering so the formula PNGs are included in the same inventory pass as user images.+### h. Image Usage Confirmation| Option | Approach | Suitable Scenarios |@@ -428,14 +477,17 @@ After the user picks a candidate, scan the outline and surface any pages where t| Layout suggestion | e.g., `Wide landscape (suitable for full-screen/illustration)` || **Layout pattern** | **MANDATORY** — one or more `#<id> <name>` joined by ` + ` from `image-layout-patterns.md`. Combine a Primary id with optional Modifier ids when the page needs it (e.g. `#48 side-by-side comparison + #21 rounded rectangle crop + #29 two-stop scrim`). A single Primary is fine when the page calls for it. See the GATE earlier in this section. Empty cells or invented ids are invalid. || Purpose | e.g., `Cover background` |-| **Acquire Via** | `ai` / `web` / `user` / `placeholder` — drives Step 5 dispatch |-| Status | Initial status must be `Pending`, `Existing`, or `Placeholder`; see [`svg-image-embedding.md`](svg-image-embedding.md) for the full status enum |+| Type | Free-form category tag — `Background`, `Photography`, `Illustration`, `Diagram`, `Portrait`, `Latex Formula`, etc. Required for formula rows (`Latex Formula`). |+| **Acquire Via** | `ai` / `web` / `user` / `formula` / `placeholder` — only `ai` and `web` drive Step 5 dispatch |+| Status | Initial status must be `Pending`, `Existing`, `Rendered`, or `Placeholder`; see [`svg-image-embedding.md`](svg-image-embedding.md) for the full status enum || **Reference** | Free-form **intent description** (NOT a search query); feeds Image_Generator (ai) or Image_Searcher (web) || `text_policy` (optional, `ai` rows only) | `none` (no text in image) or `embedded` (text is part of the artwork). Leave blank when Image_Generator should decide per row. Long body / data / lists stay in SVG. || `page_role` (optional, `ai` rows only) | `local` (image is a region block on an SVG page) or `hero_page` (image is the page's main voice). Leave blank when Image_Generator should decide per row. |**No-crop flag (exception only)**: most images are croppable — Executor defaults to `preserveAspectRatio="xMidYMid slice"`. When an image must NOT lose pixels (data screenshots, charts, certificates, contracts, dense diagrams), append `no-crop` to its `spec_lock.md images` entry. Executor will then size the container to the native ratio and use `meet`. Don't tag the rest.+**Formula rows**: rendered LaTeX PNGs are image rows with `Acquire Via: formula`, `Status: Rendered`, and `Type: Latex Formula`. Always append `no-crop` in `spec_lock.md images`. They are not AI images and never go through Step 5.+**Reference field**: Write visual intent, not provider mechanics.| ✅ Intent description | ❌ Avoid |@@ -450,6 +502,7 @@ After the user picks a candidate, scan the outline and surface any pages where t|---|---|| `ai` | **Subject + intent + composition** only. Do NOT repeat style words ("flat design", "modern", "vector") or HEX values — both are already locked deck-wide by h.5 (rendering + palette) and `design_spec §III` (colors). Image_Generator's prompt assembler injects them automatically. || `web` | Concrete subject/place/object first, then 1-3 quality descriptors |+| `formula` | Original LaTeX plus short placement intent, e.g. `formula_001: block energy-mass equation for P03` |**Allowed web quality descriptors**:@@ -471,7 +524,7 @@ After the user picks a candidate, scan the outline and surface any pages where t🚧 **GATE — before writing §VIII Image Resource List**: when image approach is B/C/D/E (anything other than A "no images"), this is a three-layer hard requirement, not a suggestion:1. **Read** — `read_file references/image-layout-patterns.md`. The file enumerates 72 numbered techniques split into **Part 1 — Primary Structures** (#1–#19 container layouts, #38–#46 image-as-canvas + native overlay, #47–#56 multi-image) and **Part 2 — Modifier Layers** (#20–#26 non-rectangular crops, #27–#37 overlays & masks, #57–#61 texture, #62–#72 special). The four `Image narrative intent` values below cover only broad categories.-2. **Produce** — every row in §VIII Image Resource List MUST fill the `Layout pattern` column with one or more `#<id> <name>` joined by ` + ` drawn verbatim from this file (Primary + optional Modifiers). Rows with empty `Layout pattern` or with an id that does not exist in the file are invalid.+2. **Produce** — every non-formula row in §VIII Image Resource List MUST fill the `Layout pattern` column with one or more `#<id> <name>` joined by ` + ` drawn verbatim from this file (Primary + optional Modifiers). Rows with empty cells, paraphrased names, or invented ids are invalid. Formula rows are the only exception; use `formula-inline` or `formula-block`.3. **Image-as-canvas coverage** — for any deck with ≥4 image-bearing pages, at least one page MUST use a `#38–#46` pattern (image-as-canvas + native overlay) unless every image is a pure cover / chapter divider / atmosphere backdrop. This family is the most-skipped one and is usually the right answer for content-rich pages with photographs. If the deck legitimately has no opportunity for it, state the reason in §VIII directly under the table.**Skip-detection signal for self-audit**: if you notice that every page's `Layout pattern` column resolves to #2/#3 (left-third or right-third), #5/#6 (top-bottom band), or generic side-by-side, you have not actually consulted the file — re-read and reconsider. The default left/right and top/bottom split bias is the failure mode this gate exists to break.diff --git a/skills/ppt-master/references/svg-image-embedding.md b/skills/ppt-master/references/svg-image-embedding.mdindex ea5344b0..9d471e62 100644--- a/skills/ppt-master/references/svg-image-embedding.md+++ b/skills/ppt-master/references/svg-image-embedding.md@@ -16,6 +16,7 @@ Defined in the Design Specification & Content Outline; each image carries an `Ac| cover_bg.png | 1280x720 | Cover background | Background | ai | Pending | Modern tech abstract, deep blue gradient || team.jpg | 800x600 | Team photo | Photography | web | Pending | Diverse engineering team in modern office || product.png | 600x400 | Page 3 product photo | Photography | user | Existing | - |+| formula_001.png | 736x168 | Page 3 block equation | Latex Formula | formula | Rendered | `E = mc^2` || chart.png | 600x400 | Page 5 placeholder | Illustration | placeholder | Placeholder | Team collaboration scene to be added later |```@@ -26,6 +27,7 @@ Defined in the Design Specification & Content Outline; each image carries an `Ac| **Pending** | Acquisition needed (`Acquire Via: ai` or `web`); not yet attempted | Image Acquisition Phase (Step 5) consumes this; must not remain after Step 5 || **Generated** | AI-generated file exists at expected path | Reference from `../images/`; no on-slide credit needed || **Sourced** | Web-sourced file exists at expected path | Reference from `../images/`; check `image_sources.json` for `license_tier` — if `attribution-required`, render an inline credit element on the slide (see [executor-base.md §6](./executor-base.md) and [image-searcher.md §7](./image-searcher.md) for the visual spec) |+| **Rendered** | Deterministic formula PNG exists at expected path (`Acquire Via: formula`) | Reference from `../images/`; use `preserveAspectRatio="xMidYMid meet"` and do not crop || **Needs-Manual** | Acquisition attempted once + one retry, failed | Dashed placeholder unless user has manually supplied the file || **Existing** | User already has image (`Acquire Via: user`) | Place in `images/`, reference with `<image>` || **Placeholder** | Intentionally not prepared yet (`Acquire Via: placeholder`) | Dashed border placeholder; replace later |@@ -39,11 +41,12 @@ Defined in the Design Specification & Content Outline; each image carries an `Ac2. Image Acquisition (Step 5):- Pending + ai → Image_Generator runs image_gen.py → Generated- Pending + web → Image_Searcher runs image_search.py → Sourced- - user / placeholder rows are skipped+ - formula / user / placeholder rows are skipped3. Executor generates SVGs (svg_output/)├── Existing / Generated → <image href="../images/xxx.png" .../>├── Sourced + license_tier=no-attribution → <image href=...> only├── Sourced + license_tier=attribution-required → <image href=...> + small <text> credit element on the slide+ ├── Rendered formula → <image href="../images/formula_001.png" preserveAspectRatio="xMidYMid meet" .../>└── Placeholder / Needs-Manual without file → Dashed border + description text4. Preview: python3 -m http.server -d <project_path> 8000 → /svg_output/<filename>.svg5. Post-processing & Export → follow shared-standards.md §5diff --git a/skills/ppt-master/scripts/README.md b/skills/ppt-master/scripts/README.mdindex a7f260b1..d20b9890 100644--- a/skills/ppt-master/scripts/README.md+++ b/skills/ppt-master/scripts/README.md@@ -44,7 +44,7 @@ python3 scripts/update_repo.py| Project management | `project_manager.py`, `batch_validate.py`, `generate_examples_index.py`, `error_helper.py`, `pptx_template_import.py` | [docs/project.md](./docs/project.md) || SVG pipeline | `finalize_svg.py`, `svg_to_pptx.py`, `total_md_split.py`, `svg_quality_checker.py`, `animation_config.py`, `notes_to_audio.py` | [docs/svg-pipeline.md](./docs/svg-pipeline.md) || Spec maintenance | `update_spec.py` | [docs/update_spec.md](./docs/update_spec.md) |-| Image tools | `image_gen.py`, `analyze_images.py`, `gemini_watermark_remover.py` | [docs/image.md](./docs/image.md) |+| Image tools | `image_gen.py`, `latex_render.py`, `analyze_images.py`, `gemini_watermark_remover.py` | [docs/image.md](./docs/image.md) || Repo maintenance | `update_repo.py` | README install/update section || Troubleshooting | validation, preview, export, dependency issues | [docs/troubleshooting.md](./docs/troubleshooting.md) |@@ -87,6 +87,8 @@ python3 scripts/svg_to_pptx.py <project_path>Image generation:```bash+python3 scripts/latex_render.py <project_path>+python3 scripts/latex_render.py <project_path> --providers codecogs,quicklatex,mathpad,wikimediapython3 scripts/image_gen.py "A modern futuristic workspace"python3 scripts/image_gen.py --list-backendspython3 scripts/analyze_images.py <project_path>/imagesdiff --git a/skills/ppt-master/scripts/docs/image.md b/skills/ppt-master/scripts/docs/image.mdindex 820cd59d..ecd3d3c1 100644--- a/skills/ppt-master/scripts/docs/image.md+++ b/skills/ppt-master/scripts/docs/image.md@@ -2,7 +2,39 @@> Architecture rationale (why provider-specific config keys instead of a generic `IMAGE_API_KEY`, why permissive license filter with strict-mode escape hatch, why external refs in dev but two divergent embedding strategies for delivery): see [docs/technical-design.md "Image Acquisition & Embedding"](../../../../docs/technical-design.md#image-acquisition--embedding).-Image tools cover prompt-based AI generation, web image search, image inspection, and Gemini watermark removal.+Image tools cover formula rendering, prompt-based AI generation, web image search, image inspection, and Gemini watermark removal.++## `latex_render.py`++Manifest-driven LaTeX formula renderer. Strategist writes `images/formula_manifest.json` after the Typography confirmation; this script renders only those declared formulas to transparent PNGs and writes dimensions back into the manifest.++```bash+python3 scripts/latex_render.py <project_path>+python3 scripts/latex_render.py <project_path> --dry-run+python3 scripts/latex_render.py <project_path> --providers codecogs,quicklatex,mathpad,wikimedia+```++Manifest shape:++```json+{+ "providers": ["codecogs", "quicklatex", "mathpad", "wikimedia"],+ "items": [+ {+ "id": "formula_001",+ "latex": "E = mc^2",+ "display": "block",+ "color": "#1D1D1F",+ "background": "#FFFFFF",+ "transparent": true,+ "dpi": 300,+ "filename": "formula_001.png"+ }+ ]+}+```++Output files land directly under `project/images/`. Formula filenames should use a shared `formula_` prefix, e.g. `formula_001.png`. The default provider chain is `codecogs,quicklatex,mathpad,wikimedia`; each provider is tried automatically until one succeeds, and the winning provider is recorded back into the manifest. `--providers` or manifest-level `providers` may override the order, but all four are available as no-key fallbacks. Formula PNGs are transparent by default. `background` is the temporary render matte and local background-removal reference; set `transparent: false` only when an opaque final formula asset is intentional. The script does not scan `spec_lock.md` or source documents for `$...$`; formula selection is a Strategist decision.## `image_gen.py`diff --git a/skills/ppt-master/scripts/latex_render.py b/skills/ppt-master/scripts/latex_render.pynew file mode 100644index 00000000..383afbcb--- /dev/null+++ b/skills/ppt-master/scripts/latex_render.py@@ -0,0 +1,614 @@+#!/usr/bin/env python3+"""+PPT Master - LaTeX Formula Renderer++Render Strategist-declared LaTeX formulas to transparent PNG assets.+The script reads an explicit manifest; it never scans spec_lock.md or source+content for dollar-delimited math.++Usage:+ python3 scripts/latex_render.py <project_path>+ python3 scripts/latex_render.py <project_path> --manifest images/formula_manifest.json+ python3 scripts/latex_render.py <project_path> --dry-run++Examples:+ python3 scripts/latex_render.py projects/demo_ppt169_20260523+ python3 scripts/latex_render.py projects/demo_ppt169_20260523 --providers codecogs,quicklatex,mathpad,wikimedia++Dependencies:+ Pillow (for measuring generated PNG dimensions)+ Network access to at least one configured rendering provider+"""++from __future__ import annotations++import argparse+import json+import re+import sys+import urllib.error+import urllib.parse+import urllib.request+from pathlib import Path+from typing import Any++try:+ from PIL import Image+except ImportError:+ Image = None+++DEFAULT_DPI = 300+DEFAULT_TRANSPARENT_TOLERANCE = 12+DEFAULT_MANIFEST = "images/formula_manifest.json"+DEFAULT_PROVIDERS = ["codecogs", "quicklatex", "mathpad", "wikimedia"]+CODECOGS_ENDPOINT = "https://latex.codecogs.com/png.image?"+WIKIMEDIA_CHECK_ENDPOINT = "https://wikimedia.org/api/rest_v1/media/math/check"+WIKIMEDIA_RENDER_ENDPOINT = "https://wikimedia.org/api/rest_v1/media/math/render/png"+QUICKLATEX_ENDPOINT = "https://quicklatex.com/latex3.f"+MATHPAD_ENDPOINT = "https://mathpad.ai/api/v1/latex2image"+VALID_FILENAME_RE = re.compile(r"^[A-Za-z0-9][A-Za-z0-9_.-]*\.png$")+PNG_SIGNATURE = b"\x89PNG\r\n\x1a\n"+++def _project_relative(path: Path, project_path: Path) -> str:+ """Return a POSIX-style path relative to the project."""+ return path.relative_to(project_path).as_posix()+++def _load_manifest(path: Path) -> dict[str, Any]:+ """Load a JSON formula manifest."""+ try:+ data = json.loads(path.read_text(encoding="utf-8"))+ except OSError as exc:+ raise RuntimeError(f"Cannot read manifest: {path} ({exc})") from exc+ except json.JSONDecodeError as exc:+ raise RuntimeError(f"Manifest is not valid JSON: {path} ({exc})") from exc++ if not isinstance(data, dict):+ raise RuntimeError("Manifest root must be a JSON object.")+ items = data.get("items")+ if not isinstance(items, list):+ raise RuntimeError("Manifest must contain an `items` array.")+ return data+++def _safe_filename(item: dict[str, Any], index: int) -> str:+ """Resolve and validate the output PNG filename for one formula."""+ filename = item.get("filename")+ if filename is None:+ formula_id = str(item.get("id") or f"formula_{index:03d}")+ filename = f"{formula_id}.png"+ filename = str(filename)+ if "/" in filename or "\\" in filename or not VALID_FILENAME_RE.match(filename):+ raise RuntimeError(+ f"Invalid formula filename `{filename}`. Use a simple PNG filename "+ "such as `formula_001.png`."+ )+ return filename+++def _normalize_hex_color(color: str | None, field_name: str) -> str | None:+ """Normalize an optional 6-digit HEX color."""+ if not color:+ return None+ value = color.strip()+ if value.startswith("#"):+ value = value[1:]+ if not re.fullmatch(r"[0-9A-Fa-f]{6}", value):+ raise RuntimeError(f"Formula {field_name} must be a 6-digit HEX value: {color}")+ return value.upper()+++def _hex_to_rgb(color: str) -> tuple[int, int, int]:+ """Convert a normalized HEX color to an RGB tuple."""+ return (int(color[0:2], 16), int(color[2:4], 16), int(color[4:6], 16))+++def _parse_bool(value: Any, default: bool) -> bool:+ """Parse a manifest boolean with a default."""+ if value is None:+ return default+ if isinstance(value, bool):+ return value+ if isinstance(value, str):+ normalized = value.strip().lower()+ if normalized in {"1", "true", "yes", "on"}:+ return True+ if normalized in {"0", "false", "no", "off"}:+ return False+ raise RuntimeError(f"Expected boolean value, got: {value!r}")+++def _normalize_tolerance(value: Any) -> int:+ """Normalize the background removal tolerance."""+ if value is None:+ return DEFAULT_TRANSPARENT_TOLERANCE+ tolerance = int(value)+ if tolerance < 0 or tolerance > 255:+ raise RuntimeError("transparent_tolerance must be between 0 and 255.")+ return tolerance+++def _parse_providers(value: str | list[str] | None) -> list[str]:+ """Parse and validate a provider chain."""+ if value is None:+ providers = DEFAULT_PROVIDERS+ elif isinstance(value, list):+ providers = value+ else:+ providers = [part.strip() for part in value.split(",") if part.strip()]++ valid = {"codecogs", "quicklatex", "mathpad", "wikimedia"}+ unknown = [provider for provider in providers if provider not in valid]+ if unknown:+ raise RuntimeError(+ f"Unknown formula provider(s): {', '.join(unknown)}. "+ f"Available: {', '.join(sorted(valid))}"+ )+ if not providers:+ raise RuntimeError("Provider chain must include at least one provider.")+ return providers+++def _request_bytes(req: urllib.request.Request, timeout: int = 30) -> tuple[bytes, str]:+ """Fetch bytes and return the response content type."""+ try:+ with urllib.request.urlopen(req, timeout=timeout) as resp:+ return resp.read(), resp.headers.get("Content-Type", "")+ except (urllib.error.URLError, TimeoutError) as exc:+ raise RuntimeError(str(exc)) from exc+++def _assert_png(data: bytes, provider: str, content_type: str) -> bytes:+ """Validate PNG response bytes."""+ if not data.startswith(PNG_SIGNATURE):+ raise RuntimeError(+ f"{provider} did not return PNG data (Content-Type: {content_type})"+ )+ return data+++def _build_codecogs_payload(latex: str, dpi: int, color: str | None) -> str:+ """Build a CodeCogs LaTeX payload."""+ # CodeCogs documents PNG DPI in the 50-300 range.+ safe_dpi = min(max(dpi, 50), 300)+ parts = [rf"\dpi{{{safe_dpi}}}"]+ if color:+ parts.append(rf"\fg{{{color}}}")+ parts.append(latex)+ return " ".join(parts)+++def _render_codecogs(+ latex: str,+ dpi: int,+ color: str | None,+ background: str | None,+ display: str,+) -> bytes:+ """Render one formula through CodeCogs."""+ payload = _build_codecogs_payload(latex, dpi, color)+ url = CODECOGS_ENDPOINT + urllib.parse.quote(payload)+ req = urllib.request.Request(url, headers={"User-Agent": "PPT-Master/1.0"})+ data, content_type = _request_bytes(req)+ return _assert_png(data, "codecogs", content_type)+++def _render_wikimedia(+ latex: str,+ dpi: int,+ color: str | None,+ background: str | None,+ display: str,+) -> bytes:+ """Render one formula through Wikimedia Mathoid."""+ formula_type = "inline-tex" if display == "inline" else "tex"+ payload = urllib.parse.urlencode({"q": latex}).encode("utf-8")+ check_req = urllib.request.Request(+ f"{WIKIMEDIA_CHECK_ENDPOINT}/{formula_type}",+ data=payload,+ headers={+ "Content-Type": "application/x-www-form-urlencoded",+ "User-Agent": "PPT-Master/1.0",+ },+ method="POST",+ )+ try:+ with urllib.request.urlopen(check_req, timeout=30) as resp:+ resp.read()+ resource = resp.headers.get("x-resource-location")+ except (urllib.error.URLError, TimeoutError) as exc:+ raise RuntimeError(str(exc)) from exc++ if not resource:+ raise RuntimeError("missing x-resource-location header")++ render_req = urllib.request.Request(+ f"{WIKIMEDIA_RENDER_ENDPOINT}/{resource}",+ headers={"User-Agent": "PPT-Master/1.0"},+ )+ data, content_type = _request_bytes(render_req)+ return _assert_png(data, "wikimedia", content_type)+++def _render_quicklatex(+ latex: str,+ dpi: int,+ color: str | None,+ background: str | None,+ display: str,+) -> bytes:+ """Render one formula through QuickLaTeX."""+ wrapped = f"${latex}$" if display == "inline" else f"$${latex}$$"+ # QuickLaTeX uses CSS font size rather than DPI. Keep a conservative fixed+ # size; downstream placement uses measured dimensions from the PNG.+ params = {+ "formula": wrapped,+ "fsize": "24px",+ "fcolor": color or "000000",+ "mode": "0",+ "out": "1",+ "remhost": "quicklatex.com",+ }+ req = urllib.request.Request(+ QUICKLATEX_ENDPOINT,+ data=urllib.parse.urlencode(params).encode("utf-8"),+ headers={+ "Content-Type": "application/x-www-form-urlencoded",+ "User-Agent": "PPT-Master/1.0",+ },+ method="POST",+ )+ data, _ = _request_bytes(req)+ text = data.decode("utf-8", errors="replace").strip()+ lines = text.splitlines()+ if not lines or lines[0].strip() != "0":+ raise RuntimeError(text or "QuickLaTeX returned an empty response")+ if len(lines) < 2:+ raise RuntimeError(f"QuickLaTeX response missing image URL: {text}")+ image_url = lines[1].split()[0]+ image_req = urllib.request.Request(+ image_url,+ headers={"User-Agent": "PPT-Master/1.0"},+ )+ image_data, content_type = _request_bytes(image_req)+ return _assert_png(image_data, "quicklatex", content_type)+++def _render_mathpad(+ latex: str,+ dpi: int,+ color: str | None,+ background: str | None,+ display: str,+) -> bytes:+ """Render one formula through MathPad's public LaTeX image endpoint."""+ wrapped = f"${latex}$" if display == "inline" else f"$${latex}$$"+ scale = "4" if dpi >= 300 else "2"+ params = {+ "latex": wrapped,+ "format": "png",+ "scale": scale,+ "color": f"#{color or '000000'}",+ "bg": f"#{background or 'FFFFFF'}",+ }+ url = MATHPAD_ENDPOINT + "?" + urllib.parse.urlencode(params)+ req = urllib.request.Request(url, headers={"User-Agent": "PPT-Master/1.0"})+ data, content_type = _request_bytes(req)+ return _assert_png(data, "mathpad", content_type)+++PROVIDER_RENDERERS = {+ "codecogs": _render_codecogs,+ "quicklatex": _render_quicklatex,+ "mathpad": _render_mathpad,+ "wikimedia": _render_wikimedia,+}+COLOR_AWARE_PROVIDERS = {"codecogs", "quicklatex", "mathpad"}+++def _render_with_providers(+ latex: str,+ output_path: Path,+ dpi: int,+ color: str | None,+ background: str | None,+ display: str,+ providers: list[str],+) -> tuple[str, list[str]]:+ """Try providers in order and write the first successful PNG."""+ errors: list[str] = []+ for provider in providers:+ try:+ data = PROVIDER_RENDERERS[provider](latex, dpi, color, background, display)+ output_path.write_bytes(data)+ return provider, errors+ except RuntimeError as exc:+ errors.append(f"{provider}: {exc}")+ raise RuntimeError("; ".join(errors))+++def _image_dimensions(path: Path) -> tuple[int, int]:+ """Read PNG dimensions."""+ if Image is None:+ raise RuntimeError(+ "Pillow is required to measure formula PNGs. Run: pip install Pillow"+ )+ with Image.open(path) as img:+ return img.size+++def _make_png_background_transparent(+ path: Path,+ *,+ color: str | None,+ background: str | None,+ tolerance: int,+) -> None:+ """Convert the rendered formula's matte background to alpha."""+ if Image is None:+ raise RuntimeError(+ "Pillow is required to post-process transparent formula PNGs. "+ "Run: pip install Pillow"+ )++ bg_rgb = _hex_to_rgb(background or "FFFFFF")+ fg_rgb = _hex_to_rgb(color or "000000")++ with Image.open(path) as img:+ rgba = img.convert("RGBA")++ alpha = rgba.getchannel("A")+ if alpha.getextrema()[0] < 255:+ if color:+ pixels = rgba.load()+ width, height = rgba.size+ for y in range(height):+ for x in range(width):+ _, _, _, a = pixels[x, y]+ if a:+ pixels[x, y] = (fg_rgb[0], fg_rgb[1], fg_rgb[2], a)+ rgba.save(path)+ return++ fg_bg_distance = max(abs(fg_rgb[i] - bg_rgb[i]) for i in range(3))+ pixels = rgba.load()+ width, height = rgba.size+ for y in range(height):+ for x in range(width):+ r, g, b, a = pixels[x, y]+ if a == 0:+ continue++ bg_distance = max(+ abs(r - bg_rgb[0]),+ abs(g - bg_rgb[1]),+ abs(b - bg_rgb[2]),+ )+ if bg_distance <= tolerance:+ pixels[x, y] = (fg_rgb[0], fg_rgb[1], fg_rgb[2], 0)+ continue++ if fg_bg_distance > tolerance:+ coverage = min(1.0, bg_distance / fg_bg_distance)+ new_alpha = max(1, min(255, round(a * coverage)))+ else:+ new_alpha = a+ pixels[x, y] = (fg_rgb[0], fg_rgb[1], fg_rgb[2], new_alpha)++ rgba.save(path)+++def _process_item(+ item: dict[str, Any],+ index: int,+ project_path: Path,+ output_dir: Path,+ default_dpi: int,+ providers: list[str],+ dry_run: bool,+) -> dict[str, Any]:+ """Render one manifest item and return its updated record."""+ latex = str(item.get("latex") or "").strip()+ if not latex:+ raise RuntimeError(f"Formula item #{index} is missing `latex`.")++ filename = _safe_filename(item, index)+ output_path = output_dir / filename+ dpi = int(item.get("dpi") or default_dpi)+ color = _normalize_hex_color(item.get("color"), "color")+ background = _normalize_hex_color(item.get("background"), "background")+ transparent = _parse_bool(item.get("transparent"), True)+ transparent_tolerance = _normalize_tolerance(item.get("transparent_tolerance"))+ display = str(item.get("display") or "block").strip().lower()+ if display not in {"inline", "block"}:+ raise RuntimeError(f"Formula item #{index} has invalid `display`: {display}")+ item_providers = _parse_providers(+ item.get("providers") or item.get("provider_chain") or providers+ )++ updated = dict(item)+ updated["filename"] = filename+ updated["file"] = _project_relative(output_path, project_path)+ updated["dpi"] = dpi+ updated["display"] = display+ updated["providers"] = item_providers+ updated["transparent"] = transparent+ if color:+ updated["color"] = f"#{color}"+ if background:+ updated["background"] = f"#{background}"+ if transparent:+ updated["transparent_tolerance"] = transparent_tolerance++ if dry_run:+ updated["status"] = item.get("status") or "Pending"+ return updated++ try:+ if not output_path.exists() or item.get("status") != "Rendered":+ provider_used, provider_errors = _render_with_providers(+ latex,+ output_path,+ dpi,+ color,+ background,+ display,+ item_providers,+ )+ updated["provider"] = provider_used+ if color and provider_used not in COLOR_AWARE_PROVIDERS:+ updated["color_warning"] = (+ f"Provider `{provider_used}` is an availability fallback and may "+ "not preserve the requested formula color."+ )+ if provider_errors:+ updated["provider_errors"] = provider_errors+ if transparent:+ _make_png_background_transparent(+ output_path,+ color=color,+ background=background,+ tolerance=transparent_tolerance,+ )+ width, height = _image_dimensions(output_path)+ updated["pixel_width"] = width+ updated["pixel_height"] = height+ updated["ratio"] = round(width / height, 4) if height else None+ updated["status"] = "Rendered"+ updated.pop("error", None)+ except RuntimeError as exc:+ updated["status"] = "Failed"+ updated["error"] = str(exc)++ return updated+++def render_manifest(+ project_path: Path,+ manifest_path: Path,+ *,+ default_dpi: int = DEFAULT_DPI,+ providers: list[str] | None = None,+ dry_run: bool = False,+) -> int:+ """Render all formulas declared in a manifest."""+ manifest = _load_manifest(manifest_path)+ output_dir = project_path / "images"+ updated_items: list[dict[str, Any]] = []+ provider_chain = _parse_providers(providers or manifest.get("providers"))++ if not dry_run:+ output_dir.mkdir(parents=True, exist_ok=True)++ failures = 0+ for index, raw_item in enumerate(manifest["items"], 1):+ if not isinstance(raw_item, dict):+ raise RuntimeError(f"Formula item #{index} must be an object.")+ updated = _process_item(+ raw_item,+ index,+ project_path,+ output_dir,+ default_dpi,+ provider_chain,+ dry_run,+ )+ updated_items.append(updated)+ status = updated.get("status")+ label = updated.get("id") or updated.get("filename")+ print(f"{status}: {label} -> {updated.get('file')}", file=sys.stderr)+ if status == "Failed":+ failures += 1+ print(f" {updated.get('error')}", file=sys.stderr)++ if dry_run:+ print(f"Dry run: {len(updated_items)} formula item(s) parsed.", file=sys.stderr)+ return 0++ manifest["items"] = updated_items+ manifest["renderer"] = {+ "providers": provider_chain,+ "default_dpi": default_dpi,+ "output_dir": _project_relative(output_dir, project_path),+ }+ manifest_path.write_text(+ json.dumps(manifest, indent=2, ensure_ascii=False) + "\n",+ encoding="utf-8",+ )++ if failures:+ print(f"Formula rendering completed with {failures} failure(s).", file=sys.stderr)+ return 2+ print(f"Formula rendering complete: {len(updated_items)} item(s).", file=sys.stderr)+ return 0+++def build_parser() -> argparse.ArgumentParser:+ """Build the CLI parser."""+ parser = argparse.ArgumentParser(+ description="Render Strategist-declared LaTeX formulas to PNG assets.",+ formatter_class=argparse.RawDescriptionHelpFormatter,+ )+ parser.add_argument("project_path", type=Path, help="Project directory.")+ parser.add_argument(+ "--manifest",+ type=Path,+ default=None,+ help=f"Formula manifest path. Default: <project>/{DEFAULT_MANIFEST}",+ )+ parser.add_argument(+ "--dpi",+ type=int,+ default=DEFAULT_DPI,+ help=f"Default render DPI when an item omits `dpi` (default: {DEFAULT_DPI}).",+ )+ parser.add_argument(+ "--providers",+ default=None,+ help=(+ "Comma-separated provider fallback chain "+ f"(default: {','.join(DEFAULT_PROVIDERS)})."+ ),+ )+ parser.add_argument(+ "--dry-run",+ action="store_true",+ help="Validate and list formula items without rendering or writing files.",+ )+ return parser+++def main(argv: list[str] | None = None) -> int:+ """Run the CLI entry point."""+ parser = build_parser()+ args = parser.parse_args(argv)++ project_path = args.project_path.resolve()+ if not project_path.is_dir():+ print(f"Error: project directory not found: {project_path}", file=sys.stderr)+ return 1++ manifest_path = args.manifest+ if manifest_path is None:+ manifest_path = project_path / DEFAULT_MANIFEST+ elif not manifest_path.is_absolute():+ manifest_path = project_path / manifest_path+ manifest_path = manifest_path.resolve()++ try:+ return render_manifest(+ project_path,+ manifest_path,+ default_dpi=args.dpi,+ providers=_parse_providers(args.providers) if args.providers else None,+ dry_run=args.dry_run,+ )+ except RuntimeError as exc:+ print(f"Error: {exc}", file=sys.stderr)+ return 1+++if __name__ == "__main__":+ raise SystemExit(main())diff --git a/skills/ppt-master/templates/design_spec_reference.md b/skills/ppt-master/templates/design_spec_reference.mdindex 9a513cf7..d97844cd 100644--- a/skills/ppt-master/templates/design_spec_reference.md+++ b/skills/ppt-master/templates/design_spec_reference.md@@ -242,18 +242,37 @@ Catalog read: 71 templates## VIII. Image Resource List (if needed)-| Filename | Dimensions | Ratio | Purpose | Layout pattern | Acquire Via | Status | Reference | text_policy | page_role |-| -------- | --------- | ----- | ------- | -------------- | ----------- | ------ | --------- | ----------- | --------- |-| cover_bg.png | {canvas_info['dimensions']} | [ratio] | Cover background | #1 full-bleed background with floating title + #29 two-stop scrim | ai | Pending | [subject + intent + composition, no style/HEX] | | |+| Filename | Dimensions | Ratio | Purpose | Type | Layout pattern | Acquire Via | Status | Reference | text_policy | page_role |+| -------- | --------- | ----- | ------- | ---- | -------------- | ----------- | ------ | --------- | ----------- | --------- |+| cover_bg.png | {canvas_info['dimensions']} | [ratio] | Cover background | Background | #1 full-bleed background with floating title + #29 two-stop scrim | ai | Pending | [subject + intent + composition, no style/HEX] | | |+| formula_001.png | [actual dimensions from formula manifest / image_analysis] | [ratio] | Block equation on P03 | Latex Formula | formula-block | formula | Rendered | `E = mc^2` — energy-mass equation | | |-> **Layout pattern column is MANDATORY** — value is one or more `#<id> <name>` joined by ` + ` drawn verbatim from [`references/image-layout-patterns.md`](../references/image-layout-patterns.md) (Primary + optional Modifiers). Empty cells, paraphrased names, or invented ids invalidate the row. See `strategist.md §h` GATE for the three-layer requirement (read → produce → image-as-canvas coverage).+> **Layout pattern column is MANDATORY** — for non-formula rows, value is one or more `#<id> <name>` joined by ` + ` drawn verbatim from [`references/image-layout-patterns.md`](../references/image-layout-patterns.md) (Primary + optional Modifiers). Empty cells, paraphrased names, or invented ids invalidate the row. Formula rows are the only exception; use `formula-inline` or `formula-block`. See `strategist.md §h` GATE for the three-layer requirement (read → produce → image-as-canvas coverage).++**Type** (free-form category tag; common values):++- `Background` — cover / chapter / full-bleed atmosphere+- `Photography` — real-world photo+- `Illustration` — vector / flat / painterly art+- `Diagram` — schematic / architecture / flowchart+- `Portrait` — single-subject person+- `Latex Formula` — formula PNG rendered by `latex_render.py`**Status**:- **Pending** — needs AI generation or web sourcing+- **Rendered** — deterministic formula asset already exists under `images/`- **Existing** — user-supplied, place in `images/`- **Placeholder** — not yet processed, use dashed border in SVG+**Acquire Via**:++- `ai` — Step 5 Image_Generator+- `web` — Step 5 Image_Searcher+- `formula` — already rendered by `latex_render.py` before this spec was written+- `user` — user-supplied+- `placeholder` — intentionally deferred+**text_policy** (`ai` rows only; AI judges per row, no global default bias):- `none` — image carries no text; SVG overlays all labelsdiff --git a/skills/ppt-master/templates/spec_lock_reference.md b/skills/ppt-master/templates/spec_lock_reference.mdindex d8170149..2c4f632d 100644--- a/skills/ppt-master/templates/spec_lock_reference.md+++ b/skills/ppt-master/templates/spec_lock_reference.md@@ -50,6 +50,7 @@> **All five family lines are listed explicitly** so Strategist considers every role — `code_family` and `emphasis_family` are easily forgotten. In a real `spec_lock.md`:> - Keep any `*_family` whose role genuinely differs from `font_family`.> - **Omit** any `*_family` equal to `font_family` — Executor falls back to `font_family` for missing roles, so writing it twice is noise. (Exception: keep `code_family` even when equal — monospace is conceptually distinct.)+> - `code_family` applies to code snippets only. LaTeX formulas rendered by `latex_render.py` are PNG image assets and must be listed under `images`.>> `font_family` is the default fallback. Every declared family is a CSS font-stack string.>@@ -82,8 +83,9 @@## images- cover_bg: images/cover_bg.jpg- q3_revenue_chart: images/q3_revenue.png | no-crop+- formula_001: images/formula_001.png | no-crop-> One entry per image file used. Append ` | no-crop` only for images that must not lose pixels (data screenshots, charts, certificates) — Executor will size the container to native ratio and use `preserveAspectRatio="xMidYMid meet"`. Untagged entries default to croppable (`slice`). Remove the section entirely if no images.+> One entry per image file used. Append ` | no-crop` only for images that must not lose pixels (data screenshots, charts, certificates, rendered LaTeX formulas) — Executor will size the container to native ratio and use `preserveAspectRatio="xMidYMid meet"`. Untagged entries default to croppable (`slice`). Remove the section entirely if no images.## page_rhythm- P01: anchor