latex-compilelisted
Install: claude install-skill Mexregkan/claude-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 CLAUDE.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|Undefined|Overfull|Underfull|multiply defined|Font (shape|Warning)|File .*not found" /tmp/tex.txt
```
| Category | Marker | Threshold to fix |
|---|---|---|
| Fatal errors | `! `, `LaTeX Error`, `Runaway argument`, `Emergency stop` | Always |
| Undefined refs/cites | `Reference … u