Cc-skills latex-build
LaTeX builds with latexmk and live preview. TRIGGERS - latexmk, LaTeX build, live preview, compilation.
install
source · Clone the upstream repo
git clone https://github.com/terrylica/cc-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/terrylica/cc-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/plugins/doc-tools/skills/latex-build" ~/.claude/skills/terrylica-cc-skills-latex-build && rm -rf "$T"
manifest:
plugins/doc-tools/skills/latex-build/SKILL.mdsource content
LaTeX Build Automation
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
When to Use This Skill
Use this skill when:
- Compiling LaTeX documents
- Setting up live preview with auto-rebuild
- Managing multi-file projects
- Troubleshooting build failures
- Cleaning build artifacts
- Automating compilation workflows
Quick Reference
Why latexmk?
Industry standard build tool:
- Auto-detects dependencies (bibliography, index, etc.)
- Runs correct number of times (handles cross-references)
- Live preview mode watches for file changes
- Works with Skim for SyncTeX auto-reload
- Bundled with MacTeX (no separate install needed)
Basic Usage
One-Time Build
latexmk -pdf document.tex # Result: document.pdf created
Live Preview (Watch Mode)
latexmk -pvc -pdf document.tex # What happens: # - Compiles document initially # - Watches for file changes # - Auto-recompiles when files change # - Auto-reloads PDF in Skim viewer
Stop watching: Press
Ctrl+C
Quick Reference Card
# Build once latexmk -pdf document.tex # Live preview (watch mode) latexmk -pvc -pdf document.tex # Build with SyncTeX latexmk -pdf -synctex=1 document.tex # Clean artifacts latexmk -c # Keep PDF latexmk -C # Remove PDF too # Force rebuild latexmk -gg -pdf document.tex # Non-interactive (for CI) latexmk -pdf -interaction=nonstopmode document.tex
Build Checklist
- Verify latexmk installed:
which latexmk - Test basic build:
latexmk -pdf document.tex - Enable SyncTeX: Add
flag-synctex=1 - Test live preview:
latexmk -pvc -pdf document.tex - Configure Skim for auto-reload
- Create Makefile for common tasks (optional)
- Create .latexmkrc for project-specific settings (optional)
- Test clean:
removes artifactslatexmk -c
Reference Documentation
For detailed information, see:
- Common Commands - Build options and output formats
- Multi-File Projects - Automatic dependency tracking for complex documents
- Configuration - .latexmkrc and Makefile integration
- Troubleshooting - Common build issues and solutions
- Advanced Patterns - Parallel builds and CI/CD integration
Official Docs: Run
man latexmk or latexmk -help for complete reference
See Also:
- Use
skill for installing LaTeX and configuring environmentlatex/setup - Use
skill for creating tables with tabularraylatex/tables
Troubleshooting
| Issue | Cause | Solution |
|---|---|---|
| latexmk not found | Not in PATH | Add to PATH |
| Undefined control sequence | Missing package | Check statements for required packages |
| References show ?? | Need multiple runs | latexmk handles this automatically; ensure no errors |
| Live preview not updating | Skim auto-reload disabled | Skim Preferences → Sync → Check for file changes |
| Build hangs | Input prompt in nonstop mode | Use flag |
| PDF not updating | Build error preventing output | Check .log file for specific error |
| SyncTeX not working | Missing -synctex=1 flag | Add to build command |
| Too many aux files | Normal build artifacts | Run to clean (keeps PDF) |
Post-Execution Reflection
After this skill completes, check before closing:
- Did the command succeed? — If not, fix the instruction or error table that caused the failure.
- Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
- Was a workaround needed? — If you had to improvise (different flags, extra steps), update this SKILL.md so the next invocation doesn't need the same workaround.
Only update if the issue is real and reproducible — not speculative.