Claude Code Skills · 论文 · 演讲与海报

paper-to-beamer

Generate LaTeX Beamer presentations from academic papers. Use this skill whenever the user wants to create a Beamer/LaTeX presentation, academic slides, seminar talk slides, or paper reading slides from a research paper. Also trigger when the user mentions: 论文汇报PPT, 论文报告幻灯片, paper presentation, beamer slides, 做一个论文的PPT, 论文解读演示文稿, conference talk slides, or any request to turn a paper into slides. This skill handles the full pipeline: reading the paper, extracting figures, structuring slides, generating compilable LaTeX, and validating the output. Even if the user just says 'help me present this paper' or 'make slides for my lab meeting', this skill applies.

Repo
Chanw-research/claude-code-paper-writing
Slug
paper-to-beamer

SKILL.md

Paper-to-Beamer: Academic Paper Presentation Generator

Transform any academic paper into a professional, compilable LaTeX Beamer presentation using the Crimson theme (crimson.sty) with XeLaTeX + xeCJK support.

Quick Start

When this skill triggers, follow these phases in order:

  1. Read the paper → understand structure, contributions, key figures/tables/equations
  2. Ask the user → clarify preferences (language, duration, theme, figures)
  3. Prepare resources → extract figures, build bibliography
  4. Generate LaTeX → write main.tex following the slide structure patterns
  5. Validate → check environments, braces, citations, figure files
  6. Compile → if LaTeX is available, compile and verify
  7. Visual reviewmandatory — Read the compiled PDF page-by-page with the vision model, audit for layout/spacing/overlap/TOC density issues, then fix and recompile until clean

Phase 7 is not optional. A compile that "succeeds" can still produce broken layouts: figures overlapping body text, single-column TOC running off the page, oversized headings colliding with the nav bar. LaTeX does not flag these — only a visual pass catches them. Always perform Phase 7 before reporting the task complete.


Phase 1: Read the Paper

Use the Read tool to read the paper PDF. Focus on extracting:

  • Title, authors, venue, year
  • Paper type (architecture, empirical, survey, theory — see mapping below)
  • Section structure — map each section to slide allocation
  • Key contributions — 3-5 bullet points
  • Important figures — which ones are essential for the presentation
  • Key equations — transcribe them accurately in LaTeX
  • Main results — tables with numbers, comparisons
  • Conclusion — takeaways and future impact

Phase 2: Ask the User

Before generating, clarify these parameters. Use AskUserQuestion with these four questions:

  1. Language: 中文为主+英文术语 (recommended) / 全英文 / 双语对照
  2. Duration: 15-20 min (~15-18 slides) / 25-30 min (~25-27 slides, recommended) / 40-45 min (~35-40 slides)
  3. Logo / 校徽: 不使用校徽 (recommended, default) / 上传自定义 Logo 图像
  4. Figures: 从PDF截取 (recommended) / 用TikZ重绘 / 用drawio重绘

If the user picks 上传自定义 Logo 图像 in question 3, follow up with a plain-text question asking for the absolute path to a PNG file (e.g., /Users/.../mylogo.png). Do not proceed until you have a valid path — verify the file exists before Phase 3.

Phase 3: Prepare Resources

3a. Auto-extract Figures and Tables

Run the extraction script from the working directory:

python3 ~/.claude/skills/paper-to-beamer/scripts/extract_assets.py paper.pdf --outdir figs

Dependencies (install on first use):

pip3 install PyMuPDF pdfplumber --user --break-system-packages -i https://pypi.org/simple/

pdfplumber is optional — without it, tables are screenshot only. PyMuPDF is required.

The script walks the PDF, locates every Figure N / Fig. N / 图 N and Table N / 表 N caption, and infers the surrounding content bbox:

  • Figures: collects images + vector drawings above the caption (figures conventionally sit above their captions), clips to the caption's column in two-column layouts, renders at 3× zoom
  • Tables: uses pdfplumber's ruling-line detector to find the table body near the caption; small tables (≤ 20 rows, ≤ 8 cols) are rebuilt as booktabs LaTeX so numbers stay crisp; wide tables fall back to screenshot

