paper-compilation
lingzhi227/agent-research-skills
Compile LaTeX papers to PDF with automatic error detection, style checking, and citation validation.
What is paper-compilation?
Compiles LaTeX papers through the full pdflatex + bibtex pipeline with built-in error detection and auto-fix capabilities. Use this when you need to compile a paper, resolve compilation errors, validate citations and references, or debug LaTeX syntax issues.
- Runs full pdflatex → bibtex → pdflatex → pdflatex compilation pipeline
- Detects and reports compilation errors, warnings, and page counts
- Validates citations against .bib files and checks for missing figures before compiling
- Performs automatic LaTeX error fixing (HTML tags, mismatched environments, missing figures) with retry up to 3 rounds
- Runs chktex style checking to identify formatting and style issues
- Provides post-compilation reports including page count, warnings, and citation statistics
How to install paper-compilation
npx skills add https://github.com/lingzhi227/agent-research-skills --skill paper-compilation- pdflatex installed (via texlive-full on Ubuntu or mactex-no-gui on macOS)
- A main .tex file and associated .bib bibliography file
- Optional: chktex for style checking
How to use paper-compilation
- 1.Run citation validation first: `python ~/.claude/skills/paper-compilation/scripts/validate_citations.py --tex paper/main.tex --bib paper/references.bib`
- 2.Compile the paper: `python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex`
- 3.If compilation fails, review the error log and fix issues, or use auto-fix: `python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --auto-fix`
- 4.Check the post-compilation report for page count, warnings, and style issues
- 5.For style checking, add the `--check-style` flag to the compile command
Use cases
- Compile a research paper to PDF and get a detailed error report
- Fix common LaTeX errors like undefined control sequences, missing braces, or HTML syntax in LaTeX code
- Validate all citations and figure references before attempting compilation to catch issues early
- Auto-fix and recompile a paper that fails due to common LaTeX mistakes
- Check a compiled paper against venue page limits and style guidelines
- Researchers and academics writing papers in LaTeX
- Students preparing thesis or dissertation documents
- Anyone debugging LaTeX compilation errors
- Authors preparing papers for conference or journal submission
paper-compilation FAQ
On macOS run `brew install --cask mactex-no-gui`; on Ubuntu run `sudo apt install texlive-full`. Alternatively, use `latexmk -pdf -interaction=nonstopmode main.tex` which auto-handles multiple passes.
Yes, use the `--auto-fix` flag which runs the error fixer and retries compilation up to 3 rounds. It fixes common issues like HTML tags in LaTeX, mismatched environments, and missing figures.
It verifies every `\cite{key}` has a matching .bib entry, every `\includegraphics{file}` exists, and detects duplicate labels or sections before compilation.
It handles undefined control sequences, missing $ delimiters, mismatched braces, undefined citations, and HTML syntax in LaTeX. For other errors, it reports them for manual fixing.
The post-compilation report includes page count, which you can compare against venue limits, but the skill does not enforce limits automatically.
Full instructions (SKILL.md)
Source of truth, from lingzhi227/agent-research-skills.
name: paper-compilation description: Compile LaTeX papers to PDF with automatic error detection, chktex style checking, and citation/reference validation. Runs the full pdflatex + bibtex pipeline. Use when the user wants to compile a paper, fix compilation errors, or debug LaTeX. argument-hint: [tex-file-path]
Paper Compilation
Compile a LaTeX paper to PDF with error detection and correction.
Input
$ARGUMENTS— Path to the main.texfile
Scripts
Compile paper
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
Reports: compilation status, page count, warnings, citation/reference stats, style issues.
Validate citations before compiling
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
python ~/.claude/skills/paper-compilation/scripts/fix_latex_errors.py \
--tex paper/main.tex --log compile.log --output paper/main_fixed.tex
Fixes: HTML tags in LaTeX, mismatched environments, missing figures. Key flags: --dry-run, --auto-detect
Compile with auto-fix retry
python ~/.claude/skills/paper-compilation/scripts/compile_paper.py paper/main.tex --auto-fix
Runs fix_latex_errors.py + recompile up to 3 rounds until compilation succeeds.
Workflow
Step 1: Pre-Compilation Validation
Run validate_citations.py to catch issues before compiling:
- Every
\cite{key}has a matching.bibentry - Every
\includegraphics{file}exists - No duplicate labels or sections
Step 2: Compile
Run compile_paper.py which executes: pdflatex → bibtex → pdflatex → pdflatex
Step 3: Error Correction Loop (up to 5 rounds)
If compilation fails, read the error output and fix:
! Undefined control sequence→ Add missing package or fix typo! Missing $ inserted→ Wrap math in$...$! Missing } inserted→ Fix unmatched braceCitation 'key' undefined→ Add to .bib or fix\cite</end{figure}>→ Replace with\end{figure}(HTML syntax in LaTeX)
Apply minimal fixes. Do not remove packages unnecessarily. Recompile after each fix.
Step 4: Post-Compilation Report
Check: page count vs venue limit, remaining warnings, chktex style issues.
Troubleshooting
pdflatex not found
# macOS
brew install --cask mactex-no-gui
# Ubuntu
sudo apt install texlive-full
Alternative: latexmk (auto-handles multiple passes)
latexmk -pdf -interaction=nonstopmode main.tex
Related Skills
- Upstream: latex-formatting, citation-management, figure-generation, table-generation
- Downstream: self-review
- See also: paper-assembly
Related skills
More from lingzhi227/agent-research-skills and the wider catalog.

paper-revision
Systematically revise papers by mapping reviewer feedback to sections, executing targeted edits, and verifying improvements.

paper-to-code
Convert ML research papers into complete, runnable code repositories via structured planning, analysis, and generation.

paper-writing-section
Write publication-quality sections for academic papers with section-specific guidance and two-pass refinement.

rebuttal-writing
Write evidence-based rebuttals to peer review comments with structured point-by-point responses.

related-work-writing
Write publication-quality Related Work sections that organize literature by theme and position your research.

research-planning
Design structured research plans and paper architectures from a topic or idea.