# setbuilder

Version 0.2.0 (2026-07-28)

Smart set-builder notation for LaTeX: one command instead of
`\left\{ ... \,\middle\vert\, ... \right\}`.

```latex
\usepackage{setbuilder}
...
\set{x \in \mathbb{R} \given x^2 < 2}      % { x ∈ ℝ | x² < 2 }
\set*{\frac{n}{n+1} \given n \in \mathbb{N}}   % braces AND bar auto-scale
\set[\Big]{x \given f(x) = \max_y f(y)}    % fixed size
```

Features:

* correct thin spaces around the separator, which automatically
  **vanish in sub/superscripts** (`\nonscript`);
* a thin space just inside the braces — but only for a set given by a
  condition, `{ x | x > 0 }`, never for a plain enumeration,
  `{1, 2, 3}` (Knuth, TeXbook);
* the separator bar **scales together with the braces** in the starred
  and sized forms;
* line breaks are permitted after the bar in inline formulas;
* `\suchthat` as a synonym of `\given`; both give a descriptive error
  when used outside `\set`.

## Options

| Option           | Effect                                                        |
|------------------|---------------------------------------------------------------|
| `bar` (default)  | separator is a vertical bar: `{ x \| x > 0 }`                 |
| `colon`          | separator is a colon: `{ x : x > 0 }`                         |
| `pad=<mu glue>`  | space inside the braces, default `\,`; `pad=none` disables it |
| `synonym=<name>` | additionally define `\<name>` as a full copy of `\set`        |

If another package already defines `\set`, setbuilder leaves it
untouched and recommends choosing a synonym:

```latex
\usepackage[synonym=mkset]{setbuilder}
```

## Installation

Once on CTAN, the package is available in TeX Live and MiKTeX:
`tlmgr install setbuilder`. For manual installation, copy
`setbuilder.sty` into your project directory or into your personal TeX
tree (`~/texmf/tex/latex/setbuilder/`).

## Requirements

* `mathtools`
* LaTeX kernel 2022-06-01 or newer (key-value options, `\NewCommandCopy`)

## Documentation

See [setbuilder.pdf](setbuilder.pdf) for the full manual with typeset
examples.

## Author

Vseslav Sekorin <vssekorin@gmail.com>

## License

Copyright (c) 2026 Vseslav Sekorin.
This material is subject to the MIT License; see the LICENSE file
for the full text.
