Paper compile

From Chanw-research/claude-code-paper-writing · View interactive version

Paper compile is an AI agent skill from the GitHub repository Chanw-research/claude-code-paper-writing. LaTeX 编译 → PDF:latexmk 编译 + 自动修复 + 页数/匿名/字体/[UNCONFIRMED] 检查 + 提交清单

How to use this skill

Skill file

/paper-compile

编译 LaTeX 论文为 PDF,自动修复常见错误,验证提交要求。

输入 paper/ 目录(由 /paper-draft 生成),执行 latexmk 编译,

解析错误并尝试自动修复(缺失包、引用未定义、figure 路径),

验证页数限制、匿名合规、字体嵌入、[UNCONFIRMED] 标记清除。

生成提交清单。

Inputs

Outputs

Wiki Interaction

Reads

Writes

Graph edges created

Workflow

前置:确认 paper/main.tex 存在。确认 latexmk 已安装(which latexmk)。

Step 1: 编译(Compile)

  1. 首次编译:

```bash

cd paper/ && latexmk -pdf -interaction=nonstopmode main.tex 2>&1

```

  1. 解析编译输出:
  1. 若编译成功(main.pdf 生成):进入 Step 3
  2. 若编译失败:进入 Step 2

Step 2: 自动修复(Auto-Fix)

若 --fix 启用,尝试自动修复每种错误类型:

2a. Missing package:

# 检查是否为 TeX Live 可安装包
tlmgr info {package-name} 2>/dev/null
# 若可安装且用户确认:
tlmgr install {package-name}

若无法安装:注释掉 \usepackage{xxx} 行并标注 % TODO: install package {xxx}

2b. Undefined reference/citation:

2c. Missing figure:

2d. Syntax error:

修复后重新编译(最多 3 轮 fix-compile 循环):

cd paper/ && latexmk -pdf -interaction=nonstopmode main.tex 2>&1

Step 3: 验证检查(Verify)

编译成功后执行以下检查:

3a. 页数检查:

# 获取 PDF 页数
python3 -c "
import subprocess
result = subprocess.run(['pdfinfo', 'paper/main.pdf'], capture_output=True, text=True)
for line in result.stdout.splitlines():
    if line.startswith('Pages:'):
        print(line.split(':')[1].strip())
"

与 venue 页数限制对比(从 PAPER_PLAN 的 venue 或 academic-writing.md 的 venue 表获取)。

3b. 匿名检查:

扫描所有 .tex 文件:

3c. [UNCONFIRMED] 标记检查:

# 扫描 references.bib 和所有 .tex 文件
grep -rn "VERIFY" paper/

3d. 字体嵌入检查:

pdffonts paper/main.pdf

3e. 内容完整性检查:

Step 4: 生成提交清单和报告

# Compile Report

## Compilation
- Status: {SUCCESS / FAILED}
- Compiler: latexmk + pdflatex
- Rounds: {N} (including auto-fix rounds)
- Errors: {N} (fixed: {M}, remaining: {K})
- Warnings: {N} (overfull: {O}, underfull: {U}, other: {W})

## Verification Results

| Check | Status | Details |
|-------|--------|---------|
| Page count | {PASS/FAIL} | {N} pages (limit: {L}) |
| Anonymous | {PASS/WARN} | {details} |
| [UNCONFIRMED] citations | {PASS/FAIL} | {N} remaining |
| Fonts embedded | {PASS/FAIL} | {details} |
| No TODOs | {PASS/WARN} | {N} remaining |
| Figures referenced | {PASS/WARN} | {details} |
| Abstract present | {PASS/FAIL} | {details} |

## Submission Checklist

- [ ] PDF compiles without errors
- [ ] Page count within venue limit ({L} pages)
- [ ] All [UNCONFIRMED] citations resolved
- [ ] Anonymous submission (no author info)
- [ ] All fonts embedded
- [ ] No TODO/FIXME markers
- [ ] All figures referenced in text
- [ ] Abstract present and complete
- [ ] Supplementary material prepared (if applicable)
- [ ] Paper title matches submission system

## Blocking Issues
{list of FAIL items that must be resolved before submission}

## Warnings (non-blocking)
{list of WARN items for consideration}

## Next Steps
- {specific actions to resolve blocking issues}
- Run `/refine paper/main.tex --focus writing` for final polish
- Manual review of anonymous compliance

追加日志:

python3 tools/research_wiki.py log wiki/ \
  "paper-compile | {SUCCESS/FAILED} | {pages} pages, {errors} errors, {verify_count} [UNCONFIRMED], {checks_passed}/{checks_total} checks passed"

Constraints

Error Handling

Dependencies

Tools(via Bash)

MCP Servers

Claude Code Native

Shared References

Called by

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.