Loading...
Loading...
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.
npx skill4agent add wanshuiyin/auto-claude-code-research-in-sleep paper-compilelatexmkpdflatexpdflatexxelatexlualatexpaper/# 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# 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/nullcd $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.logcompile.log! LaTeX Error: File `somepackage.sty' not found.tlmgr install somepackage\usepackageLaTeX Warning: Reference `fig:xyz' on page 3 undefined\label{fig:xyz}! LaTeX Error: File `figures/fig1.pdf' not found.\includegraphicsLaTeX Warning: Citation `smith2024' undefinedreferences.bib[VERIFY][VERIFY]/paper-writeOverfull \hbox (12.5pt too wide) in paragraph at lines 42--45I was expecting a `,' or a `}'---line 15 of references.bib\crefname\crefname{assumption}{Assumption}{Assumptions}\newtheorem{assumption}for attempt in 1..MAX_COMPILE_ATTEMPTS:
compile()
if success:
break
parse_errors()
auto_fix()compile.log# 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# Check for undefined references
grep -c "LaTeX Warning.*undefined" compile.log
# Check for missing citations
grep -c "Citation.*undefined" compile.logpdftotext# Extract text and find where Conclusion ends vs References begin
pdftotext main.pdf - | python3 -c "
import sys
text = sys.stdin.read()
pages = text.split('\f')
for i, page in enumerate(pages):
if 'Ethics Statement' in page or 'Reproducibility' in page:
print(f'Conclusion ends on page {i+1}')
if any(w in page for w in ['References', 'Bibliography']):
lines = [l for l in page.split('\n') if l.strip()]
for l in lines[:3]:
if 'References' in l or 'Bibliography' in l:
print(f'References start on page {i+1}')
break
"main.tex# Find all .tex files in sections/ and check which are \input'ed by main.tex
for f in paper/sections/*.tex; do
base=$(basename "$f")
if ! grep -q "$base" paper/main.tex; then
echo "WARNING: $f is not referenced by main.tex — consider removing"
fi
done5_conclusion.texpdffonts main.pdf | grep -v "yes" # should return nothing (or only header)\newpage\appendix[VERIFY]## Compilation Report
- **Status**: SUCCESS / FAILED
- **PDF**: paper/main.pdf
- **Pages**: X (main body to Conclusion) + Y (references) + Z (appendix)
- **Within page limit**: YES/NO (MAX_PAGES = N)
- **Errors fixed**: [list of auto-fixed issues]
- **Warnings remaining**: [list of non-critical warnings]
- **Undefined references**: 0
- **Undefined citations**: 0
### Next Steps
- [ ] Visual inspection of PDF
- [ ] Run `/paper-write` to fix any content issues
- [ ] Submit to [venue] via OpenReview / CMT / HotCRP| Venue | Style File | Citation | Page Limit (main body) | Submission |
|---|---|---|---|---|
| ICLR 2026 | | | 9 pages (to Conclusion end) | OpenReview |
| NeurIPS 2025 | | | 9 pages (to Conclusion end) | OpenReview |
| ICML 2025 | | | 8 pages (to Conclusion end) | OpenReview |