$npx -y skills add WILLOSCAR/research-units-pipeline-skills --skill latex-compile-qaCompile a LaTeX project and run basic QA (missing refs, bib errors, broken citations), producing latex/main.pdf and a build report. Trigger: latex compile, build PDF, LaTeX errors, missing refs, 编译PDF, 引用错误. Use when: 已有 latex/main.tex(通常来自 latex-scaffold),需要确认可编译并输
| 1 | # LaTeX Compile + QA |
| 2 | |
| 3 | Compile the LaTeX project and produce a PDF (when the toolchain is available), plus a short build report. |
| 4 | |
| 5 | This step is deterministic; if compilation fails, record actionable diagnostics rather than guessing. |
| 6 | |
| 7 | ## Inputs |
| 8 | |
| 9 | - `latex/main.tex` |
| 10 | - `citations/ref.bib` |
| 11 | |
| 12 | ## Outputs |
| 13 | |
| 14 | - `latex/main.pdf` (if compilation succeeds) |
| 15 | - `output/LATEX_BUILD_REPORT.md` (recommended) |
| 16 | |
| 17 | ## Workflow |
| 18 | |
| 19 | 1. Run a LaTeX build (e.g., `latexmk`) if available. |
| 20 | 2. Fix missing packages, missing bib entries, and unresolved references. |
| 21 | 3. Record remaining issues in a build report. |
| 22 | |
| 23 | ## Quality checklist |
| 24 | |
| 25 | - [ ] `latex/main.pdf` exists only when compilation succeeds; failed builds must remove stale PDFs and explain the failure in `output/LATEX_BUILD_REPORT.md`. |
| 26 | - [ ] For `arxiv-survey-latex` deliverables: `latex/main.pdf` is >= 8 pages and has no undefined citations/references (strict gate). |
| 27 | |
| 28 | ## Script |
| 29 | |
| 30 | ### Quick Start |
| 31 | |
| 32 | - `uv run python .codex/skills/latex-compile-qa/scripts/run.py --help` |
| 33 | - `uv run python .codex/skills/latex-compile-qa/scripts/run.py --workspace <workspace>` |
| 34 | |
| 35 | ### All Options |
| 36 | |
| 37 | - See `--help` (inputs/outputs are taken from the unit runner when used via pipeline) |
| 38 | |
| 39 | ### Examples |
| 40 | |
| 41 | - Compile + produce report: |
| 42 | - `uv run python .codex/skills/latex-compile-qa/scripts/run.py --workspace <workspace>` |
| 43 | |
| 44 | ### Notes |
| 45 | |
| 46 | - Uses `latexmk -xelatex -bibtex` when available. |
| 47 | - Always writes `output/LATEX_BUILD_REPORT.md` (success or failure). |
| 48 | - Report includes page count + warning summary when available. |
| 49 | |
| 50 | ## Troubleshooting |
| 51 | |
| 52 | ### Common Issues |
| 53 | |
| 54 | #### Issue: `latexmk` not found |
| 55 | |
| 56 | **Symptom**: |
| 57 | - Build report says “latexmk not found in PATH”. |
| 58 | |
| 59 | **Causes**: |
| 60 | - LaTeX toolchain is not installed. |
| 61 | |
| 62 | **Solutions**: |
| 63 | - Install a TeX distribution that includes `latexmk`. |
| 64 | - If you can’t install tools, still use `latex-scaffold` to generate `latex/main.tex` and compile elsewhere. |
| 65 | |
| 66 | #### Issue: Build fails with bib/ref errors |
| 67 | |
| 68 | **Symptom**: |
| 69 | - Report shows missing citations/refs or BibTeX errors. |
| 70 | |
| 71 | **Causes**: |
| 72 | - `citations/ref.bib` missing/miswired, or draft contains invalid cite keys. |
| 73 | |
| 74 | **Solutions**: |
| 75 | - Ensure `latex/main.tex` points to `../citations/ref.bib` (or the correct relative path). |
| 76 | - Ensure all citation keys exist in `citations/ref.bib`. |
| 77 | |
| 78 | ### Recovery Checklist |
| 79 | |
| 80 | - [ ] Read `output/LATEX_BUILD_REPORT.md` tail for the first actionable error. |
| 81 | - [ ] Confirm `latex/main.tex` exists and bibliography path is correct. |