1.7k pedrohcgs

compile-latex Skill

用 XeLaTeX 编译 Beamer LaTeX 幻灯片(3 遍编译 + bibtex)。当用户说"compile"、"build the slides"、"rebuild the PDF"、"run latex"、"render the tex",或询问 `.tex` 文件为何没生成 PDF 时使用。作用于 `Slides/*.tex`。

安装方式:把技能目录放入 ~/.claude/skills/(Claude Code)或在 claude.ai 设置中启用;也可复制右侧安装命令一键添加。

查看源码

技能指令原文(SKILL.md)

Compile Beamer LaTeX Slides

Compile a Beamer slide deck using XeLaTeX with full citation resolution.

Steps

  1. Navigate to Slides/ directory and compile with 3-pass sequence:
cd Slides
TEXINPUTS=../Preambles:$TEXINPUTS xelatex -interaction=nonstopmode $ARGUMENTS.tex
BIBINPUTS=..:$BIBINPUTS bibtex $ARGUMENTS
TEXINPUTS=../Preambles:$TEXINPUTS xelatex -interaction=nonstopmode $ARGUMENTS.tex
TEXINPUTS=../Preambles:$TEXINPUTS xelatex -interaction=nonstopmode $ARGUMENTS.tex

Alternative (latexmk):

cd Slides
TEXINPUTS=../Preambles:$TEXINPUTS BIBINPUTS=..:$BIBINPUTS latexmk -xelatex -interaction=nonstopmode $ARGUMENTS.tex
  1. Check for warnings:
  • Grep output for Overfull \\hbox warnings
  • Grep for undefined citations or Label(s) may have changed
  • Report any issues found
  1. Open the PDF for visual verification:
   open Slides/$ARGUMENTS.pdf          # macOS
   # xdg-open Slides/$ARGUMENTS.pdf    # Linux
  1. Report results:
  • Compilation success/failure
  • Number of overfull hbox warnings
  • Any undefined citations
  • PDF page count

Why 3 passes?

  1. First xelatex: Creates .aux file with citation keys
  2. bibtex: Reads .aux, generates .bbl with formatted references
  3. Second xelatex: Incorporates bibliography
  4. Third xelatex: Resolves all cross-references with final page numbers

Important

  • Always use XeLaTeX, never pdflatex
  • TEXINPUTS is required: your Beamer theme lives in Preambles/
  • BIBINPUTS is required: your .bib file lives in the repo root