/spark-to-paper:ts-paper-latexfrom spark-to-paper
Assembles drafted LaTeX sections, bibliography, and blueprint into a compilable paper using a template, then compiles to PDF. Handles template-driven post-processing and error-fix loops. Use for final PDF generation.
Ships in spark-to-paper. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Turn the finished sections/<id>.tex + refs.bib + blueprint.json into a compiled
main.pdf. This stage never authors or alters content — no renaming methods/datasets, no
filling result numbers (proposal = blank cells stay blank). It is format + assembly + compile only.
Template-driven: assemble_paper.py reads template.json from the workdir and threads it
through everything — section order + headings, table/figure caption position, keyword cap,
whether to merge \cite (numeric templates only), and the preamble (the template's own
main.tex.tmpl, filled by safe @@token@@ substitution) + which .sty/.cls + assets to copy.
The default template is ts_iieta (two-column IIETA); neurips (single-column author-year) is also
bundled and compiles through the same script — nothing here is hardcoded to TS. If no template.json
is in the workdir it falls back to bundled ts_iieta (backward-compatible).
🔴 HARD RULE — NEVER fabricate a venue template. A template's style files (
.sty/.cls) must come from exactly ONE of: (a) a user-provided template (the user drops atemplates/<name>/dir or points at the official files), or (b) the venue's OFFICIAL style files, fetched verbatim from the official source (the conference/journal style-file URL, e.g. NeurIPSmedia.neurips.cc/.../neurips_<year>.sty) and copied UNCHANGED. Do NOT hand-author, approximate, or "make it look like" a venue — a self-invented.stygets margins/fonts/notice/line-numbers wrong and is unusable for submission. If a requested venue has neither a user-provided nor an obtainable official template, STOP and ask the user for the official files — never fabricate one. ⚠️ The currently-bundledts_iietaandneuripsstyles are unofficial approximations ("official": falsein theirtemplate.json); treat them as demo-only and replace with the venue's official.sty/.cls(or a user-provided template) before any real submission.
assets/ts_iieta.sty — our own two-column IIETA style (masthead with logo + blue band, 10pt Times, ALL-CAPS numbered sections, Figure N./Table N. captions, numeric [n] cites with sort&compress).assets/iieta_logo.png — the masthead logo (compiles fine if absent via \IfFileExists).scripts/assemble_paper.py — the deterministic backbone.python scripts/assemble_paper.py <workdir>
The script: reads blueprint.json (title, keywords, abstract, section_order, optional authors/doi/dates/journal); for each sections/<id>.tex applies the post-processes and prepends the canonical ALL-CAPS heading; builds main.tex from the TS template; copies ts_iieta.sty + iieta_logo.png into the workdir; runs latexmk -pdf. It prints a JSON status {ok, compiled, exit, error_count, error_tail, sections, order, assets, template, workdir}.
table/table*.\cite runs into one (\cite{a} \cite{b} → \cite{a,b}) so they render as [1, 2] / [3-5] with the style's sort&compress.Introduction / Related Works / Methodology / Experimental Results / Discussion and Analysis / Conclusion, which the style renders as 1. INTRODUCTION …\subsection{3.1 Foo} → Foo), table-width safety net (wraps a bare \begin{tabular} in \adjustbox), single-paragraph abstract merge.\tsSetKeywords macro (empty → the line is omitted).ts_iieta.sty also loads inputenc[utf8] as a Unicode compile-net.compiled (PDF exists AND error_count == 0 — it already trusts the log, not the exit code) and a structured error_count. Success also requires main.bbl resolved (no [?] citations). Treat error_count > 0 as a red gate that blocks done.--backup on the FIRST attempt only so sections/ is snapshotted to sections.bak/ (rollback if a fix makes it worse) — do not re-pass --backup on later attempts or you overwrite the good baseline.compiled:false or error_count > 0, read error_tail, then edit the offending sections/*.tex with minimal, syntax-only fixes (close unbalanced $/environments, escape stray & % # _ in text, fix mispaired \begin/\end, 1-10→1--10). Never change content, math semantics, citations, labels, or -- placeholders.error_count goes UP, restore from sections.bak/ and report rather than thrash.File \figures/' not foundor a bad-bounding-box error is **not** a content bug — fix it by **re-running the figure stage** (regenerate the missing.pdf/.png`), never by editing section prose.logs/7_latex.io.md (INPUT: section files + refs.bib; DECISIONS: each compile error + the minimal fix; OUTPUT: main.pdf page count, error_count=0), and logs/index.md linking every stage's log.Figures are referenced extension-less — \includegraphics{figures/<label>} — and the figure stage
ships figures/<label>.pdf (editable vector) beside the kept figures/<label>.png. Both bundled .sty
already \RequirePackage{graphicx}, so under pdflatex/latexmk the .pdf is embedded (its extension is
preferred over .png) with no change to assemble_paper.py (it never parses \includegraphics or
figure extensions). The vector is pre-rendered by cairosvg (in ts-figure-optimize's hybrid export), so there is no
\includesvg/Inkscape/--shell-escape dependency. The run_gates.py all vector check confirms every
figure has its .pdf sibling — a raster-only figure is a red gate.
Authors/affiliation/email/DOI/dates default to clearly-marked placeholders ([AUTHORS TBD], 10.18280/ts.XXXXXX) for a proposal — that is correct; fill real values only if the user provides them in blueprint.json (authors, doi, dates, journal).
Report: page count, sections included, that captions are above tables, cites merged, keywords present, and that the citation linter (ts-paper-cite/scripts/citations_lint.py) passes with zero stubs/orphans.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (spark-to-paper-skills/spark-to-paper-skills) — no native marketplace selected
npx claudepluginhub p/spark-to-paper-skills-spark-to-paper14 skills in this plugin
/ts-figure-optimizeThe suite's SOLE figure vectorizer: turn ONE raster scientific figure (a PNG/JPG, e.g. a gpt-image-2 schematic) into an editable, publication-ready figure via DrawAI's **key-free HYBRID** — local perception (SAM3 region detection + PaddleOCR + Box-IR layout, no account) then a deterministic hybrid build that keeps the approved render **pixel-exact** (a whole-canvas raster) and lays an **editable <text> overlay** on top (~0.91 SSIM), exported as a self-contained SVG + vector PDF + an editable PPTX. The render's full richness is preserved EXACTLY (it IS the approved image) while every label becomes editable. The original raster is always kept. Hybrid is the ONLY mode used: there is no Codex full-vector redraw (legacy/off — it needs an account, and a redraw of a dense figure loses fidelity) and no Claude-redraw fallback. If this runtime cannot be provisioned, the caller keeps the approved PNG as-is — never a lossy redraw. Independent of the paper pipeline — give it any figure image.
/ts-figure-svgPaperBanana+ — turn a paper's figure brief into a native, editable, publication-grade SVG. Stage 1 runs the OFFICIAL PaperBanana (dwzhu-pku/PaperBanana, pulled by `setup_paperbanana.py`, its own Retriever→Planner→Stylist→Visualizer→Critic pipeline) to produce candidate PNGs. Stage 2 is the "+": Claude LOOKS at the chosen PNG, extracts its DESIGN LANGUAGE (palette, type scale, spacing, idiom) into a style sheet, then redraws the figure FROM THE PAPER'S FACTS as real <rect>/<path>/<text> objects — never tracing pixels, never embedding the PNG. Stage 3 is a measured repair loop: `audit_svg.py` (stdlib, no renderer needed) catches overflow, text-on-text, icons cutting labels, stroke-scaled and canvas-clipped arrowheads, dangling connectors, sub-legible type, font-fallback glyphs, CSS-cascade colour traps and traced path-soup; ≥4 rounds, no upper bound while defects remain. Ends on a vector PDF verified on the real compiled page. Use when a figure must be editable and correct, not merely pretty.
/ts-idea2storyTurn a raw research idea into a compelling, well-grounded research STORY (an 8-field structured proposal) ready to feed the ts-paper pipeline. Claude does almost everything natively — idea packaging, recall reasoning over a knowledge graph, agentic external literature search (WebSearch/WebFetch), story generation, and a critique→refine→fusion loop; tiny scripts do only embeddings/recall math and the schema gate. Emits story.json + story_proposal.md + retrieved_papers.json (a citation seed the cite stage reuses, so paper-writing searches less). Use when the user has an idea (not yet a full proposal) and wants a paper-ready story.
/ts-kg-buildBuild a reusable research-PATTERN knowledge graph from a paper corpus, so ts-idea2story can recall prior problem→solution→story patterns. Claude does the reasoning (story-first pattern extraction, cluster naming + summaries); small scripts do the irreducible math (embeddings via a USER-SUPPLIED endpoint, clustering, graph assembly). Best-effort and honestly optional — without an embedding endpoint it degrades to a flat in-context "pattern shelf". Use to (re)build the KG for a domain, or skip it and let ts-idea2story rely on web search alone.
/ts-paperGenerate a complete, publication-format journal/conference paper (LaTeX → compiled PDF) from whatever the user drops — a one-line idea, a proposal, or a proposal WITH real results. It ROUTES the input (idea→idea2story; proposal→proposal mode; results-present→data-aware mode), then runs plan→cite→write→refine→review→figure→latex using Claude's native abilities (reasoning, WebSearch, vision, file I/O, running Python) instead of a heavyweight per-call pipeline. Template-agnostic (ts_iieta + neurips bundled). Use for "write the paper", "proposal to paper", "turn this idea/report into a paper". Integrity is absolute: in proposal mode never fabricate numbers; in data-aware mode every number must trace to the user's real data.
/ts-paper-citeStage 2 of the ts-paper suite. Build a complete, REAL refs.bib for a Traitement du Signal paper — using the user's provided references first and Claude's native WebSearch/WebFetch only for genuine gaps. Every entry must have full metadata (authors, year, venue, vol(issue):pages, DOI); never a title-only stub; reference count is driven by real evidence, not a quota. Use when assembling or fixing the bibliography of a TS paper, or whenever citations must be real and complete.
Other plugins' skills for the same job