# substnote

Version 0.1.0 (2026-07-30)

Substitution notation with a switchable convention. There is no agreement
on how to write "the result of substituting *t* for *x* in *φ*":
`φ[t/x]`, `φ[x/t]`, `φ[x := t]`, `φ[x ← t]`, `(φ)ˣ_t` all occur, and the
two slash conventions are mirror images of each other. This package
provides one command and lets the convention be chosen once, in the
preamble.

```latex
\usepackage{substnote}              % or [style=updown], etc.
...
\subst{\varphi}{x}{t}               % φ[t/x]  (default)
\subst{\varphi}{x,y}{s,t}           % φ[s/x, t/y]  simultaneous
\subst*{\varphi}{x}{\frac{a}{b}}    % delimiters auto-scale
\substmark{x}{t}                    % the mark alone
\subst[style=updown]{\varphi}{x}{t}           % [φ]^x_t, per-use override
\subst[style=updown,fences=parens]{\varphi}{x}{t}  % (φ)^x_t
```

Mismatched variable and term lists are reported as an error rather than
having the surplus entries discarded.

## Styles

| `style=`     | Output           |
|--------------|------------------|
| `slash`      | φ[t/x] (default) |
| `slashrev`   | φ[x/t]           |
| `assign`     | φ[x ≔ t] (colon centred on the axis) |
| `arrow`      | φ[x ← t]         |
| `mapsto`     | φ[x ↦ t]         |
| `updown`     | [φ]^x_t          |
| `updownrev`  | [φ]^t_x          |

## Other keys

| Key                | Effect                                                  |
|--------------------|---------------------------------------------------------|
| `fences=<name>`    | `brackets` (default), `parens`, `braces`, `none`. Encloses the mark in the delimited styles and the expression in the up-down ones, which are never left undelimited, so `none` is read there as `parens` |
| `pairsep=<code>`   | separator between simultaneous substitutions (def. `,\,`)|
| `synonym=<name>`   | also define `\<name>` and `\<name>mark` (load-time only) |

All keys except `synonym` work both as package options (document-wide
convention) and in the optional argument of each command (per use). An
unknown value for `style` or `fences` is reported at once, together with
the list of what is allowed.

`\substmark` carries no expression, so in the up-down styles it emits the
scripts alone rather than a pair of empty delimiters.

If another package already defines `\subst` or `\substmark`, substnote
leaves the name untouched and tells you to pick a synonym:

```latex
\usepackage[synonym=mysubst]{substnote}
```

## Requirements

A LaTeX kernel from 2022-06-01 or newer. The package loads nothing else.

## Documentation

See [substnote.pdf](substnote.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.
