LaTeX compile → PDF — latexmk compile + auto-fix + page count/anonymity/font/[UNCONFIRMED] checks + submission checklist
Scanned 9/7/2026
Install to Claude Code
npx -y skills add Lambenthan/empiricalwiki --skill paper-compile --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Paper Compile?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/lambenthan-paper-compile-empiricalwiki)More formats (shields.io, HTML) on the badges page.
---
description: LaTeX compile → PDF — latexmk compile + auto-fix + page count/anonymity/font/[UNCONFIRMED] checks + submission checklist
argument-hint: "[paper-dir] [--fix] [--checklist]"
---
# /paper-compile
> Compile a LaTeX paper to PDF, auto-fix common errors, and verify submission requirements.
> Input: the paper/ directory generated by /paper-draft. Run latexmk compilation,
> parse errors and attempt auto-fix (missing packages, undefined references, figure paths).
> Verify page limit, anonymous compliance, font embedding, and clearance of [UNCONFIRMED] markers.
> Generate a submission checklist.
## Inputs
- `paper_dir` (optional, default `paper/`): LaTeX project directory containing `main.tex`
- `--fix` (optional): enable auto-fix mode (automatically install missing packages, correct paths)
- `--checklist` (optional): generate a detailed submission checklist (check only, no compilation)
## Outputs
- `paper/main.pdf` — compiled PDF
- **COMPILE_REPORT** (printed to terminal) — compilation status, check results, submission checklist
- If `--fix`: modified .tex files (auto-fixed)
## Wiki Interaction
### Reads
- `wiki/outputs/paper-plan-*.md` — retrieve venue information (page limit, anonymity requirements)
- `.claude/skills/shared-references/citation-verification.md` — [UNCONFIRMED] marker check rules
### Writes
- `paper/main.pdf` — compilation output
- `wiki/log.md` — appended compilation log
### Graph edges created
- None
## Workflow
**Precondition**: confirm `paper/main.tex` exists. Confirm `latexmk` is installed (`which latexmk`).
### Step 1: Compile
1. **First compilation**:
```bash
cd paper/ && latexmk -pdf -interaction=nonstopmode main.tex 2>&1
```
2. **Parse compilation output**:
- Collect all errors (`! ...`)
- Collect all warnings (`Warning:` / `Overfull` / `Underfull`)
- Classify:
- **Missing package**: `! LaTeX Error: File 'xxx.sty' not found`
- **Undefined reference**: `LaTeX Warning: Reference 'xxx' on page N undefined`
- **Undefined citation**: `LaTeX Warning: Citation 'xxx' on page N undefined`
- **Missing figure**: `! LaTeX Error: File 'figures/xxx' not found`
- **Syntax error**: other errors beginning with `!`
- **Overfull/Underfull**: typesetting warnings (non-blocking)
3. **If compilation succeeds** (main.pdf generated): proceed to Step 3
4. **If compilation fails**: proceed to Step 2
### Step 2: Auto-Fix
If `--fix` is enabled, attempt to auto-fix each error type:
**2a. Missing package**:
```bash
# check if the package is installable via TeX Live
tlmgr info {package-name} 2>/dev/null
# if installable and user confirms:
tlmgr install {package-name}
```
If not installable: comment out the `\usepackage{xxx}` line and annotate `% TODO: install package {xxx}`
**2b. Undefined reference/citation**:
- Undefined reference: check if the corresponding `\label{}` exists; if not, add a placeholder label
- Undefined citation: check if `references.bib` contains the key
- If not: attempt to match from wiki papers and add an [UNCONFIRMED] entry
- If present but bibtex has not run: re-run `latexmk` (latexmk usually handles this automatically)
**2c. Missing figure**:
- Check if `paper/figures/` contains a file with a different extension (.pdf vs .png vs .eps)
- If found: correct the `\includegraphics` path
- If not found: replace with placeholder `\missingfigure{xxx}` (requires `todonotes` package)
**2d. Syntax error**:
- Common fixes: unclosed `{}`, mismatched `\begin{}`/`\end{}`, illegal characters
- Attempt to locate the error line number; provide specific fix suggestions
- If auto-fix is not possible: report error location and suggestions
**Re-compile after fixes** (up to 3 fix-compile cycles):
```bash
cd paper/ && latexmk -pdf -interaction=nonstopmode main.tex 2>&1
```
### Step 3: Verification Checks
After successful compilation, run the following checks:
**3a. Page count check**:
```bash
# get PDF page count
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())
"
```
Compare against the venue page limit (retrieved from the PAPER_PLAN venue or the venue table in academic-writing.md).
- Exceeds limit: report number of pages over limit; suggest compressing or moving content to appendix
- Under limit: report remaining space; suggest adding content
**3b. Anonymity check**:
Scan all .tex files:
- Search for author names (if `\author{}` is non-empty → warn)
- Search for institution names (university, lab, institute → warn)
- Search for GitHub/GitLab links (may reveal identity → warn)
- Search for "our previous work" / "we previously" → should use third-person citation
- Search for `\thanks{}` / `\acknowledgments` → remove for anonymous submission
**3c. [UNCONFIRMED] marker check**:
```bash
# scan references.bib and all .tex files
grep -rn "VERIFY" paper/
```
- If [UNCONFIRMED] markers exist: list each one; flag as **submission blocker**
- Per citation-verification.md: [UNCONFIRMED] is a hard submission blocker
**3d. Font embedding check**:
```bash
pdffonts paper/main.pdf
```
- Check the "emb" column: all fonts should be "yes"
- Unembedded fonts: report font names; suggest adding font embedding to compile options
**3e. Content completeness check**:
- Search for `TODO`, `FIXME`, `XXX` markers
- Search for `\missingfigure`, empty sections (`\section{X}` followed by no content)
- Search for unreferenced figures/tables (`\includegraphics` present but no `\ref`)
- Check that the abstract exists and is non-empty
### Step 4: Generate Submission Checklist and Report
```markdown
# 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
```
Append log:
```bash
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
- **Do not modify wiki content**: only operate on the paper/ directory and wiki/log.md
- **Auto-fix requires --fix**: by default, only report errors; do not fix
- **[UNCONFIRMED] is a hard blocker**: [UNCONFIRMED] present in submission checklist = not submittable
- **Maximum 3 fix-compile rounds**: prevent infinite fix loops
- **Do not delete user content**: auto-fix only adds or corrects; does not delete hand-written content
- **pdfinfo/pdffonts dependency**: if not installed, skip the corresponding check and annotate "tool not available"
- **Anonymity check is heuristic**: may produce false positives; annotate as WARN rather than FAIL
## Error Handling
- **main.tex not found**: error; suggest running /paper-draft first
- **latexmk not installed**: error; provide installation command (`sudo apt install texlive-full` or `brew install --cask mactex`)
- **Compilation failed and auto-fix unsuccessful**: output full error log + locate specific .tex file and line number
- **pdfinfo/pdffonts not installed**: skip page count / font checks; annotate in report
- **PAPER_PLAN not found**: skip venue info extraction; use default limit (10 pages); warn user
- **Permission issue** (tlmgr requires sudo): report list of packages requiring manual installation
## Dependencies
### Tools(via Bash)
- `latexmk` — LaTeX compilation
- `pdfinfo` — PDF page count check (poppler-utils)
- `pdffonts` — font embedding check (poppler-utils)
- `python3 tools/research_wiki.py log wiki/ "<message>"` — append log
### MCP Servers
- None
### Claude Code Native
- `Read` — read .tex files and compilation logs
- `Edit` — auto-fix .tex files (--fix mode)
- `Bash` — execute compilation and check commands
- `Grep` — search for [UNCONFIRMED], TODO, anonymity violations
### Shared References
- `.claude/skills/shared-references/citation-verification.md` — [UNCONFIRMED] marker check rules
- `.claude/skills/shared-references/academic-writing.md` — venue page limit reference
### Called by
- `/research` Stage 5 (paper compilation stage)
- Manual user invocation
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!