Outputs under figs/:

  • figure_1.png, figure_2.png, ...
  • table_1.png or table_1.tex (depending on size)
  • manifest.json — indexed metadata consumed in Phase 3.5

Verify extraction: read a few figure PNGs with the Read tool to confirm they aren't clipped or contaminated with body text. If a figure looks wrong, re-extract that one manually with tighter coordinates:

import fitz
doc = fitz.open("paper.pdf")
mat = fitz.Matrix(3, 3)
page = doc[PAGE_INDEX]
pix = page.get_pixmap(matrix=mat, clip=fitz.Rect(x0, y0, x1, y1))
pix.save("figs/figure_name.png")

Page coordinates: origin top-left, units are points (1/72 inch), standard page 612 × 792.

3b. Set Up Template Files

Copy template files from the skill's assets/template/ directory to the working directory:

  • crimson.sty → working directory
  • fonts/STKAITI.TTF and fonts/wingding.ttffonts/ subdirectory
  • Keep existing figs/ directory for extracted figures

If the template files already exist in the working directory (e.g., user cloned from Overleaf), skip this step.

3c. Build Bibliography

Create or expand ref.bib with all papers cited in the presentation. Use standard BibTeX format. The bibliography must include at minimum the paper being presented.

3d. Logo / 校徽 Placement

Logo anchor point: In Beamer, the title-page logo is controlled by \titlegraphic{...}, placed in the preamble between \usepackage{crimson} and \begin{document}. This is the single authoritative insertion site. When present, the logo renders on the title page directly below the date; when absent, nothing appears — the title page collapses cleanly.

Choose one branch based on the user's Phase 2 answer:

Branch A — 不使用校徽 (default):

  • Do not emit any \titlegraphic line.
  • Do not copy any logo file into the working directory.

Branch B — 上传自定义 Logo 图像:

  1. Verify the user-supplied PNG path exists. If it does not, stop and ask again.
  2. Copy the PNG into the working directory as figs/logo.png (overwrite if present). Keeping the logo inside figs/ avoids cluttering the project root and keeps it colocated with other graphics.
  3. Emit this exact block in the preamble, right after \usepackage{crimson}:
    % === LOGO / 校徽 anchor ===
    \titlegraphic{\includegraphics[height=1.8cm,keepaspectratio]{figs/logo.png}}
    
  4. Sizing rule (proportional scaling): always specify height=1.8cm with keepaspectratio. Never give both width and height simultaneously — that would distort the aspect ratio. 1.8cm is calibrated so a square校徽 (≈ 1.8×1.8 cm) sits cleanly below the date without crowding the title block. For a wide/horizontal logo, the command still renders at the same height, letting the width grow naturally to whatever the aspect ratio demands.
  5. If the supplied PNG is transparent, it will blend with the title page background — no further work needed. If it has a solid background, warn the user that the logo may show a white rectangle against the crimson title banner.

Phase 3.5: Assign Assets to Slides

Before writing any LaTeX, read figs/manifest.json. Each entry carries the asset's caption, page, type, render, and path — this is your catalog. For each asset, decide (a) whether to include it, and (b) which slide's argument it supports.

Do not apply hard-coded domain rules — the same mechanism must work for CS/ML, economics, biology, social science, theory, and so on. Use these cross-domain principles instead:

  1. Every asset must earn its place. If you can't state which slide's argument an asset supports, drop it. A 25-min talk typically uses 4–8 assets, not all of them.
  2. Caption semantics drive placement. The paper's own caption tells you the slide it belongs on. Read each caption carefully and match on meaning, not position:
    • Captions mentioning "architecture", "overview", "framework", "pipeline", "proposed", "our method" → method/approach slide
    • Captions mentioning "results on", "comparison with", "performance", "accuracy", "effect" → results slide
    • Captions mentioning "ablation", "without X", "effect of X", "sensitivity to X" → ablation slide
    • Captions mentioning "example", "case", "visualization", "qualitative" → motivation or qualitative slide
    • Captions mentioning "distribution", "statistics", "summary of data", "dataset" → data slide These keywords are hints, not a lookup table — a caption mentioning both "overview" and "results" belongs wherever its semantic weight lies.
  3. **Page o

同一分类的其他项