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

## Troubleshooting

### Issue: latexmk Not Found

```bash
# Check installation
which latexmk
# Should show: /Library/TeX/texbin/latexmk

# If not found, ensure MacTeX installed
brew install --cask mactex

# Or add to PATH
export PATH="/Library/TeX/texbin:$PATH"
```

### Issue: PDF Not Auto-Reloading in Skim

**Check Skim preferences:**

1. Skim → Preferences → Sync
1. Check "Check for file changes"
1. Check "Reload automatically"

**Verify SyncTeX enabled:**

```bash
latexmk -pdf -synctex=1 document.tex
# Should create document.synctex.gz
```

### Issue: Build Hangs on Error

```bash
# Use non-interactive mode
latexmk -pdf -interaction=nonstopmode document.tex

# Or in .latexmkrc:
$pdflatex = 'pdflatex -interaction=nonstopmode %O %S';
```

### Issue: Bibliography Not Updating

```bash
# Force rebuild of all dependencies
latexmk -gg -pdf document.tex

# Or clean and rebuild
latexmk -C && latexmk -pdf document.tex
```

### Issue: Compilation Errors Not Showing

```bash
# Use verbose mode
latexmk -pdf -verbose document.tex

# Check log file
less document.log
```

### Issue: Stale Auxiliary Files

```bash
# Clean all build artifacts
latexmk -C

# Rebuild from scratch
latexmk -pdf document.tex
```
