Skip to content
Back to skills

Latex Build

ASecurity

LaTeX builds with latexmk and live preview. TRIGGERS - latexmk, LaTeX build, live preview, compilation.

  • 75 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added February 7, 2026
toolsbashci/cddocumentation

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned February 12, 2026

npx -y skills add terrylica/cc-skills --skill latex-build --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Latex Build?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Latex Build
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/terrylica-latex-build/badge)](https://www.skillsdirectory.com/skills/terrylica-latex-build)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: latex-build
description: LaTeX builds with latexmk and live preview. TRIGGERS - latexmk, LaTeX build, live preview, compilation.
allowed-tools: Read, Edit, Bash
---

# LaTeX Build Automation

## 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

```bash
latexmk -pdf document.tex
# Result: document.pdf created
```

### Live Preview (Watch Mode)

```bash
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

```bash
# 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:

- [Common Commands](./references/common-commands.md) - Build options and output formats
- [Multi-File Projects](./references/multi-file-projects.md) - Automatic dependency tracking for complex documents
- [Configuration](./references/configuration.md) - .latexmkrc and Makefile integration
- [Troubleshooting](./references/troubleshooting.md) - Common build issues and solutions
- [Advanced Patterns](./references/advanced-patterns.md) - Parallel builds and CI/CD integration

**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

| Issue                      | Cause                         | Solution                                             |
| -------------------------- | ----------------------------- | ---------------------------------------------------- |
| latexmk not found          | Not in PATH                   | Add `/Library/TeX/texbin` to PATH                    |
| Undefined control sequence | Missing package               | Check `\usepackage` 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 `-interaction=nonstopmode` flag                  |
| PDF not updating           | Build error preventing output | Check .log file for specific error                   |
| SyncTeX not working        | Missing -synctex=1 flag       | Add `-synctex=1` to build command                    |
| Too many aux files         | Normal build artifacts        | Run `latexmk -c` to clean (keeps PDF)                |

Files in this skill

  • SKILL.md3.9 KB
  • references/advanced-patterns.md760 B
  • references/common-commands.md906 B
  • references/configuration.md1 KB
  • references/multi-file-projects.md846 B
  • references/troubleshooting.md1.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.