agentleFS
JihaoXinJihaoXin/paper-machine/skills/latex-compile/SKILL.md

latex-compile

Skill0 starsChanged 3 months agoMITView on GitHub

Get a clean PDF out of LaTeX and diagnose what went wrong when you do not. Use when compiling a paper, fixing overfull boxes, chasing "?" citations, or debugging a build that produces no PDF. Covers the BibTeX chain, common venue template traps, and what to check in the log.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

6 rules. 0 are common, 1 is distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    A bare pdflatex re-run does not refresh the bibliography: If any later step recompiles (page fitting often does), run the whole chain …

    line 21
  2. Distinctive:

    If no PDF is produced at all:

    line 71
  3. Very specific:

    Read the first ! in main.log.

    line 73
  4. Very specific:

    Check for a missing .sty or .cls file.

    line 75
  5. Very specific:

    Check for an unescaped special character in text you inserted: _ % & # $ outside math mode.

    line 77
  6. Very specific:

    Delete main.aux and rebuild.

    line 79

“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LaTeX Compile

Run the full chain

pdflatex -interaction=nonstopmode main.tex
bibtex   main
pdflatex -interaction=nonstopmode main.tex
pdflatex -interaction=nonstopmode main.tex

Skipping bibtex is the single most common cause of ? citations and an empty References section. Skipping the final pdflatex leaves cross references and page numbers stale.

A bare pdflatex re-run does not refresh the bibliography. If any later step recompiles (page fitting often does), run the whole chain again before delivering, or you can ship a PDF whose citations regressed after they were fixed.

Read the log, not the exit code

pdflatex exits 0 with errors. Check for the real signals:

grep -E "^(!|LaTeX Error|Emergency stop)" main.log
grep -c "Warning.*undefined" main.log     # undefined citations/refs
grep "Overfull \\\\hbox" main.log | wc -l # text spilling into the margin

And verify the artifact: does main.pdf exist, is it larger than a skeleton, does a PDF parser open it?

Overfull boxes

Overfull \hbox means text extends past the margin. Reviewers see it as sloppiness, and some venues reject on it. Usual causes and fixes:

  • a long URL: \usepackage{url} and wrap it in \url{}
  • a wide table: \resizebox{\columnwidth}{!}{...}, or restructure it
  • an unbreakable identifier: insert \- hyphenation points, or use \texttt{} with \sloppy nearby
  • an oversized figure: reduce the width, or move to figure*

Fix the cause. Do not silence the warning.

Venue templates

Templates carry traps that cost hours:

  • Commented examples that look like real commands. An elsarticle template contains %% \title{Title\tnoteref{label1}} above the real title. Anything parsing \title naively picks up the comment. If you extract the title programmatically, strip % comments first and match braces properly.
  • Separate bibliography files. Some templates ship custom.bib or anthology.bib alongside your references.bib. Cite keys living only in the template's file will vanish if you clean up "unused" entries in yours. Merge them before pruning anything.
  • Class options change the page geometry. \documentclass[preprint] and the camera-ready option produce very different page counts. Fit to the option the venue actually wants.

Missing PDF

If no PDF is produced at all:

  1. Read the first ! in main.log. That is the real error. Everything after it is fallout.
  2. Check for a missing .sty or .cls file. Venue templates often ship them in a zip you have not extracted.
  3. Check for an unescaped special character in text you inserted: _ % & # $ outside math mode.
  4. Delete main.aux and rebuild. Stale aux files cause errors that describe problems no longer in the source.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.