Directory macros/latex/contrib/mermin-equations
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.
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:
\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
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
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.
Download the contents of this package in one zip archive (435.7k).
Mermin Equations – Label equations by noun phrases and cite them by phrase
N. David Mermin’s What’s Wrong with These Equations?
asks that every equation be cited by a 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 a numbered
equation, or one line of an align, as many phrase labels
as the prose needs, before or after its \label
or without one; \eq{phrase} cites it by one of them
and prints the phrase followed by the linked number.
A phrase containing mathematics is given once where the
label is defined, \aka[$\Gamma$ action]{Gamma action},
and cited plainly; existing eq: labels need no
change. \eq warns when it cites a section, figure,
or other non-equation.
Two of Mermin’s rules are also checked, with warnings that never stop compilation and that the options nofisher and nosamaritan turn off: Fisher’s rule, number every displayed equation, and the Good Samaritan rule, cite an equation by a phrase as well as a number.
The short names have long forms, \alsolabel and \eqcite, for documents where another package already defines \aka or \eq.
The package supports the amsmath displays, empheq, breqn, the cases package, IEEEtrantools, subeqnarray, and eqnarray; works with hyperref, cleveref, nameref, xr and xr-hyper, beamer, REVTeX, and latexdiff output; and runs under pdfLaTeX, LuaLaTeX, and XeLaTeX.
| Package | Mermin Equations |
| Home page | |
| Bug tracker | |
| Version | 0.1.1 2026-11-18 |
| Licenses | The LaTeX Project Public License 1.3c |
| Copyright | 2026 Evan Berkowitz |
| Maintainer | Evan Berkowitz |
| Topics | Physics Label and References Maths |