latex-compilelisted
Install: claude install-skill antiamerican-postponer432/chatgpt-for-researchers
# latex-compile
Compile a LaTeX document, fix all errors **and** all aesthetic issues so the PDF is clean
and the log is empty — without ever altering content to make things fit.
## When to invoke
After any edit to a .tex file. Also invoke before committing.
## Input
The user may specify one or more files: `$latex-compile brief.tex workbook.tex`.
Default: `workbook.tex`. Work from the project root (wherever AGENTS.md lives).
## 1. Compile — always force a real pass, capture stdout
**Critical: never trust the `.log` for warnings.** When `latexmk` decides targets are
up-to-date it skips compilation and leaves a **stale** log that under-reports (or zeroes
out) overfull warnings. Force a real `pdflatex` pass and capture its **stdout**:
```
pdflatex -interaction=nonstopmode <file> > /tmp/tex.txt 2>&1
```
Run **twice** when cross-references, TOC, or forward `\ref`s changed (or a manual `\label`
bibliography needs a second pass to resolve `\cite`).
**Always use `grep -a`.** pdflatex embeds binary font-path bytes in its output, so plain
`grep` treats the stream as binary and matches nothing. Every grep below uses `-a`.
## 2. Collect ALL issues from the fresh stdout
```
grep -anE "^! |LaTeX Error|[Uu]ndefined|Overfull|Underfull|multiply defined|Font (shape|Warning)|File .*not found" /tmp/tex.txt
```
**Case matters — this is the bug that lets `[?]`/`??` ship.** pdflatex writes `Undefined
control sequence` (capital, a fatal error) but the broken-ref/cite *warnings* are lowerc