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

## Makefile Integration

### Basic Makefile

```makefile
.PHONY: pdf watch clean

pdf:
	latexmk -pdf main.tex

watch:
	latexmk -pvc -pdf main.tex

clean:
	latexmk -c
	rm -f main.pdf

distclean:
	latexmk -C
```

### Usage

```bash
make pdf      # Build once
make watch    # Live preview
make clean    # Remove artifacts
```

______________________________________________________________________

## Configuration (.latexmkrc)

Create `.latexmkrc` in project directory for custom settings:

### Example Configuration

```perl
# Use pdflatex by default
$pdf_mode = 1;

# Use lualatex instead
# $pdf_mode = 4;

# Enable SyncTeX
$pdflatex = 'pdflatex -synctex=1 -interaction=nonstopmode %O %S';

# Set PDF viewer (macOS Skim)
$pdf_previewer = 'open -a Skim';

# Continuous mode delay (seconds)
$sleep_time = 1;

# Clean these extensions
@generated_exts = (@generated_exts, 'synctex.gz');
```

Place in project root, then:

```bash
latexmk -pvc main.tex
# Uses settings from .latexmkrc
```
