**Skill**: [LaTeX Build Automation](../SKILL.md)

## Common Commands

### Build Once

```bash
# PDF output
latexmk -pdf document.tex

# DVI output
latexmk -dvi document.tex

# PostScript output
latexmk -ps document.tex
```

### Clean Build Artifacts

```bash
# Remove auxiliary files (.aux, .log, .synctex.gz, etc.)
latexmk -c

# Also remove PDF output
latexmk -C

# Then rebuild from scratch
latexmk -pdf document.tex
```

### Force Rebuild

```bash
# Force rerun of all tools (bibliography, index, etc.)
latexmk -gg -pdf document.tex
```

### Build with Options

```bash
/usr/bin/env bash << 'COMMON_COMMANDS_SCRIPT_EOF'
# Enable SyncTeX (for Skim integration)
latexmk -pdf -synctex=1 document.tex

# Use LuaLaTeX instead of pdfLaTeX
latexmk -pdflua document.tex

# Use XeLaTeX
latexmk -pdfxe document.tex

# Verbose output for debugging
latexmk -pdf -verbose document.tex
COMMON_COMMANDS_SCRIPT_EOF
```
