paper-compile
What it does
This Codex version of the paper compile skill builds a LaTeX paper into a PDF and fixes errors. It is for authors preparing a paper for submission in Codex.
When to use it
- βWhen your LaTeX paper is ready and you need a PDF.
- βWhen the build fails and you need the errors fixed.
- βWhen the same build error keeps returning and you need a second opinion.
Skill link
https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/skills-codex/paper-compile/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βI need my LaTeX paper compiled into a PDF, and I want the build errors fixed.β
5 new skills a week. 1 minute to read.
How it works
The agent checks the LaTeX tools and files, runs the build, and reads the errors. It fixes them and rebuilds up to three times, and if the same error repeats, it keeps the log and asks for a focused second opinion.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Paper Compile: LaTeX to Submission-Ready PDF
Compile the LaTeX paper and fix any issues: $ARGUMENTS
Constants
- COMPILER =
latexmkβ LaTeX build tool. Handles multi-pass compilation automatically. - ENGINE =
pdflatexβ LaTeX engine. Options:pdflatex(default),xelatex(for CJK/custom fonts),lualatex. - MAX_COMPILE_ATTEMPTS = 3 β Maximum attempts to fix errors and recompile.
- PAPER_DIR =
paper/β Directory containing LaTeX source files. - MAX_PAGES β Page limit. ML conferences: main body to Conclusion end (excluding references & appendix). ICLR=9, NeurIPS=9, ICML=8. IEEE venues: references ARE included in page count. IEEE journal β 12-14 pages, IEEE conference β 5-8 pages (all inclusive).
- RESCUE_ON_REPEAT_FAILURE = true β If the same compile class fails after two attempts, preserve
compile.logand ask for a focused rescue / second opinion before further edits.
Workflow
Step 1: Verify Prerequisites
Check that the compilation environment is ready:
# Check LaTeX installation
which pdflatex && which latexmk && which bibtex
# If not installed, provide instructions:
# macOS: brew install --cask mactex-no-gui
# Ubuntu: sudo apt-get install texlive-full
# Server: conda install -c conda-forge texlive-core
Verify all required files exist:
# Must exist
ls $PAPER_DIR/main.tex
# Should exist
ls $PAPER_DIR/references.bib
ls $PAPER_DIR/sections/*.tex
ls $PAPER_DIR/figures/*.pdf 2>/dev/null || ls $PAPER_DIR/figures/*.png 2>/dev/null
Step 2: First Compilation Attempt
cd $PAPER_DIR
# Clean previous build artifacts
latexmk -C
# Full compilation (pdflatex + bibtex + pdflatex Γ 2)
latexmk -pdf -interaction=nonstopmode -halt-on-error main.tex 2>&1 | tee compile.log
Step 3: Error Diagnosis and Auto-Fix
If compilation fails, read compile.log and fix common errors:
Missing packages:
! LaTeX Error: File `somepackage.sty' not found.
β Install via tlmgr install somepackage or remove the \usepackage if unused.
Undefined references:
LaTeX Warning: Reference `fig:xyz' on page 3 undefined
β Check \label{fig:xyz} exists in the correct figure environment.
Missing figures:
! LaTeX Error: File `figures/fig1.pdf' not found.
β Check if the file exists with a different extension (.png vs .pdf). Update the \includegraphics path.
Citation undefined:
LaTeX Warning: Citation `smith2024' undefined
β Add the missing entry to references.bib or fix the citation key.
[VERIFY] markers in text:
β Search for [VERIFY] markers left by /paper-write. These indicate unverified citations or facts. Search for the correct information or flag to the user.
Overfull hbox:
Overfull \hbox (12.5pt too wide) in paragraph at lines 42--45
β Minor: usually ignorable. If severe (>20pt), rephrase the text or adjust figure width.
BibTeX errors:
I was expecting a `,' or a `}'---line 15 of references.bib
β Fix BibTeX syntax (missing comma, unmatched braces, special characters in title).
\crefname undefined for custom theorem types:
β Ensure \crefname{assumption}{Assumption}{Assumptions} and similar are in the preamble after \newtheorem{assumption}.
Step 4: Iterative Fix Loop
for attempt in 1..MAX_COMPILE_ATTEMPTS:
compile()
if success:
break
parse_errors()
auto_fix()
For each error:
- Read the error message from
compile.log - Locate the source file and line number
- Apply the fix
- Recompile
Step 5: Post-Compilation Checks
After successful compilation, verify the output:
# Check PDF exists and has content
ls -la main.pdf
# Check page count
pdfinfo main.pdf | grep Pages
# macOS: open for visual inspection
# open main.pdf
Automated checks:
- PDF file exists and is > 100KB (not empty/corrupt)
- Total page count is reasonable (MAX_PAGES + appendix + references)
- No "??" in the PDF (undefined references β grep the log)
- No "[?]" in the PDF (undefined citations β grep the log)
- Figures are rendered (not missing image placeholders)
# Check for undefined references
grep -c "LaTeX Warning.*undefined" compile.log
# Check for missing citations
grep -c "Citation.*undefined" compile.log
Step 6: Page Count Verification
CRITICAL: Verify paper fits within MAX_PAGES.
For ML conferences (ICLR/NeurIPS/ICML/CVPR/ACL/AAAI): Main body = first page through end
FAQ
Which engines can it use?
By default it uses pdflatex, and it can switch to xelatex or lualatex for custom fonts or CJK text.
Does it check page limits?
Yes. It knows the page rules for common venues and checks against them.
What if LaTeX is not installed?
The skill checks for it first and gives install steps for macOS, Ubuntu, or a server.
Details
Original description by the author
Compile LaTeX paper to PDF, fix errors, and verify output. Use when user says \\\"\u7f16\u8bd1\u8bba\u6587\\\", \\\"compile paper\\\", \\\"build PDF\\\", \\\"\u751f\u6210PDF\\\", or wants to compile LaTeX into a submission-ready PDF.
Popularity
- GitHub stars
- 18k
- Ranking position
- #10607
- License
- MIT
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
ablation-planner
18kHelps your agent plan ablation studies for a paper, choosing the tests reviewers are likely to ask for once the main results look good.
alphaxiv
18kLets your agent quickly read one research paper using AlphaXiv summaries, with full text or LaTeX source as backup, from an arXiv link or ID.
analyze-results
18kHelps your agent analyze machine learning experiment results, compare runs against a baseline, and turn the numbers into clear findings and next steps.
arxiv
18kLets your agent search arXiv for academic papers, read their details, and save PDFs to your library for a research topic.
Similar skills
obsidian-vault-maintainer
394kHelps your agent keep an Obsidian-friendly memory vault tidy, with working wiki links, consistent properties, and safe generated sections.
wiki-maintainer
394kHelps your agent maintain an OpenClaw memory wiki with repeatable pages, safe managed blocks, and checks for contradictions or gaps.
obsidian
394kLets your agent read, search, create, and edit Obsidian notes, tasks, links, and properties using the official Obsidian command line.