# ngspice reference manual (HTML → PDF)

A command-by-command reference for ngspice, written to be easier to navigate than
the official manual: an alphabetical command reference, a concepts/gotchas section,
and an OSDI section — with **every example tested against ngspice-46 and its real
output shown**.

## Contents

| file | what it is |
|------|------------|
| `ngspice_manual.html` | the manual (single self-contained page) |
| `ngspice_manual.css`  | its stylesheet |
| `ngspice_manual.pdf`  | rendered PDF (via wkhtmltopdf) |
| `resort.py`           | re-sorts the §3 command blocks A–Z, regenerates the alpha index, and validates tags/dup-ids/broken anchors |
| `ngspice_command_catalog.txt` | the `cp_coms` interactive-command catalog the reference is checked for completeness against |
| `examples/`           | every worked example (`*.cir`), its data (`*.dat`/`*.inc`), and figure sources (`*.gp` → `*.png`) |
| `user_examples/`      | user-contributed example (two-stage balanced amp) referenced by the `.subckt` entry |

## Structure

1. General netlist & language syntax
2. Key concepts & gotchas (batch vs `.control`, `.spiceinit`, `.meas` vs `meas`, …)
3. Command reference (A–Z) — full `cp_coms` catalog coverage
4. OSDI — compiling behavioral foundry passives into native devices

## Build

```sh
python3 resort.py          # sort §3, rebuild the index, validate
                           # prints: tags OK | dup none | broken none | ref entries N
wkhtmltopdf --enable-local-file-access ngspice_manual.html ngspice_manual.pdf
```

Editing: add a command entry as a `<div class="cmd"><h3 id="…">…</h3>…</div>` block
anywhere before the `<h2 id="osdi">` heading; `resort.py` places it alphabetically and
rebuilds the top index. Keep each example runnable and show its real ngspice-46 output.
