# mermin-equations

Tools for writing equations the way N. David Mermin asks in
"What's Wrong with These Equations?", *Physics Today* **42**(10), 9 (1989),
[doi:10.1063/1.2811173](https://doi.org/10.1063/1.2811173).

Version 0.1.1, 2026/11/18.

## Description

Mermin's Good Samaritan rule asks that every equation be cited by a noun
phrase as well as its number: "the anomaly condition (3)", never a bare
"(3)". This package makes the phrase the label. `\aka{phrase}` ("also
known as") gives an equation, or one line of an `align`, as many phrases as
the prose needs,
and `\eq{phrase}` cites it by one of them, printing the phrase and the
linked number:

```latex
\usepackage{mermin-equations}
...
\begin{equation}
  L_1^2+L_2^2=R_1^2+R_2^2.
  \label{anomaly condition}
  \aka{Pythagorean condition}
\end{equation}
The 3450 model satisfies the \eq{anomaly condition}.
Read as a statement about integers, the same line is
the \eq{Pythagorean condition}.
```

prints "the anomaly condition (1)" and "the Pythagorean condition (1)".

`\aka` may come before or after `\label`, any number of times, or
replace it entirely. Every key gets the line's number and hyperref anchor,
and `\ref`, `\eqref`, `\pageref`, and `\cref` all work. It supports the
amsmath displays (`equation`, `align`, `gather`, `multline`, `split`,
`subequations`), `empheq`, breqn, the cases package, IEEEtrantools'
`IEEEeqnarray`, subeqnarray, and `eqnarray`, with hyperref and cleveref loaded before
or after it (cleveref, as always, after amsmath), and works with xr and
xr-hyper. `\label` itself is unchanged.

`\eq{phrase}` falls back to the label `eq:phrase`, so existing `eq:` labels
need no change. A phrase that cannot be a key, such as one with math, is
given once where the label is defined, `\aka[$\Gamma$ action]{Gamma action}`,
and cited as `\eq{Gamma action}`, which prints "Γ action (n)". `\eq` is for
equations only and warns when its key names a section, figure, or anything
else.

Two of Mermin's rules are checked, with warnings that never stop
compilation. Fisher's rule, "number all displayed equations", warns at a
display with no number (a derivation numbered once on its last line counts
as numbered). The Good Samaritan rule, "identify [an equation] by a phrase
as well as a number", warns when `\eqref` or `\cref` cites an equation
by number alone. `\usepackage[nofisher,nosamaritan]{mermin-equations}` turns them
off.

Short names are easily taken. `\alsolabel` and `\eqcite` are the same
commands as `\aka` and `\eq` under names no other package uses. When a
package such as nccmath, or the preamble, already defines `\eq` or `\aka`,
the package leaves it alone, warns, and the long name does the job.

The full documentation, including Mermin's three rules and the
annotated implementation, is `mermin-equations.pdf`.

## Files

| File                   | Contents                                                 |
|------------------------|----------------------------------------------------------|
| `mermin-equations.dtx` | Documented source: user manual and implementation        |
| `mermin-equations.ins` | Installer: generates `mermin-equations.sty`              |
| `mermin-equations.sty` | The package, generated by `tex mermin-equations.ins`     |
| `mermin-equations.pdf` | The manual, typeset from `mermin-equations.dtx`          |
| `test/`                | Test suite (in the repository only)                      |

## Installation

```sh
tex mermin-equations.ins   # generates mermin-equations.sty
```

Then copy `mermin-equations.sty` to
`$(kpsewhich -var-value TEXMFHOME)/tex/latex/mermin-equations/`, or next to
the paper that uses it. To typeset the manual, run
`pdflatex mermin-equations.dtx` twice. In a clone of the repository, `make`
does both and builds the index, and a paper's build can use the clone directly with
`TEXINPUTS=/path/to/mermin:`.

Requires a LaTeX format from 2021-11-15 or later. Loads amsmath.

### arXiv

arXiv compiles papers with its own fixed TeX Live installations (2025 by
default, 2023 on request), which do not receive new or updated packages.
Upload `mermin-equations.sty` alongside your `.tex` files.

## Testing

```sh
make test                    # or ENGINE=lualatex, ENGINE=xelatex
```

typesets every supported environment, with the keys before, after, and
instead of `\label`, in four package configurations (amsmath alone; with
hyperref; with hyperref and cleveref; and with the package loaded first), and
checks that every key in each
`.aux` file resolves to its line's number and anchor. It also checks the
text `\eq` prints, for phrase keys, `eq:` keys, typeset phrases given to
`\aka`, and non-ASCII phrases. Finally, it checks that `\eq` warns
exactly when it cites something other than an equation, and that
`\eqcite` and `\alsolabel` take over when `\eq` or `\aka` is already
taken. GitHub Actions runs the suite with pdfLaTeX, LuaLaTeX, and XeLaTeX
on the current TeX Live; with pdfLaTeX on TeX Live
2023 and 2025, the versions arXiv uses; and with pdfLaTeX on TeX Live 2021,
the oldest supported LaTeX.

## Development

The source, test suite, and issue tracker are at
<https://github.com/evanberkowitz/mermin>.

## License

Copyright (C) 2026 Evan Berkowitz.

This work may be distributed and/or modified under the conditions of the
LaTeX Project Public License, version 1.3c or later
(<https://www.latex-project.org/lppl.txt>), which is part of all
distributions of LaTeX from 2008 on. It has the LPPL maintenance
status "maintained"; the Current Maintainer is Evan Berkowitz.
