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

## Advanced Patterns

### Parallel Builds (Multiple Documents)

```bash
# Build all .tex files in directory
latexmk -pdf *.tex

# Watch multiple documents
latexmk -pvc -pdf doc1.tex doc2.tex doc3.tex
```

### Custom Build Script

```bash
#!/bin/bash
# build.sh - Custom LaTeX build script

set -e  # Exit on error

echo "Cleaning old build..."
latexmk -C

echo "Building document..."
latexmk -pdf -synctex=1 main.tex

echo "Build complete: main.pdf"
ls -lh main.pdf
```

### CI/CD Integration

```bash
# Headless build for CI (no viewer)
latexmk -pdf -interaction=nonstopmode -view=none document.tex

# Check exit code
if [ $? -eq 0 ]; then
  echo "Build successful"
else
  echo "Build failed"
  exit 1
fi
```
