paper-compilation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePaper Compilation
论文编译
Compile a LaTeX paper to PDF with error detection and correction.
将LaTeX论文编译为PDF,同时进行错误检测与修正。
Input
输入
- — Path to the main
$ARGUMENTSfile.tex
- — 主
$ARGUMENTS文件的路径.tex
Scripts
脚本
Compile paper
编译论文
bash
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --check-style
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --output paper/output.pdfReports: compilation status, page count, warnings, citation/reference stats, style issues.
bash
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --check-style
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --output paper/output.pdf输出内容包括:编译状态、页数、警告信息、引用/参考文献统计数据、样式问题。
Validate citations before compiling
编译前验证引用
bash
python ~/.claude/skills/citation-management/scripts/validate_citations.py \
--tex paper/main.tex --bib paper/references.bib --check-figures --figures-dir paper/figures/bash
python ~/.claude/skills/citation-management/scripts/validate_citations.py \
--tex paper/main.tex --bib paper/references.bib --check-figures --figures-dir paper/figures/Auto-fix LaTeX errors
自动修复LaTeX错误
bash
python ~/.claude/skills/paper-compilation/scripts/fix_latex_errors.py \
--tex paper/main.tex --log compile.log --output paper/main_fixed.texFixes: HTML tags in LaTeX, mismatched environments, missing figures. Key flags: ,
--dry-run--auto-detectbash
python ~/.claude/skills/paper-compilation/scripts/fix_latex_errors.py \
--tex paper/main.tex --log compile.log --output paper/main_fixed.tex可修复问题:LaTeX中的HTML标签、不匹配的环境、缺失的图片。关键参数:、
--dry-run--auto-detectCompile with auto-fix retry
自动修复后重试编译
bash
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --auto-fixRuns fix_latex_errors.py + recompile up to 3 rounds until compilation succeeds.
bash
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --auto-fix运行fix_latex_errors.py + 重新编译,最多尝试3轮直到编译成功。
Workflow
工作流程
Step 1: Pre-Compilation Validation
步骤1:编译前验证
Run to catch issues before compiling:
validate_citations.py- Every has a matching
\cite{key}entry.bib - Every exists
\includegraphics{file} - No duplicate labels or sections
运行在编译前排查问题:
validate_citations.py- 每个在
\cite{key}文件中都有对应的条目.bib - 每个对应的文件存在
\includegraphics{file} - 无重复标签或章节
Step 2: Compile
步骤2:编译
Run which executes:
compile_paper.pypdflatex → bibtex → pdflatex → pdflatex运行,执行流程:
compile_paper.pypdflatex → bibtex → pdflatex → pdflatexStep 3: Error Correction Loop (up to 5 rounds)
步骤3:错误修正循环(最多5轮)
If compilation fails, read the error output and fix:
- → Add missing package or fix typo
! Undefined control sequence - → Wrap math in
! Missing $ inserted$...$ - → Fix unmatched brace
! Missing } inserted - → Add to .bib or fix
Citation 'key' undefined\cite - → Replace with
</end{figure}>(HTML syntax in LaTeX)\end{figure}
Apply minimal fixes. Do not remove packages unnecessarily. Recompile after each fix.
如果编译失败,读取错误输出并修复:
- → 添加缺失的包或修正拼写错误
! Undefined control sequence - → 用
! Missing $ inserted包裹数学公式$...$ - → 修复不匹配的大括号
! Missing } inserted - → 添加到.bib文件或修正
Citation 'key' undefined命令\cite - → 替换为
</end{figure}>(LaTeX中的HTML语法问题)\end{figure}
应用最小化修复,不要随意移除包。每次修复后重新编译。
Step 4: Post-Compilation Report
步骤4:编译后报告
Check: page count vs venue limit, remaining warnings, chktex style issues.
检查:页数是否符合会议/期刊限制、剩余警告信息、chktex样式问题。
Troubleshooting
故障排除
pdflatex not found
未找到pdflatex
bash
undefinedbash
undefinedmacOS
macOS
brew install --cask mactex-no-gui
brew install --cask mactex-no-gui
Ubuntu
Ubuntu
sudo apt install texlive-full
undefinedsudo apt install texlive-full
undefinedAlternative: latexmk (auto-handles multiple passes)
替代方案:latexmk(自动处理多轮编译)
bash
latexmk -pdf -interaction=nonstopmode main.texbash
latexmk -pdf -interaction=nonstopmode main.texRelated Skills
相关技能
- Upstream: latex-formatting, citation-management, figure-generation, table-generation
- Downstream: self-review
- See also: paper-assembly
- 上游:latex-formatting、citation-management、figure-generation、table-generation
- 下游:self-review
- 另见:paper-assembly