mcpField
L
latex-build

latex-build

github.com/terrylicaDocuments1232 installsUpdated 1d ago
Repository

About latex-build

A skill for compiling and managing LaTeX document builds, intended for writers and developers handling single- or multi-file projects. It centers on latexmk commands for repeat builds, file watching, SyncTeX, and cleanup.

Key features

  1. 01One-time PDF compilation with latexmk
  2. 02Watch mode with automatic rebuilds
  3. 03SyncTeX build options
  4. 04Multi-file dependency handling
  5. 05Build artifact cleanup

Use cases

  1. 01Compile a LaTeX document to PDF
  2. 02Preview edits through automatic rebuilds
  3. 03Clean auxiliary build files

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/terrylica/cc-skills --skill latex-build

After installing, type/latex-buildin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
advanced-patterns.md
common-commands.md
configuration.md
evolution-log.md
multi-file-projects.md
troubleshooting.md

Details

From the project README

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 -synctex=1 flag
  • 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: latexmk -c removes artifacts

Reference Documentation

For detailed information, see:

Official Docs: Run man latexmk or latexmk -help for complete reference

See Also:

  • Use latex/setup skill for installing LaTeX and configuring environment
  • Use latex/tables skill for creating tables with tabularray

Troubleshooting

IssueCauseSolution
latexmk not foundNot in PATHAdd /Library/TeX/texbin to PATH
Undefined control sequenceMissing packageCheck \usepackage statements for required packages
References show ??Need multiple runslatexmk handles this automatically; ensure no errors
Live preview not updatingSkim auto-reload disabledSkim Preferences → Sync → Check for file changes
Build hangsInput prompt in nonstop modeUse -interaction=nonstopmode flag
PDF not updatingBuild error preventing outputCheck .log file for specific error
SyncTeX not workingMissing -synctex=1 flagAdd -synctex=1 to build command
Too many aux filesNormal build artifactsRun latexmk -c to clean (keeps PDF)

Post-Execution Reflection

After this skill completes, check before closing:

  1. Did the command succeed? — If not, fix the instruction or error table that caused the failure.
  2. Did parameters or output change? — If the underlying tool's interface drifted, update Usage examples and Parameters table to match.
  3. 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.

Comments

Markdown supported