Skip to content
Skillpedia
Writing18k ยท #10559

paper-compile

What it does

This skill builds a LaTeX research paper into a PDF and fixes errors that stop the build. It is for authors preparing a paper for submission.

When to use it

  • โœ“When your LaTeX paper is ready and you need a PDF.
  • โœ“When the LaTeX build fails and you need the errors fixed.
  • โœ“When you need to check that the paper fits the page limit for your venue.

Skill link

https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/paper-compile/SKILL.md

Copy 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

Use this skill to help me: https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/paper-compile/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute โ†’

Example of what to ask your AI

โ€œI need my LaTeX paper compiled into a PDF, and I want you to fix any build errors you find.โ€

5 new skills a week. 1 minute to read.

How it works

The agent checks that the tools and files are present, runs the build, and reads any errors. It fixes them and rebuilds, up to three attempts, then checks the output.

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).

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:

  1. Read the error message from compile.log
  2. Locate the source file and line number
  3. Apply the fix
  4. Recompile

Stuck after 2 attempts? If Codex plugin is installed, invoke /codex:rescue โ€” Codex can independently read the LaTeX source and compile.log to spot issues Claude missed (e.g., conflicting packages, encoding problems, subtle macro errors). If not installed, continue with Claude's own diagnosis.

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

Visual review (automated): If the compiled PDF exists, read it directly to check visual presentation:

  • Figure quality: readable labels, legible text, distinguishable colors
  • Layout: no orphaned section headers, no awkward page breaks
  • Figures appear near their first text reference (not pages away)
  • Tables: aligned columns, consistent decimal precision
  • No overfull content visibly extending past margins

This is a quick visual scan, not a full review โ€” the improvement loop does deeper visual review.

Automated checks:

  • PDF file exists and is >
FAQ

Which LaTeX engine does it use?

By default it uses pdflatex, and it can use xelatex or lualatex for custom fonts or CJK text.

How does it handle page limits?

It knows the page rules for common venues, such as ICLR, NeurIPS, and IEEE, and checks against them.

Does it need LaTeX installed?

Yes. It checks for the LaTeX tools first and gives install steps if they are missing.

Details

Original description by the author

Compile LaTeX paper to PDF, fix errors, and verify output. Use when user says \"็ผ–่ฏ‘่ฎบๆ–‡\", \"compile paper\", \"build PDF\", \"็”ŸๆˆPDF\", or wants to compile LaTeX into a submission-ready PDF.

repo: wanshuiyin/Auto-claude-code-research-in-sleep

Popularity

GitHub stars
18k
Ranking position
#10559
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • โ€ฆ

More skills from this repository

Similar skills