%%
%% This is file `eqnlines.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% eqnlines.dtx  (with options: `manual')
%% 
%% Copyright (C) 2024-2026 Niklas Beisert
%% 
%% Based on the latex package amsmath:
%% Copyright (C) 1995, 2000, 2013 American Mathematical Society.
%% Copyright (C) 2016-2024 LaTeX Project and American Mathematical Society.
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   https://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008 or later.
%% 
\ProvidesFile{eqnlines.tex}[2026-03-23 v1.0.1 eqnlines reference manual]
\def\thepkg/{eqnlines}\def\thedate/{2026-03-23}\def\theversion/{v1.0.1}
\def\thecopyright/{2024\texorpdfstring{--}{-}2026 Niklas Beisert}
\PassOptionsToClass{10pt,a4paper}{article}
\documentclass{ltxdoc}

\usepackage[margin=35mm]{geometry}
\usepackage[hyperindex=false]{hyperref}
\usepackage{hyperxmp}
\usepackage[usenames]{color}
\usepackage{longtable}

\title{The \markpkg{\thepkg/} Package\\Reference Manual}
\hypersetup{pdftitle={The \thepkg/ Package -- Reference Manual}}
\hypersetup{pdfsubject={Reference Manual for the LaTeX2e Package \thepkg/}}
\author{Niklas Beisert\\[2ex]
  Institut f\"ur Theoretische Physik\\
  Eidgen\"ossische Technische Hochschule Z\"urich\\
  Wolfgang-Pauli-Strasse 27, 8093 Z\"urich, Switzerland\\[1ex]
  \href{mailto:nbeisert@itp.phys.ethz.ch}
  {\texttt{nbeisert@itp.phys.ethz.ch}}}
\hypersetup{pdfauthor={Niklas Beisert}}
\date{\theversion/: \markdate{\thedate/}\\[1ex]
\url{https://ctan.org/pkg/\thepkg/}\\[0.5ex]
\url{https://github.com/nbeisert/latex-pkg-nb}}

\hypersetup{pdflang={en-UK}}
\hypersetup{pdfurl={https://ctan.org/pkg/\thepkg/}}
\hypersetup{pdfcopyright={Copyright \thecopyright/.
  This work may be distributed and/or modified under the
  conditions of the LaTeX Project Public License, either version 1.3
  of this license or (at your option) any later version.}}
\hypersetup{pdflicenseurl={https://www.latex-project.org/lppl.txt}}
\hypersetup{pdfcontactaddress={ETH Zurich, ITP, HIT K,
  Wolfgang-Pauli-Strasse 27}}
\hypersetup{pdfcontactpostcode={8093}}
\hypersetup{pdfcontactcity={Zurich}}
\hypersetup{pdfcontactcountry={Switzerland}}
\hypersetup{pdfcontactemail={nbeisert@itp.phys.ethz.ch}}
\hypersetup{pdfcontacturl={https://people.phys.ethz.ch/\xmptilde nbeisert/}}

\hypersetup{keeppdfinfo=true}
\hypersetup{pdfsource={}}
\AddToHook{begindocument/before}{\hypersetup{colorlinks=false}}
\hypersetup{urlbordercolor={.5 1 1}}
\hypersetup{linkbordercolor={1 .7 .7}}
\AddToHook{begindocument/before}{\hypersetup{pdfstartview=FitH}}

\parskip1ex
\parindent0pt
\edef\itemize{\unexpanded\expandafter{\itemize}\parskip0pt}

\newcommand{\markpkg}[1]{\textsf{#1}}
\newcommand{\markdate}[1]{\textsf{#1}}
\newcommand{\secref}[1]{\hyperref[#1]{section \ref*{#1}}}
\newcommand{\ctanref}[2]{\href{https://ctan.org/#1}{#2}}
\newcommand{\ctanpkg}[1]{\ctanref{pkg/#1}{\markpkg{#1}}}

\def\verbbar{\texttt{\char"7C}}
\def\verbpkg{\texttt{\thepkg/}}
\def\thepkgctan/{\ctanpkg{\thepkg/}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RenewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = ,
  idxgroup = LaTeX commands\actualchar\latex/ commands ,
  printtype =
  ]{Macro}{macro}
\RenewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = env. ,
  idxgroup = Package environments,
  printtype = \textit{env.}
  ]{Env}{environment}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = ,
  idxgroup = Package commands,
  printtype =
  ]{InterfaceMacro}{imacro}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = ,
  idxgroup = Package commands (obsolete),
  printtype =
  ]{ObsoleteInterfaceMacro}{omacro}
\NewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = key ,
  idxgroup = Package keys ,
  printtype = \textit{key}
  ]{Key}{key}
\NewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = mod ,
  idxgroup = Command modifiers ,
  printtype = \textit{mod.}
  ]{Mod}{modifier}
\NewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = ctrl ,
  idxgroup = Control key ,
  printtype = \textit{ctrl.}
  ]{Control}{controlkey}
\NewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = setup ,
  idxgroup = Setup key ,
  printtype = \textit{setup}
  ]{Setup}{setupkey}
\NewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = opt ,
  idxgroup = Option key ,
  printtype = \textit{opt.}
  ]{Option}{optionkey}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = counter ,
  idxgroup = TeX counters\actualchar \protect\tex/ counters ,
  printtype = \textit{counter}
  ]{TeXCounter}{tcounter}
\NewDocElement[macrolike = false ,
  toplevel = false,
  idxtype = counter ,
  idxgroup = LaTeX counters\actualchar \latex/ counters ,
  printtype = \textit{counter}
  ]{LaTeXCounter}{lcounter}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = skip ,
  idxgroup = LaTeX length\actualchar \latex/ length (skip) ,
  printtype = \textit{skip}
  ]{LaTeXSkip}{lskip}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = dimen ,
  idxgroup = LaTeX length\actualchar \latex/ length (dimen) ,
  printtype = \textit{dimen}
  ]{LaTeXDimen}{ldimen}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = box ,
  idxgroup = LaTeX box\actualchar \latex/ box ,
  printtype = \textit{box}
  ]{LaTeXBox}{lbox}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = bool ,
  idxgroup = eqnlines bool\actualchar eqnlines bool ,
  printtype = \textit{bool}
  ]{eqnlinesBool}{ebool}
\NewDocElement[macrolike = true ,
  toplevel = false,
  idxtype = bool ,
  idxgroup = LaTeX conditional\actualchar \latex/ conditional ,
  printtype = \textit{bool}
  ]{LaTeXConditional}{lcond}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\usepackage{verbatim}
\makeatletter
\def\example@addline#1{%
  \g@addto@macro\example@dbuf{#1 }%
  \g@addto@macro\example@pbuf{\item|#1|}}
\def\scanexample{%
  \gdef\example@dbuf{}%
  \gdef\example@pbuf{}%
  \begingroup
  \@bsphack
  \let\do\@makeother\dospecials
  \catcode`\^^M\active
  \def\verbatim@processline{\expandafter\example@addline\expandafter%
    {\the\verbatim@line}}%
  \verbatim@start}
\def\endscanexample{\@esphack\endgroup\ignorespacesafterend}
\def\printexample{\begingroup
  \topsep\z@skip\parsep\z@skip\itemsep\z@skip\partopsep\z@skip\parskip\z@skip
  \trivlist
  \expandafter\scantokens\expandafter{\example@pbuf}%
  \endtrivlist
  \endgroup}
\def\doexample{\expandafter\scantokens\expandafter{\example@dbuf}}
\newcommand{\showexampleh}[1][0.5]{\par%
  \parbox{\dimexpr#1\textwidth\relax}{\printexample}%
  \parbox{\dimexpr\textwidth-#1\textwidth\relax}{\doexample}%
  \par\medskip\ignorespaces}
\newcommand{\showexamplev}{%
  \printexample
  \par\medskip
  \parbox{\textwidth}{\doexample}%
  \par\medskip\ignorespaces}
\newenvironment{example}
  {\parskip\z@skip\par\medskip\hrule\medskip}
  {\par\hrule\par\medskip}
\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\TODO}{\textbf{\textcolor{red}{TODO:}} }

\def\tex/{\TeX}
\def\latex/{\LaTeX}
\def\amsmath/{\ctanpkg{amsmath}}

\usepackage{eqnlines}
\eqnlinesset{belowtopmode=top,belowtopskip=0pt}
\def\pstrut{\vphantom{(}}
\def\bstrut{\vphantom{b}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\maketitle

\begin{abstract}\noindent
\markpkg{eqnlines} is a \LaTeXe{} package providing
a framework for typesetting single- and multi-line equations
which extends the established equation environments
of \latex/ and the \markpkg{amsmath} package
with many options for convenient adjustment of the intended layout.
In particular, the package adds flexible schemes for numbering,
horizontal alignment and semi-automatic punctuation, and it improves
upon the horizontal and vertical spacing options. The extensions can
be used and adjusted through optional arguments and modifiers to the
equation environments as well as global settings.
\end{abstract}

\begingroup
\parskip0ex
\tableofcontents
\endgroup

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}

Typesetting mathematical equations is an undisputed strength of \tex/.
\latex/ improved the overall management of display equations,
for instance by providing optional numbering.
It also added elementary functionality for multi-line equations
with alignment. Some of its deficiencies were addressed by
the multi-line equation environments of the package \amsmath/
which have become an established standard for these purposes.

The package \ctanpkg{eqnlines} builds upon and extends
the functionality of the \latex/ and \amsmath/
equation environments with some new features
as well as convenient options to adjust the layout where needed.
The main additions are as follows:
\begin{itemize}
\item
Equation numbers can be assigned to individual lines
(as for |align| and |gather|)
or once for the multi-line equation block
(as for |multline|).
In the former case,
a sub-numbering scheme can be applied (as through |subequations|).
In the latter case, the position can be assigned to a specific line
(first/middle/last/chosen).
Moreover, equation numbers can be turned on and off by commands,
and they can be triggered by setting a label.
\item
The vertical spacing above and below single- and multi-line equations
of \latex/ and \amsmath/ can be somewhat variable,
hard to control and even resistive in certain situations.
The package implements clearer structures controlling the vertical spacing,
including proper dependency on the text line above
and ways to adjust the spacing.
\item
The framework introduces a scheme which semi-automatically inserts punctuation,
e.g.\ `.' or `,', at the end of the following (or every) equation environment.
Punctuation can also be inserted at every alignment column or equation line
including the possibility to prepend a certain spacing.
\item
Next to |\[|\,\ldots|\]| as an alias for the single-line |equation| environment,
the package uses |\<|\,\ldots|\>| as an alias multi-line equations.
\item
The horizontal alignment and indentation of equation lines
can be adjusted via a scheme or on a line-by-line basis.
\item
The alignment marker can be placed
before or after the equation signs while maintaining proper spacing
to symbols before and after it.
This simplifies the construction of continuing equations
in an aligned context.
\item
Equation lines are subject to shrinking of space
if the available space does not suffice
(analogously to single-line equations).
\item
Most settings can be controlled via optional arguments and modifiers to the
equation environment or via global settings.
This includes switching between different types of equation environments,
enabling or disabling numbering, adjusting vertical spacing, etc.
This feature simplifies the adjustment and fine-tuning of equations
towards the intended layout.
\item
Last but not least, the underlying \amsmath/ code,
originating from the \tex/ era and early \latex/ years,
has been redesigned with emphasis
on clarity, readability, adjustability and maintainability
(but at the cost of moderately higher resource consumption
and moderately lower efficiency).
Nevertheless, it remains original \LaTeXe{} code
without using the \markpkg{expl3} layer.
\end{itemize}

The package represents a stand-alone implementation
of an equations environment
which is largely compatible with the established \latex/ and \amsmath/
environments |equation|, |multline|, |gather|, |align|
and their variants.
Hence, the package can be used instead of \amsmath/
with no or minor modifications to the \latex/ sources for
single- and multi-line equations.
It can also be used alongside \amsmath/
including the \ctanpkg{mathtools} extensions
to make use of the additional maths typesetting features
provided by these packages.
In the latter case,
the equation environments of \latex/ and \amsmath/
are either replaced or left in place while the \ctanpkg{eqnlines}
environments can be accessed using the alternate name |equations|.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Usage}
\label{sec:usage}

To use the \ctanpkg{eqnlines} package add the command
\begin{center}
|\usepackage{eqnlines}|
\end{center}
to the preamble of the \latex/ document.
To use unrelated features of the \amsmath/ package
or of the \ctanpkg{mathtools} extension,
it makes sense to load these packages \emph{before} \ctanpkg{eqnlines}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Equations Environment}
\label{sec:equations}

The package provides the principal environment |equations|:
\begin{center}
\begin{tabular}{l}
|\begin{equations}[|\textit{opts}|]|
\\
\textit{math content}
\\
|\end{equations}|
\end{tabular}
\end{center}
It combines and generalises the \latex/ environments
|displaymath| and |equation|
with the \amsmath/ environments |multline|, |gather| and |align|
to display \textit{math content} consisting of single or multiple
equation lines and/or columns.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Options.}

\DescribeEnv{equations}
The environment |equations|
accepts a comma-separated list of optional parameters \textit{opts}
to adjust the math content display in various ways
or to invoke special features.
Note that the combination `|[|\textit{opts}|]|'
must follow |{equations}| immediately without whitespaces.

\DescribeInterfaceMacro{\eqnlinesset}
Most options, but not all, can be set permanently by the macro:
\begin{center}
|\eqnlinesset{|\textit{opts}|}|
\end{center}
\DescribeInterfaceMacro{\eqnaddopt}
Options for the following equations block only are set by the macro:
\begin{center}
|\eqnaddopt{|\textit{opts}|}|
\end{center}
\DescribeInterfaceMacro{\eqncontrol}
Some options can be controlled
for individual lines or cells within the equations block by the macro:
\begin{center}
|\eqncontrol{|\textit{ctrls}|}|
\end{center}
The |\eqncontrol| interface also provides several features
for which no other macro definitions exist.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Modes of Operation.}

The main maths environment |equations|
has three principal modes of operation.
It can display a single-line equation
just as the \latex/ environments |equation| or |displaymath|:
\[*
\framebox[8cm]{\pstrut single line}
\]
It can display a stack of equations
analogous to the \amsmath/ environments |gather| and |multline|:
\unskip\footnote{Arguably, a single-line equation is
just a stack of equations of height 1.
Nevertheless, there is a single-line mode
which prohibits line breaks and which works slightly more efficiently:
For example, the multi-line modes will process the input
twice which is not needed for the single-line mode.
Apart from that, the package takes care that the layout and spacing
of single-line equations and multi-line equations consisting of a single line
is the same.}
\<=*[pad]
\framebox[4cm]{\pstrut stacked line 1}
\\
\framebox[7cm]{\pstrut stacked line 2}
\\
\framebox[5cm]{\pstrut stacked line 3}
\\
\shoveright\framebox[5cm]{\pstrut stacked line 4}
\>
It can also display one or several columns of aligned equations
analogous to the \amsmath/ environment family |align|:
\<*
\framebox[1.0cm]{\pstrut 1a-L}\hskip-0.5pt&\framebox[3.0cm]{\pstrut 1a-R}
&
\framebox[1.5cm]{\pstrut 1b-L}\hskip-0.5pt&\framebox[3.5cm]{\pstrut 1b-R}
\\
\framebox[2.5cm]{\pstrut 2a-L}\hskip-0.5pt&\framebox[4.5cm]{\pstrut 2a-R}
&
&\framebox[2cm]{\pstrut 2b-R}
\\
&\framebox[4cm]{\pstrut 3a-R}
\>

\DescribeOption{single}
\DescribeOption{lines}
\DescribeOption{columns}
The three modes of operation
are selected by setting an optional argument as follows:
\begin{center}
\begin{tabular}{llll}
purpose & single-line equation & stacked equation(s) & aligned equations \\
\hline
name & |single| & |lines| & |columns| \\
alt.\ names & |equation|, |eq|, |1|
            & |gather|, |ga|, |ln|
            & |align|, |al|, |col| \\
symbolic   & |\[|\textvisiblespace\,\ldots|\]|\textvisiblespace
           & |\<=|\textvisiblespace\,\ldots|\>|\textvisiblespace
           & |\<|\textvisiblespace\,\ldots|\>|\textvisiblespace \\
\amsmath/ env. & |equation| & |gather|, |multline| & |align| \\
\hline
columns & --- & single & multiple, aligned \\
alignment & adjustable & adjustable & alternating right/left \\
parsing & single, direct & two passes & two passes \\
numbering & on/off & off/single/multiple & off/single/multiple \\
\end{tabular}
\end{center}
The aligned mode more or less encompasses all three modes,
and the stacked mode with only a single line
is more or less just a single equation.
However, the more complex forms also come along with some restrictions,
hence, it makes sense to use the appropriate mode
for the intended equation content.
For instance, a single equation simply reads the equation input once,
while the multi-line equation environments parse the environment body twice
which can potentially disrupt some other functionality
that is included in the body.
Furthermore, the horizontal adjustment options are very restricted
in aligned mode, and therefore the aligned form can automatically reduce
to the stacked form (with right alignment) if only a single column is provided
(no `|&|'s).

\begin{example}
\begin{scanexample}
\begin{equations}[single]
x=\cos\phi
\end{equations}
\end{scanexample}
\showexampleh
\begin{scanexample}
\begin{equations}[lines]
x=\cos\phi \\ \phi=\arccos x
\end{equations}
\end{scanexample}
\showexampleh
\begin{scanexample}
\begin{equations}[columns]
x&=\cos\phi & \phi&=\arccos x \\
 &=(z+z^{-1})/2 & &=-i\log z
\end{equations}
\end{scanexample}
\showexampleh
\end{example}

\DescribeInterfaceMacro{\\}
\DescribeInterfaceMacro{&}
As usual, lines are separated by `|\\|[|*|]|[|\textit{skip}|]|'
and columns by `|&|'.
The optional argument |[|\textit{skip}|]| to `|\\|' introduces
additional glue between the lines;
the modifier `|*|' inhibits a page break.
\DescribeInterfaceMacro{\&}
Furthermore, the package overloads the combination `|\&|'
to describe a column break
It may be used to distinguish
the beginning of a new column (second of a pair of `|&|')
from the alignment within a column (first of a pair of `|&|').
In particular, it will always skip to the left cell of the next column,
even if no alignment has been specified;
for example, a sequence of `|\&|'
can be used to describe some blank columns
(with half as many `|&|' required).
The syntax of the line and column breaks `|\\|' and `|\&|'
is expanded in the symbolic notation described below
to conveniently describe equation relations
and adjustments to numbering and punctuation.

\DescribeInterfaceMacro{\&/}
\DescribeSetup{amp}
Note that the original \latex/ definition `|\&|' for the
ampersand character `\&' must be escaped as `|\&/|'
within the \ctanpkg{eqnlines} equations blocks.
The overloading of `|\&|' can be inhibited by the
global option |amp=off|.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Abbreviated Symbolic Notation.}

\DescribeInterfaceMacro{\[...\string\]}
\DescribeInterfaceMacro{\<...\string\>}
The package offers an abbreviated symbolic notation
extending the \latex/ display equation structure |\[|\,\ldots|\]|
as well as a variant |\<|\,\ldots|\>| dedicated to multi-line equations:
\begin{center}
\begin{tabular}[c]{l}
|\[|\textit{mod}\texttt{\textvisiblespace}
\\
\textit{math line}
\\
|\]|\textit{mod}\texttt{\textvisiblespace}
\end{tabular}
\qquad\qquad
\begin{tabular}[c]{l}
|\<|\textit{mod}\texttt{\textvisiblespace}
\\
\textit{math line}\ |\\|\textit{mod}\texttt{\textvisiblespace}
\\
\textit{math line}\ |\\|\textit{mod}\texttt{\textvisiblespace}
\\
\ldots
\\
\textit{math line}
\\
|\>|\textit{mod}\texttt{\textvisiblespace}
\end{tabular}
\end{center}
This symbolic notation accepts a sequence of modifiers \textit{mod}
(analogous to the star modifier `|*|' for many other \latex/ macros)
acting as shortcuts for particular options.
There can be any number of modifiers and they can be specified in any order.
\DescribeMod{[...]}
In most cases, a square bracket construct `|[|\ldots|]|'
can act as a modifier to specify optional arguments or some dimension.
Modifiers can be applied to the opening statements and closing statements
(|\[|, |\]|, |\<|, |\>|) as well as the line and column breaks (|\\|, |\&|).
Each symbolic command has an associated set of applicable modifiers
depending on its context.

Note that modifiers \textit{mod} must immediately follow
the symbolic macros without intermediary whitespaces (space, tab, new line).
The sequence of modifiers (even if empty)
should be terminated by a whitespace character
(`\texttt{\textvisiblespace}' in the above syntax)
which marks a clear separation from following math content.
Any character or token without a proper meaning in the respective context
will also terminate the modifier scanning
(while producing a warning message).
Future versions of the package may extend the syntax of modifiers,
and thus a separation by whitespace is strongly advertised.

\DescribeMod{[...]}
\DescribeMod{-}
\DescribeMod{=}
\DescribeMod{\verbbar}
The opening statements admit a large collection of modifiers
which are introduced in their proper context.
All optional arguments \textit{opts}
can be specified directly using square brackets `|[|\textit{opts}|]|',
and the three modes have dedicated selectors `|-|', `|=|' and `\verbbar':
\begin{center}
\begin{tabular}{cccc}
\textit{mod} & corresponding option & description
\\\hline
|[|\textit{opts}|]| & \textit{opts} & specify options \\
|-| & |single| & single-line mode \\
|=| & |lines| & lines mode \\
\verbbar & |columns| & columns mode \\
\end{tabular}
\end{center}
When a mode is selected explicitly,
the choice of |\[|\,\ldots|\]| vs.\ |\<|\,\ldots|\>| does not matter.
Hence it is easy to switch between the modes,
but it makes good sense to distinguish
between the single-line and multi-line modes
via the symbolic form.

\DescribeMod{[...]}
\DescribeMod{*}
The modifiers for line breaks and closing statements will be discussed later.
For example,
the modifier `|*|' for the line break `|\\|' inhibits a page break
and `|[|\textit{skip}|]|' introduces additional glue between the lines.

\begin{example}
\begin{scanexample}
\[
x=\cos\phi
\]
\end{scanexample}
\showexampleh
\begin{scanexample}
\<=
x=\cos\phi \\[0.5ex] \phi=\arccos x
\>
\end{scanexample}
\showexampleh
\begin{scanexample}
\<
x&=\cos\phi & \phi&=\arccos x \\
 &=(z+z^{-1})/2 & &=-i\log z
\>
\end{scanexample}
\showexampleh
\begin{scanexample}
\eqnlinesset{sqropt={nonumber}}
\[ x=\cos\phi \]
\end{scanexample}
\showexampleh
\end{example}

\DescribeKey{modifier...}
Note that modifiers are disabled by default
for the |equations| environment (and its derivatives).
They can be enabled by the global setting |modifiereqnenv|.
Similar global settings to control the scanning of modifiers
exist for the symbolic forms as well as for breaks and ends.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Alternative and Custom Environments.}

\DescribeEnv{displaymath}
\DescribeEnv{equation}
\DescribeEnv{gather}
\DescribeEnv{multline}
\DescribeEnv{align}
The package also supplies or overwrites the \amsmath/
environments |equation|, |gather|, |multline|, |align| and |flalign|
including their |x|-, -|at| and starred variants
(but not the |split| construction).
Hence, documents designed for the \amsmath/ framework
can be translated to the \ctanpkg{eqnlines} framework
with little or no adjustments.
\DescribeKey{defaults}
Some layout choices may turn out slightly different in
the default package settings (|defaults=eqnlines|).
For a closer imitation of the classic \latex//\amsmath/ layout,
one may specify the global option |defaults=classic|;
this also disables most of the advanced notation
involving `|\\|', `|\&|' and modifiers.

It is possible to define further equation environments \textit{env}
with a predefined set of options \textit{opts} using:
\begin{center}
|\|[|re|]|newenvironment{|\textit{env}|}|%
|{\eqnaddopt{|\textit{opts}|}\equations}{\endequations}|
\end{center}
Shortcuts to frequently used control features could be installed by
user definitions such as:
\begin{center}
|\newcommand{\|\textit{shortcut}|}[1]{\eqncontrol{|\textit{key}|={#1}}}|
\end{center}
\DescribeSetup{sqropt}
\DescribeSetup{angopt}
The two short forms |\[|\,\ldots|\]| and |\<|\,\ldots|\>| can be customised
by setting default arguments via the global options
|sqropt={|\textit{opts}|}| and |angopt={|\textit{opts}|}|.

\begin{example}
\begin{scanexample}
\begin{equation}
x=\cos\phi
\end{equation}
\end{scanexample}
\showexampleh
\begin{scanexample}
\begin{gather}
x=\cos\phi \\ \phi=\arccos x
\end{gather}
\end{scanexample}
\showexampleh
\begin{scanexample}
\begin{align}
x&=\cos\phi & \phi&=\arccos x \\
 &=(z+z^{-1})/2 & &=-i\log z
\end{align}
\end{scanexample}
\showexampleh
\begin{scanexample}
\newenvironment{eqnlist}
  {\eqnaddopt{lines,shape=left}\equations}
  {\endequations}
\begin{eqnlist}[nonumber]
x=\cos\phi \\ \phi=\arccos x
\end{eqnlist}
\end{scanexample}
\showexampleh[0.65]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Numbering}
\label{sec:numbering}

The package extends the established interface of \latex/
and the \amsmath/ package for labelling equations
with numbers or with manually assigned tags.
The mode of numbering can be set globally via |\eqnlinesset|
or locally via the options of an equation block.
By default, numbering is turned off for |equations|
as well as for the symbolic notation |\[|\,\ldots|\]| and |\<|\,\ldots|\>|.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Numbering Schemes.}

\DescribeKey{numberline}
\DescribeKey{n}
For multi-line equations, there are two distinct modes of operations:
individual labelling of the equation lines or
one overall number/tag for the whole block of equations.
The modes are selected by an optional argument
|numberline=|\textit{mode} (alternatively |nline| or just |n|)
as follows:
\begin{longtable}{llll}
name     & alt. & description & preset \\
\hline
|all|    & |a|  & individual & all lines \\
|sub|    & |s|  & lines & subequations (a,\,b,\,c,\,\ldots) \\
\hline
|first|  & |f|  & & first line \\
|last|   & |l|  & & last line \\
|out|    & |o|  & & last/first line for right/left tags \\
|in|     & |i|  & single line & first/last line for right/left tags  \\
|middle| & |m*| & & middle line (rounded down/up for right/left tags) \\
|here|   & |h|  & & line indicated by |\numberhere| \\
|best|   & |+|  & & line with most available space \\
\hline
|top|      & |t|  & & at top \\
|bottom|   & |b|  & & at bottom \\
|center|   & |c|  & between & at vertical centre (single line at baseline) \\
|center!|  & |c!| & lines & at vertical centre (also single line) \\
|median|   & |m|  & & middle line (at baseline or between lines) \\
|center*|  & |c*| & & tag baseline centred between outer baselines \\
\hline
|multi|  & |@| & & individual lines, numbering on \\
|none|   & |-| & mode switch & individual lines, numbering off \\
|single| & |1| & & previous single-line mode, numbering on \\
\hline
|on|     & |!| & activation & turn numbering on \\
|off|    & |*| & & turn numbering off \\
\end{longtable}

\begin{example}
\eqnlinesset{number=on}
\eqnlinesset{evadetag=false}
\begin{scanexample}
\eqnlinesset{number=on}
\begin{equations}[numberline=...]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{scanexample}
\qquad\parbox{0.8\textwidth}{\printexample}
\par\bigskip
\makebox[0.33\textwidth]{|all|:}\hfil
\makebox[0.33\textwidth]{|sub|:}\hfil
\makebox[0.33\textwidth]{|best|:}\par\nobreak\smallskip
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=all]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=sub]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=best]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{minipage}
\par\bigskip
\makebox[0.33\textwidth]{|first|:}\hfil
\makebox[0.33\textwidth]{|last|:}\hfil
\makebox[0.33\textwidth]{|middle|:}\par\nobreak\smallskip
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=first]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=last]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=middle]
  x  &= \cos\phi  \\ &= (z+z^{-1})/2 \\
\phi &= \arccos x \\ &= -i\log z
\end{equations}
\end{minipage}
\par\bigskip
\makebox[0.33\textwidth]{|top|:}\hfil
\makebox[0.33\textwidth]{|bottom|:}\hfil
\makebox[0.33\textwidth]{|center!|:}\par\nobreak\smallskip
\begin{minipage}{0.33\textwidth}
\begin{equations}[1,numberline=top]
1+\frac{1}{\displaystyle 1+\frac{1}{\displaystyle 1+\ldots}}
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[1,numberline=bottom]
1+\frac{1}{\displaystyle 1+\frac{1}{\displaystyle 1+\ldots}}
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[1,numberline=center!]
1+\frac{1}{\displaystyle 1+\frac{1}{\displaystyle 1+\ldots}}
\end{equations}
\end{minipage}
\par\bigskip
\makebox[0.33\textwidth]{|median|:}\hfil
\makebox[0.33\textwidth]{|center*|:}\hfil
\makebox[0.33\textwidth]{|center|:}\par\nobreak\smallskip
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=median]
 x &= -\int \sin\phi\,\mathrm{d}\phi \\
   &= \cos\phi
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=center*]
 x &= -\int \sin\phi\,\mathrm{d}\phi \\
   &= \cos\phi
\end{equations}
\end{minipage}\vrule\hfil
\begin{minipage}{0.33\textwidth}
\begin{equations}[numberline=center]
 x &= -\int \sin\phi\,\mathrm{d}\phi \\
   &= \cos\phi
\end{equations}
\end{minipage}
\end{example}

\DescribeKey{evadetag}
Note that the mode |best| (line with most available space)
is activated automatically if the (single) tagged line
does not have sufficient space to hold the tag.
This feature can be controlled by the setting
|evadetag=|\textit{bool}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Activation and Selection.}

\DescribeKey{number}
\DescribeKey{nonumber}
\DescribeKey{donumber}
The default numbering of equation blocks (initially off) is controlled by:
\begin{center}
|\eqnlinesset{number=|\textit{bool}|}|
\qquad or\qquad
|\eqnlinesset{donumber|\textbar|nonumber}|
\end{center}
with \textit{bool} either |on| or |off| (among several alternative forms).
This applies equally to the environment |equations|
and to the symbolic forms |\[|\,\ldots|\]| and |\<|\,\ldots|\>|.
If numbering is to be used for |equations| only,
but not for the symbolic forms,
one can suppress it for the latter by
declaring |nonumber| as their default option:
\begin{center}
|\eqnlinesset{sqropt=nonumber,angopt=nonumber}|
\end{center}

\DescribeInterfaceMacro{\nonumber}
\DescribeInterfaceMacro{\donumber}
Numbering can be turned on and off
(for individual lines or for the block as a whole depending on the mode)
by means of:
\begin{center}
|\nonumber|
\qquad and \qquad
|\donumber|
\end{center}
\DescribeKey{nonumber}
\DescribeKey{donumber}
\DescribeKey{number}
\DescribeKey{nn,*}
\DescribeKey{dn,!}
\DescribeMod{*}
\DescribeMod{!}
The numbering can be disabled or enabled for the block
by the keys |nonumber| or |donumber| (`|nn|'=`|*|' or `|dn|'=`|!|' for short)
or by |number=|\textit{bool}.
In the symbolic notation, the number can be switched by using modifiers:
\begin{center}
|\[*|\textvisiblespace\,\ldots|\]|
\qquad and \qquad
|\[!|\textvisiblespace\,\ldots|\]|
\end{center}
Altogether, this allows to define a default behaviour
and specify exceptions where they may occur.
The optional argument `|[*]|'
or the star modifier `|*|' following directly the symbolic opening statement
replaces the starred form of environments (|equation*|, etc.)
and there is no need to adjust the closing statement.
If numbering is disabled by default,
the optional argument `|[!]|' or the modifier `|!|'
can be used to enable numbering for the block.

\DescribeInterfaceMacro{\numberhere}
\DescribeInterfaceMacro{\numbernext}
The placement of a single number for an equation block can be adjusted by:
\begin{center}
|\numberhere|
\qquad and \qquad
|\numbernext|
\end{center}
The former macro overrides the position to the present line,
the latter macro defers the number to the next line.
For example, if an equation is broken into several lines
one may use the combination |\numbernext \\|
to assign the number to the last line within the set.
\DescribeMod{/}
Note that the modified newline `|\\/|' combines
|\numbernext| and |\\|
\begin{center}
|\\/|\quad\textrightarrow\quad|\numbernext \\|\quad(or |\nonumber \\|)
\end{center}

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\begin{equations}
   x &= \cos\phi \nonumber \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \nonumber \\
     &= -i\log z
\end{equations}
\end{scanexample}
\showexampleh
\begin{scanexample}
\begin{equations}[nonumber]
   x &= \cos\phi \donumber \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \donumber \\
     &= -i\log z
\end{equations}
\end{scanexample}
\showexampleh
\begin{scanexample}
\eqnlinesset{numberline=last}
\<  x &= \cos\phi \\
 \phi &= \arccos x \>
\end{scanexample}
\showexampleh
\begin{scanexample}
\eqnlinesset{angopt=nonumber}
\<! x &= \cos\phi \\
 \phi &= \arccos x \>
\end{scanexample}
\showexampleh
\begin{scanexample}
\< x &= \cos\phi \\/
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\/
     &= -i\log z \>
\end{scanexample}
\showexampleh
\begin{scanexample}
\eqnlinesset{numberline=here}
\< x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \numberhere \\
     &= -i\log z \>
\end{scanexample}
\showexampleh
\begin{scanexample}
\eqnlinesset{numberline=first}
\< x &= \cos\phi \\/
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\/
     &= -i\log z \>
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Labels and Tags.}

\DescribeInterfaceMacro{\label}
\DescribeInterfaceMacro{\tag}
Equation numbers can be equipped with \latex/ labels as usual,
and they can be turned into manually assigned tags
using the established macros:
\begin{center}
|\label[|\textit{name}|]{|\textit{label}|}|
\qquad and \qquad
|\tag|[|*|]|[|\textit{ref}|]{|\textit{tag}|}|
\end{center}
The optional parameter \textit{name} for |\label| assigns
a name to the label which can be referenced by |\nameref|.
A |\tag| replaces the equation number,
|\tag*| will drop the decoration by parentheses.
The optional parameter \textit{ref} for |\tag|
defines the representation of references by |\ref|.

Note that a label and a tag will always apply to the
next number that will be printed, and only a single label
and/or tag may be specified for it. For example, if the present line
has no numbering, but the following line does,
|\label| or |\tag| will apply to the following line.

The macros |\label| and |\tag|
can also be instructed to automatically enable numbering/tagging
for the present line or block via |\donumber|, see below.
By default, numbering/tagging is triggered for |\tag|,
but not for |\label| reflecting the behaviour set forth by \amsmath/.
By enabling triggering for |\label|, numbers will be produced
only if they have a chance of being referenced.

\DescribeOption{label}
\DescribeOption{tag}
\DescribeKey{labelname}
\DescribeKey{taglabel}
The |equations| environment provides an alternative means
to specify labels and tags within the optional arguments |[|\textit{opts}|]|
\begin{center}
|label={|\textit{label}|}|,
\qquad
|tag|[|*|]|={|\textit{tag}|}|,
\qquad
|labelname={|\textit{name}|}|,
\qquad
|taglabel={|\textit{ref}|}|,
\end{center}
\DescribeMod{@}
or via the modifier |@{|\textit{label}|}|:
\begin{center}
|\[@{|\textit{label}|}|\,\ldots|\]|
\end{center}
In particular, in subequations mode (|sub|),
the optional argument |label| can be used to assign
a label to the parent number addressing the whole equation block.

The above macros may also be used via the keys
|label|, |labelname|, |tag| and |taglabel|
of the interface |\eqncontrol|.

\DescribeInterfaceMacro{\eqref}
The macro |\eqref| is the standard method for referring
to equation numbers via their label.
This method also uses the layout defined below.
\begin{center}
|\eqref{|\textit{label}|}|.
\end{center}
\DescribeInterfaceMacro{\tagform}
\DescribeInterfaceMacro{\tagbox}
\DescribeInterfaceMacro{\tagboxed}
For custom typesetting of numbers and tags,
|\tagform| encloses a number/tag with some decoration,
|\tagbox| puts the decorated number in a box
and |\tagboxed| combines the two for use in a single macro call.

\DescribeSetup{tagbox}
\DescribeSetup{tagform}
\DescribeSetup{tagform*}
The typesetting of equation numbers and tags passes through two macros
(which are exposed by |\tagbox| and |\tagform|),
one which defines the layout
and another one which adds a decoration by parentheses.
These two methods can be adjusted via the options:
\begin{center}
|tagbox|[|*|]|={|\textit{code}|}|
\quad and\quad
|tagform={|\textit{l}|{|\textit{code}|}|\textit{r}|}|
\quad or\quad
|tagform*={|\textit{code}|}|
\end{center}
Here, \textit{code} is some macro code
that references the argument `|#1|' containing the
number or tag, and \textit{l} and \textit{r}
can be opening and closing parentheses for the tag presentation.

The above setting may also be changed for individual lines
by the corresponding keys of the interface |\eqncontrol|.

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\eqnlinesset{tagform=[{#1}]}
\eqnlinesset{tagbox={\textcolor{blue}{#1}}}
\<[numberline=last]
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.6]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Horizontal Placement}
\label{sec:adjustment}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Overall Layout.}

\DescribeKey{layout}
\DescribeKey{center}
\DescribeKey{left}
First of all, the overall layout can be adjusted
between central and left alignment
via |layout=center|, |layout=left| or |center|, |left| for short.

\begin{example}
\begin{scanexample}
\<[layout=center]
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.35]
\begin{scanexample}
\<[layout=left]
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.35]
\end{example}

\DescribeKey{tags}
\DescribeKey{tagsright}
\DescribeKey{tagsleft}
Furthermore, numbers and/or tags may be placed
on the right or left margin
via |tags=right|, |tags=left| or |tagsright|, |tagsleft| for short.

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\<[tags=right]
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.35]
\begin{scanexample}
\<[tags=left]
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.35]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Margins.}

\DescribeKey{margin}
\DescribeKey{marginleft}
\DescribeKey{marginright}
\DescribeKey{linewidth}
For both layout choices,
the margins and line width of an equation block can be adjusted
by |margin|, |marginleft|, |marginright| or |linewidth|.
The equations and corresponding numbers or tags will be fit
within these bounds. This feature can be used within
lists or enumerations to undo an indentation.

\begin{example}
\def\indicate#1{%
  \framebox[\dimexpr\displaywidth-2\fboxsep-2\fboxrule\relax]{\mbox{#1}}}
\begin{scanexample}
\[ \indicate{line width} \]
\end{scanexample}
\showexampleh[0.5]
\begin{scanexample}
\[[margin=2em] \indicate{reduced} \]
\end{scanexample}
\showexampleh[0.5]
\begin{scanexample}
\begin{itemize}
\item first level
  \[ \indicate{default width} \]
  \[[marginleft=0pt]
    \indicate{full width} \]
\end{itemize}
\end{scanexample}
\showexampleh[0.5]
\end{example}

\DescribeKey{tagmargin}
\DescribeKey{tagmargin*}
\DescribeKey{tagmarginratio}
In central alignment layout, one can impose a tag margin
|tagmargin={|\textit{dimen}|}|
which allocates some space to the tag
such that equation content is centred in the remaining horizontal space.
The margin can also be set to the width of some text by
|tagmargin*={|\textit{text}|}| or it can be calculated
as the maximum width of tags by |tagmargin| without parameter (default).
The option |tagmarginratio={|\textit{ratio}|}|
uses the tag margin only for equation blocks
with a ratio of tags to rows above the given (decimal) ratio
(a value above 1 uses the tag margin only for single equations with tags;
default is |0.334|).
The option |tagmarginthreshold={|\textit{threshold}|}|
uses the tag margin only if the ratio of spacings would be below
the given (decimal) threshold (very much off balance;
default is |0.5|).
The latter two options together with some tag margin
can produce a more appealing layout for equation blocks of mixed filling.
In the following example, the former two equations are centred
on all horizontal space
while the latter two equations are centred on the space left of the tag
(the ratio of spacings without tag margin would be very small here):

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\eqnlinesset{tagmarginthreshold=0.7}
\[ \framebox[4em]{} \]
\[ \framebox[8em]{} \]
\[ \framebox[12em]{} \]
\[ \framebox[16em]{} \]
\end{scanexample}
\showexampleh
\end{example}

\DescribeKey{leftmargin}
\DescribeKey{leftmargin*}
\DescribeKey{minleftmargin}
\DescribeKey{maxleftmargin}
In left alignment layout, all equations are left aligned to a left margin
(|leftmargin| is initialised
to the first level of enumerations and itemisations).
It can be set to the width of some text by |leftmargin*={|\textit{text}|}|.
Depending on the situation, the left margin may be
reduced or extended to |minleftmargin| or |maxleftmargin|, respectively.

\begin{example}
\eqnlinesset{number=on}
\eqnlinesset{layout=left}
\begin{scanexample}
\eqnlinesset{layout=left}
\<*
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.35]
\begin{scanexample}
\<[tags=left]
   x &= \cos\phi \\
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\
     &= -i\log z
\>
\end{scanexample}
\showexampleh[0.35]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Column Separation.}

\DescribeKey{fulllength}
\DescribeKey{mincolsep}
\DescribeKey{maxcolsep}
The horizontal alignment of columns is fixed for aligned multi-line equations:
Each pair of subsequent columns forms a unit which is aligned at the
intermediate alignment marker `|&|'.
These columns are distributed evenly over the available horizontal space.
Here, the outer space left and right of the set of columns
is treated on equal footing to the space between the columns
(option |fulllength=off|; default),
but it can be eliminated so that the outer columns
are pushed right to the margin (option |fulllength=on|).
A minimum and maximum column separation can be specified
via |mincolsep=|\textit{dimen} and |maxcolsep=|\textit{dimen}
(defaults are |2em| and |1em|)
or the maximum column separation can be disabled by |maxcolsep=off|
(which is implied by |fulllength=on|).

\begin{example}
\begin{scanexample}
\<[maxcolsep=2em]
 x &= \cos\phi     & \phi &= \arccos x \\
   &= (z+z^{-1})/2 &      &= -i\log z \>
\end{scanexample}
\showexamplev
\begin{scanexample}
\<[maxcolsep=off]
 x &= \cos\phi     & \phi &= \arccos x \\
   &= (z+z^{-1})/2 &      &= -i\log z \>
\end{scanexample}
\showexamplev
\begin{scanexample}
\<[fulllength]
 x &= \cos\phi     & \phi &= \arccos x \\
   &= (z+z^{-1})/2 &      &= -i\log z \>
\end{scanexample}
\showexamplev
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Alignment Schemes and Control.}

For stacks of equations including single equations,
there is just a single alignment column
whose horizontal alignment can be adjusted via a shape scheme or
by manually adjusting individual lines.
A shape scheme determines the horizontal alignment for each line
and it is specified by the optional argument
|shape=|\textit{mode} as follows:
\begin{center}
\begin{tabular}{llll}
name & alt. & shape & alignment \\
\hline
|default| & |def| & uniform & default\\
\hline
|left| & |l| & & left\\
|center| & |c| & uniform & central \\
|right| & |r| & & right \\
\hline
|first| & |indent|, |rc|  & first/rest & first line indented \\
|hanging| & |outdent|, |lc| & first/rest & first line hanging \\
|steps| & |lcr| & first/intermediate/last & left/centre\ldots centre/right\\
\end{tabular}
\end{center}
Note that the |steps| shape comes to use in the replacement \amsmath/
environment |multline|.

\begin{example}
\eqnlinesset{pad=2em}
\begin{scanexample}
\eqnlinesset{pad=2em}
\<=[shape=...] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{scanexample}
\qquad\parbox{0.8\textwidth}{\printexample}
\par\bigskip
\makebox[0.33\textwidth]{|left|:}\hfil
\makebox[0.33\textwidth]{|center|:}\hfil
\makebox[0.33\textwidth]{|right|:}\par\nobreak\smallskip
\begin{minipage}{0.33\textwidth}
\<=[shape=left] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{minipage}\vrule\hfill
\begin{minipage}{0.33\textwidth}
\<=[shape=center] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{minipage}\vrule\hfill
\begin{minipage}{0.33\textwidth}
\<=[shape=right] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{minipage}
\par\bigskip
\makebox[0.33\textwidth]{|first|:}\hfil
\makebox[0.33\textwidth]{|hanging|:}\hfil
\makebox[0.33\textwidth]{|steps|:}\par\nobreak\smallskip
\begin{minipage}{0.33\textwidth}
\<=[shape=first] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{minipage}\vrule
\begin{minipage}{0.33\textwidth}
\<=[shape=hanging] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{minipage}\vrule
\begin{minipage}{0.33\textwidth}
\<=[shape=steps] x = \cos\phi \\ x = (z+z^{-1})/2 \\
  \phi = \arccos x \\ \phi = -i\log z \>
\end{minipage}
\end{example}

\DescribeControl{align}
\DescribeControl{shiftto}
\DescribeControl{shiftby}
The alignment preset can be adjusted for individual lines by the controls:
\begin{center}
\begin{tabular}{l}
|\eqncontrol{align=left|\textbar|center|\textbar|right}|\\
|\eqncontrol{shiftto|\textbar|shiftby=|\textit{dimen}|}|
\end{tabular}
\end{center}
\DescribeInterfaceMacro{\shoveleft}
\DescribeInterfaceMacro{\shovecenter}
\DescribeInterfaceMacro{\shoveright}
or by the macros:
\begin{center}
|\shoveleft|\textbar|\shovecenter|\textbar|\shoveright|%
[|*|\textbar|!|\textbar|[|\textit{dimen}|]|],
\end{center}
In contradistinction to \amsmath/,
these macros can be placed anywhere within the cell
and they do not take the cell contents as their argument
(doing this here will disallow shrinking of glue towards reducing width).
The macros accept an optional argument |[|\textit{dimen}|]|
specifying a variable amount of shift.
\DescribeKey{indent}
They also accept the modifiers
`|*|' or `|!|' for indentation or hanging indentation by
the standard indentation amount (|indent|=|2em|).
\DescribeInterfaceMacro{\shoveby}
Furthermore, |\shoveby|[|*|]|{|\textit{dimen}|}|
shifts the line by the additional amount \textit{dimen}
(the star variant shifts to an absolute position
relative to the reference position).

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Reference Positions.}

\DescribeKey{padding}
\DescribeKey{padleft}
\DescribeKey{padright}
The reference positions for left, right and central alignment
are determined as follows:
The central reference position marks the centre of
the available horizontal space.
The left and right reference positions are given
by the ends of the widest line placed centrally.
The latter can be adjusted by adding
some padding around the widest line via the optional argument
|padding|\textbar|padleft|\textbar|padright|[|={|\textit{dimen}|}|]
while preserving the central default position.
The value `|indent|' sets the padding to the default indentation amount
and `|max|' extends the padding to all available space.
Note that |indent*={|\textit{dimen}|}| sets the default indentation amount
and the left padding at the same time.

\begin{example}
\begin{scanexample}
\eqnlinesset{indent=2em,pad=5em}
\<=
\shoveleft   \framebox[5em]{left} \\
\shoveleft*  \framebox[5em]{indent} \\
\shovecenter \framebox[5em]{center} \\
\shoveright  \framebox[5em]{right}
\>
\end{scanexample}
\showexampleh[0.55]
\begin{scanexample}
\eqnlinesset{layout=left}
\eqnlinesset{leftmargin=2em}
\eqnlinesset{indent=2em}
\<=
\shoveleft! \framebox[5em]{outdent} \\
\shoveleft  \framebox[5em]{left} \\
\shoveleft* \framebox[5em]{indent} \\
\shoveright \framebox[5em]{right}
\>
\end{scanexample}
\showexampleh[0.55]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Fitting.}

Finally, note that the package will make attempts
at fitting the equation components into the horizontal space
by adjusting some dimensions
with the priority of avoiding overlong lines.
The adjustments will first concern the intercolumn and margin spacing.
Secondly, \tex/ will attempt to shrink the glue between symbols
for very wide single and stacked equations (but not aligned equations).
Finally, equation tags may be shifted out of the way vertically
in order to free up horizontal space.
If all attempts fail, overlong lines will be indicated.

\DescribeKey{alignshrink}
\DescribeKey{tagshrink}
\DescribeKey{alignbadness}
\DescribeKey{tagbadness}
The threshold for shrinking of glue can be controlled by the two parameters
|alignshrink| and |tagshrink| accepting values ranging
between |0| (no shrink) and |4| (full allowable shrink).
They are used towards determining
whether to shift away from the intended alignment position
or whether to raise or lower the equation tag, respectively.
Small values prevent shrinking and higher values allow for more compression.
The corresponding parameters |alignbadness| and |tagbadness|
accept integer values setting the
native threshold in \tex/'s native units of |\badness|.

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\<=
x+x \\
x+x+x+x \\
x+x+x+x+x+x \\
x+x+x+x+x+x+x+x \\
x+x+x+x+x+x+x+x+x+x \\
x+x+x+x+x+x+x+x+x+x+x+x \\
\>
\end{scanexample}
\showexampleh[0.6]
\end{example}

\DescribeKey{mintagsep}
If the available space on a line does not suffice to place
both the equation and its tag
(with a minimum separation of |mintagsep|; default is |0.5em|),
a tag will automatically be shifted
(lowered or raised depending on whether it is placed on the right or left)
to an otherwise empty line.
\DescribeControl{shifttag}
\DescribeInterfaceMacro{\raisetag*}
The |\eqncontrol| control |shifttag=|\textit{dimen}
(alternatively |\raisetag*|) may be used to shift a tag up
(or down with negative arguments).
\DescribeControl{smashtag}
\DescribeInterfaceMacro{\raisetag}
The control |smashtag=|\textit{dimen} (alternatively |\raisetag|)
may be used to fine-tune the vertical placement
when the tag requires extra vertical space
but some space above or below the tag is unoccupied.
It smashes some of the tag's height (or depth with negative arguments)
and thus reduces the vertical gap created by the tag.
Note that this feature can be used successively
with positive and negative arguments
to reduce the space in both directions if available.
\DescribeKey{pushtag}
\DescribeInterfaceMacro{\raisetag!}
Where needed, the control |pushtag| (or |\raisetag!|)
force-pushes the tag to a separate line
and frees up the horizontal space occupied by the tag.
The numbering modes |top|, |bottom|,
|center|, |median|, |center!| and |center*|
are special in that they allow for a continuous vertical placement
of the tag between two lines.
\DescribeKey{tagbetween}
The more flexible placement of tags may
also be enabled for the single-lines modes
by the option |tagbetween|.
Here, both lines must have sufficiently much space available for the tag.
If not, the tag is shifted up or down or it is places on separate line
between the two.
\DescribeKey{tagsnap}
The option |tagsnap| defines a range
within which the tag baseline snaps to a nearby math baseline.

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\[ \phi = -\int \frac{\mathrm{d}x}{\sqrt{1+x^2}} \]
\end{scanexample}
\showexampleh[0.8]
\begin{scanexample}
\[ x = \frac{\partial}{\partial \phi}\sin\phi
   \raisetag{0.45\baselineskip} \]
\end{scanexample}
\showexampleh[0.85]
\begin{scanexample}
\<=[numberline=center] \raisetag*{2pt}
x+x+x+x+x+x+x+x \\
x+x+x+x+x+x+x+x \\
x+x+x+x+x+x+x+x \\
x+x+x+x+x+x+x+x
\>
\end{scanexample}
\showexampleh[0.6]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Punctuation}
\label{sec:punctuation}

Extending proper punctuation across equations is a delicate matter,
and maintaining it while redacting the text
certainly takes more attention to detail
than many authors are willing to afford.
A contributing factor is that punctuation marks are harder
to spot alongside equation context and somewhat out of place anyway.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Scheme.}

\DescribeInterfaceMacro{\eqnpunct}
\DescribeKey{punct}
The package supplies a semi-automatic scheme by which
equations are terminated by a specific punctuation mark.
Punctuation marks are set by:
\begin{center}
|\eqnlinesset{punct={|\textit{punct}|}}|
\qquad
|\eqnpunct{|\textit{punct}|}|
\qquad
|\[[punct={|\textit{punct}|}]|\,\ldots|\]|
\end{center}
The first form sets and enables a default punctuation mark;
the middle form sets the punctuation mark for the
following equation environment;
the final form applies to the given equation environment only.
For example, one might globally declare `|punct={.}|'
to terminate all equations by default with a period `|.|'.
The default behaviour can be adjusted to a comma `|,|'
for an individual equation by declaring `|\eqnpunct,|' before the equation
(i.e.\ at the end of the textual phrase to which the punctuation mark belongs)
or by using the optional argument |[punct={,}]|.
Likewise, |\eqnpunct{}|, |[punct=~]| or |[punct={}]|
eliminates a preset punctuation.

\begin{example}
\eqnlinesset{skip=6pt}
\begin{scanexample}
\eqnlinesset{punct=.}
The equation
\[ x = \cos\phi \eqnpunct{} \]
can also be written as
\eqnpunct,
\[ x = (z+z^{-1})/2 \]
where we assume
\[ z = \exp(i\phi) \]
\end{scanexample}
\showexampleh
\end{example}

Arguably, the implementation of the scheme
will take higher efforts than direct coding of punctuation.
Hence, the scheme can be useful in situations
where equations typically terminate phrases or
where punctuation is otherwise expected in regular patterns.
The use of the scheme will be most efficient
in the symbolic shortcut form to be explained below.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Levels and Adjustments.}

\DescribeKey{punctcol}
\DescribeKey{punctline}
\DescribeKey{punctall}
\DescribeMod{`}
For multi-line equations, there are two further levels of default punctuation
for terminating columns and lines
which are specified via the option |punctcol| and |punctline|.
A punctuation item may also be handed on to the next lower level
of punctuation via the starred forms |punct*| and |punctline*|.
Several levels of punctuation can be specified simultaneously by |punctall|
or via the modifier `|`|':
\begin{center}
|punctall={|[[\textit{col}]\textit{line}]\textit{main}|}|
\qquad
|\[`{|[[\textit{col}]\textit{line}]\textit{main}|}|\,\ldots|\]|
\end{center}
The special value `|~|' represents no punctuation
and |\relax| hands down.
An empty argument for |punctall| or `|`|' removes all levels of punctuation.

\begin{example}
\begin{scanexample}
\<`{,;.}
   x &= \cos\phi &
\phi &= \arccos x \\
   x &= (z+z^{-1})/2 &
\phi &= -i\log z \>
\end{scanexample}
\showexampleh[0.4]
\end{example}

\DescribeInterfaceMacro{\eqnpunctapply}
\DescribeControl{punct}
In situations, where the punctuation must appear before the end
of the block, e.g.\ before a ``QED'',
it can be invoked manually by |\eqnpunctapply|
or by the control |punct|[|={|\textit{punct}|}|].
Further automatic punctuation is suppressed within the current display.
\DescribeControl{punctcol}
\DescribeControl{punctline}
The line and column punctuation can also be accessed by
the controls |punctline| and |punctcol|.

\DescribeKey{punctsep}
\DescribeKey{punctclass}
For convenience, one may also specify a desired space
(or any other code sequence) preceding the punctuation
by |[punctsep={|\textit{sep}|}]|,
e.g.\ \textit{sep}=|\,| or \textit{sep}=|\|\texttt{\textvisiblespace}.
It makes sense to also set the math class preceding punctuation
by |[punctclass={|\textit{class}|}]|,
e.g.\ \textit{class}=|\mathclose{}|,
to avoid additional space in some situations.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Symbolic Notation.}

The full power of the punctuation scheme comes alive in symbolic notation.
Adjustments to punctuation can be done by adding
modifiers to the opening and closing statements
of equation blocks as well as for line and column breaks:
\begin{center}
\begin{tabular}{c}
|\[|\textit{mod}\texttt{\textvisiblespace} \\
|\<|\textit{mod}\texttt{\textvisiblespace}
\end{tabular}
\qquad
\begin{tabular}{c}
|\\|\textit{mod}\texttt{\textvisiblespace} \\
|\&|\textit{mod}\texttt{\textvisiblespace}
\end{tabular}
\qquad
\begin{tabular}{c}
|\]|\textit{mod}\texttt{\textvisiblespace} \\
|\>|\textit{mod}\texttt{\textvisiblespace}
\end{tabular}
\end{center}
The opening statement is somewhat out of place
for punctuation adjustments which take effect only later;
it is most useful for general adjustments to punctuation
for the equation block.
Conversely, the closing statement, line and column breaks
display the adjusted punctuation right where it is declared.

\DescribeMod{.}
\DescribeMod{,}
\DescribeMod{\string~}
\DescribeMod{`}
The modifiers dot `|.|', comma `|,|' and tilde `|~|'
are short forms for using a dot, a comma or disabling punctuation.
A custom punctuation can be set by the modifier `|`{|\textit{punct}|}|'.
\begin{center}
\begin{tabular}{rccccc}
\textit{mod}: & |~| & |.| & |,| & |`{|\textit{punct}|}| & |!|
\\\hline
punctuation: & none & dot & comma & \textit{punct} & |\eqnpunctapply|
\end{tabular}
\end{center}
\DescribeMod{!}
The line and column break `|\\|', `|\&|'
allow for the additional modifier `|!|'
which applies the main punctuation level of the block
(or an explicit local adjustment) by issuing |\eqnpunctapply|.
\DescribeMod{/}
Note that the continued equation marker `|\\/|' also
suppresses the punctuation at the line break.

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\<`{,.}
   x &= \cos\phi \\/
     &= (z+z^{-1})/2 \\
\phi &= \arccos x \\/
     &= -i\log z \\`;
   z &= \exp(i \phi) \\~
     &= x+i\sqrt{1-x^2} \>`{?!}
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Equation Alignment}
\label{sec:alignment}

The columns mode of a multi-line equation block
produces (several columns of) equations to be aligned
at some position within each line.
This is used to collect several equations into an array,
but it also facilitates the breaking of a long equation
or a chain of equations into the available horizontal space, e.g.
\<* \&: a \\= b+c \\= d-e \\; +f \>
Here, the first two lines represent a chain of equations
and the third line continues the right-hand side begun in the second line.
The alignment puts all equality relations within a vertical tower
and the right-hand sides strictly to the right of the equality sign.

Technically, each equation component within a line
is to be aligned at one specific position.
In the above example, the alignment is chosen to be at the equality relation,
Such an alignment splits the equation component
into two separate maths blocks which interferes with
\latex/'s math kerning mechanism:
\latex/ will determine the kerning between all math symbols,
but only within their math block.
Unfortunately, \latex/ cannot determine the appropriate kerning
between the two blocks;
this has to be determined by some other means or assumption.
Consistency of the kerning requires consistency of the assumptions.
A natural assumption is to put the alignment at an equality relation;
here, the kerning will depend on whether the alignment is just before
or just after the equality sign
(and whether it is to the left or to the right of the kerning
between the equality sign and the surrounding symbols).

The principal assumption for the \amsmath/ environment |align|
is that the left part of the column ends with an ordinary character.
This leads to the correct spacing when an equation $a=b+c$
is broken before the equals relation as |a&=b+c|,
and also if an equation sequence continues on the next line as |\\&=d-e|.
It naturally places the alignment left of the equality relation
(and left of the leading kerning).
However, it is difficult to achieve the right spacing
if the right-hand side is to be broken into several lines:
For instance, |\\&+f|
aligns the subordinate binary operation with the equals sign
(which may be undesirable).
Instead placing a phantom equals sign is an effort
that somewhat disrupts source readability.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Math Classes at Alignments.}

\DescribeKey{class}
\DescribeKey{ampeq}
\DescribeKey{eqamp}
\DescribeMod{<}
\DescribeMod{>}
The package implements a more flexible assignment of math classes
at the alignment. The above default behaviour is invoked by
the optional argument |class=ampeq| (|ampeq| for short or `|<|' as modifier).
The optional argument |class=eqamp| (|eqamp| for short or `|>|' as modifier)
imposes math classes at the alignment
such that an equation sign should be placed just before the alignment.
Concretely, it inserts a |\mathrel{}| class just after
the alignment marker. Furthermore, in case of an empty left alignment cell,
the leading math class is changed to |\mathord{}|
so that a following binary operator is not interpreted as a unary one.
For example, the following two expressions produce identical output:

\begin{example}
\begin{scanexample}
\<< &\mathrel{\phantom{=}} a \\
    &= b+c \\
    &= d-e \\
    &\mathrel{\phantom{=}}\mathclose{} +f \>
\end{scanexample}
\showexampleh[0.7]
\begin{scanexample}
\<> \,& a \\
     =& b+c \\
     =& d-e \\
      & +f \>
\end{scanexample}
\showexampleh[0.7]
\end{example}

\DescribeKey{classout}
\DescribeKey{classin}
\DescribeKey{classlead}
Math classes just before and after alignment can be adjusted freely
by the optional arguments:
\begin{center}
|classout={|\textit{class}|}|,
\qquad
|classin={|\textit{class}|}|,
\qquad
|classlead={|\textit{class}|}|.
\end{center}
The parameter |classlead|
determines the math class just after the alignment
if the cell before alignment is empty (has zero width).
The spacing at the alignment is determined by the pairing
of the last/first character and the selected math class at the alignment:
\<[classin={},classout={},classlead={},*]
\framebox[1em]{\bstrut}\ \framebox[1em]{\bstrut}\
\framebox[1em]{\bstrut a}\ \underline{\makebox[3em]{\itshape a-out}}
\ \vrule&
\ \underline{\makebox[3em]{\itshape in-b}}\ \framebox[1em]{\bstrut b}
\ \framebox[1em]{\bstrut}\ \framebox[1em]{\bstrut}
\\
\vrule&
\ \underline{\makebox[3em]{\itshape lead-c}}\ \framebox[1em]{\bstrut c}
\ \framebox[1em]{\bstrut}\ \framebox[1em]{\bstrut}
\>

\DescribeControl{rel}
\DescribeControl{rel;}
\DescribeControl{rel*}
The package provides a control to encode an aligned relation
that issues the alignment tab `|&|' in the appropriate location
for both the |ampeq| and |eqamp| modes:
\begin{center}
|\eqncontrol{rel|[|={|\textit{rel}|}|]\textbar|;|\textbar|*}|
\end{center}
The form |rel| will use the default equality relation (preset to `|=|')
whereas |rel={|\textit{rel}|}| uses the relation \textit{rel} instead.
The special form |rel;| indicates the continuation of an equation term
by replacing the equality relation with space.
Conversely |rel*| indicates the start of an equation
when a left-hand side fits better on the right-hand side of the alignment;
this is very similar to |rel;| but uses a slightly different spacing.

\DescribeKey{rel}
\DescribeKey{classstart}
\DescribeKey{classbreak}
The default relation symbol can be adjusted
by the option |rel={|\textit{rel}|}|.
The space for the start of an equation is defined by the option
|classstart={|\textit{code}|}|, where \textit{code} is some \latex/ code
that accepts the default relation symbol as argument `|#1|'
(for use in |\phantom|).
Similarly, |classbreak={|\textit{code}|}| defines the space
for a continued equation term.
Note that the latter two settings apply only to |ampeq| mode;
whereas the space is canonically generated in |eqamp| mode.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Symbolic Notation.}

The placement or omission of aligned equality relations
is most conveniently achieved in the symbolic notation
using modifiers to the line break `|\\|' and the column break `|\&|'.
\DescribeMod{=}
\DescribeMod{?}
\DescribeMod{;}
\DescribeMod{:}
\DescribeMod{\verbbar}
The modifiers `|=|', `|?|', `|;|', `|:|' and `\verbbar' indicate
typical situations encountered for a set of aligned equations as follows:
\begin{center}
\begin{tabular}{cl}
\textit{mod}: & meaning
\\\hline
none & start new equation in left cell \\
|=| & continue equation with default relation (`|=|') \\
|?{|\textit{rel}|}| & relation with symbol \textit{rel} \\
|;| & continue equation term in right cell \\
|:| & start new equation in right cell \\
\verbbar & alignment within term (following a |\mathord|) \\
\end{tabular}
\end{center}
If no relation modifier is specified, `|\\|' will break the line
and start in the leftmost cell whereas `|\&|'
will terminate the current column and continue
in the left cell of the next column.
When a relation modifier is present, `|\\|' will break the line
and fill the leftmost cell
(and potentially the start of the following right cell)
with the desired relation;
it will always leave at the beginning of the right cell.
Similarly, `|\&|' will fill the next left cell with the aligned relation
and leave at the beginning of the following right cell.
\DescribeKey{crrelnext}
Note that `|\\|' with a relation modifier
`|=|', `|?|', `|;|' or `\verbbar' (but not `|:|')
describe the interior of an equation;
consequently, it will always suppress punctuation
and it will also issue a |\numbernext|
(if the option |crrelnext| is active).

The following two examples show
a symbolic notation for the above continued equation
and two columns of continued equations:
\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\< \&: a \\= b+c \\?\simeq d-e \\; +f \>
\end{scanexample}
\showexampleh[0.6]
\begin{scanexample}
\<`{,;.}
   a \&= b+c \&~     \& A \&= B+C \\/
     \&= d-e \&  \&/ \&   \&= D-E \\/
             \&      \&   \&; +F \>
\end{scanexample}
\showexampleh[0.6]
\end{example}

In the first example,
`|\&:|' starts the equation on the right of the alignment,
`|\\=|' continues the equation on the next line with an equality
and `|\\;|' continues the equation term on the next line without equality;
furthermore, the main equality symbol is set to $\equiv$.

In the second example, aligned equality relations are denoted by `|\&=|'
and continued terms by `|\&;|'.
The three columns are separated by `|\&|' and `|\&~|'
with and without punctuation, respectively;
however, a `|\&|' also suppresses punctuation if there is no content
to the right of the alignment.
Numbering is delayed and line punctuation by `;' is suppressed
by `|\\/|' to account for the continued equations.
Finally the middle column just contains a `|\&/|' to produce the
ampersand character.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Vertical Spacing}
\label{sec:vspace}

Display equations in \tex/ are considered to be part
of the surrounding paragraph of text.
Hence, the vertical spacing depends on the surrounding text,
in particular on the width and depth of the line of text
directly preceding the equation.
Due to this influence it can be difficult to manually adjust
the spacing accurately.
The package adds several options to control the vertical spacing,
and it also implements a uniform behaviour for all types of equations.

The spacing is determined by combination of several aspects:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Baselines.}

First, \tex/ inserts some glue between lines of text
to make them appear as regular as possible.
The amount of inserted glue is determined by \tex/'s rules
which depend on height, depth and intended baseline separation.
This interline spacing also applies to the lines of displayed equations
as well as the interfaces between text and displayed equations.

\DescribeKey{spread}
The spacing between the lines of a multi-line equation environment
can be adjusted via |spread={|\textit{dimen}|}|
which defaults to |\jot|$\equiv$|3pt| above the normal baseline skip.
\DescribeKey{strut}
\DescribeKey{strutdepth}
In addition, all equation lines and tags
are supplied with struts to ensure a minimum height and depth.
The latter behaviour is controlled by the switch |strut|
which takes the values `|on|' (default), `|cells|', `|tags|' or `|off|'.
The relative depth of such a strut is determined by |strutdepth|
(default |0.3|).

While the height/depth of text typically takes rather uniform values,
the height/depth of math content can range wildly with the context
(plain equations vs.\ fractions and matrices).
As displayed equations are normally surrounded by
a relatively large amount of glue,
it makes sense to reduce the dependency on the height/depth of math content.
Therefore, the package makes equation environments
appear to the surrounding text
as a line with a fixed height and depth,
and thus interline glue merely fills some potential gaps of the
surrounding text.
\DescribeKey{displayheight}
\DescribeKey{displaydepth}
The apparent height and depth are defined by
|displayheight| and |displaydepth|
which default to the dimensions of a strut.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Vertical Situation.}

Second, the spacing of display equations depends on the width
of the previous line of text.
If the math content fits well into the available horizontal space,
the display equation is called short
and less glue is needed above the equation.
The package implements this basic \tex/ feature
for all single- and multi-line equation environments.

\begin{example}
\begin{scanexample}
example of a long text line:
\[ \mbox{long mode} \]
vs.\ short:
\[ \mbox{short mode} \]
following line
\end{scanexample}
\showexampleh
\end{example}

\tex/ also reduces the amount of glue below short equations
(potentially to make their spacing appear more uniform).
\DescribeKey{shortmode}
The package allows to adjust the spacing for short equations
via the global option |shortmode=|\textit{mode}
where \textit{mode} takes the values:
\begin{center}
\begin{tabular}{lll}
\textit{mode} & reduced glue \\
\hline
|off| & disabled \\
|above| & above short equations (package default) \\
|belowone| & also below short single-line equations \\
|belowall| & also below all short multi-line equations \\
\end{tabular}
\end{center}
\DescribeKey{short}
\DescribeKey{long}
Short and long amounts of glue can also be enforced for
individual equation environments
via the optional arguments |short| and |long|
taking the values |above|, |below| or |both|.

\begin{example}
\begin{scanexample}
example of a long text line:
\[[short] \mbox{forced short} \]
and short:
\[[long] \mbox{forced long} \]
following line
\end{scanexample}
\showexampleh
\end{example}

There are three special situations |cont|, |par| and |top|
which trigger different spacings:
|cont| describes the situation
at the start of an empty horizontal list
(invoked by |\noindent|)
or when an equation block directly follows another one;
here, the space above the equation should be minimal
(or even negative to remove the space below the previous equation block).
|par| describes the situation at the beginning of a paragraph
(invoked by |\par|);
here, the space above the equation adds to the space between paragraphs.
|top| describes the situation at the top of a vertical list
(invoked by |\nointerlineskip|);
here, one would typically want no space.

\begin{example}
\eqnlinesset{belowtopmode=long}
\begin{scanexample}
\hrule\begin{minipage}{\linewidth}
\[ \mbox{top} \]
some text\par
\[ \mbox{par} \]
\[ \mbox{cont} \]
\end{minipage}\hrule
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Explicit Spacing.}

Third, the package provides several means to adjust the
glue around equations:

\DescribeKey{noskip}
\DescribeKey{medskip}
Next to |short| and |long| the spacing above and below
equation environments can be reduced
to some other fixed smaller amount via |medskip|
or removed altogether via |noskip|.
These keys also take the values |above|, |below| or |both|.

\begin{example}
\begin{scanexample}
\hrule
\[[long] \mbox{long default} \]
\hrule
\[[medskip] \mbox{medium space} \]
\hrule
\[[noskip] \mbox{no space} \]
\hrule
\end{scanexample}
\showexampleh
\end{example}

\DescribeKey{par}
By default, equation environments end in horizontal mode without indentation.
The key |par| controls whether
the equation environments end in horizontal mode as usual (value |cont|)
or in vertical mode (value |par|, default)
with a dedicated amount of glue |belowparskip|.
An environment can also be made to end in vertical mode
without interline skip (value |top|)
using the glue |belowtopskip|.
The key |par| can be used for situations when vertical mode is preferred,
e.g.\ for lists following equations
where the vertical space above the list is excessive.
In the following example,
|\hrule| will leave an empty line when not in vertical mode.

\begin{example}
\begin{scanexample}
\hrule some text
\[ \mbox{cont} \]
\hrule some text
\[[par] \mbox{par} \]
\hrule
\end{scanexample}
\showexampleh
\end{example}

\DescribeKey{...skip}
\DescribeInterfaceMacro{\vspace}
\DescribeKey{...space}
Variable amounts of skip can be set via
|aboveskip| and |belowskip| or |skip| for both simultaneously.
In addition, the package extends the \latex/ |\vspace| mechanism
to equation bodies where it adds vertical space
below the next equation line or below the equation environment.
Additional glue can be added above or below equation environments
by means of the options |abovespace| and |belowspace|.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Glue Dimensions.}

The package also maintains several global vertical space settings
|above|\textit{pos}|skip| and |below|\textit{pos}|skip|
(sometimes \textit{pos}|skip| for both):
\DescribeKey{...skip}
\begin{center}
\begin{tabular}{lll}
\ldots\textit{pos}|skip| & both & description \\
\hline
|...long...|   & |longskip| & regular amount of glue \\
|...short...|  & -- & reduced glue for short equations \\
|...cont...|   & -- & glue when issued from an empty |\noindent| paragraph \\
|...par...|    & -- & glue when starting a paragraph (in vertical mode)\\
|...top...|    & -- & glue when issued at the top of vertical list \\
|...med...|    & |medskip| & medium amount of glue \\\hline
|...tag...|    & |tagskip| & minimum glue for outer raised/lowered tags \\
\end{tabular}
\end{center}
\DescribeKey{...mode}
The situations \textit{pos}=|cont|, |par| and |top|
use the respective amount of glue |above|\textit{pos}|skip|
above the equations and the regular amount of glue |belowlongskip| below.
These behaviours may be adjusted by the global options
|above|\textit{pos}|mode| and |below|\textit{pos}|mode|
with the values:
\begin{center}
\begin{tabular}{lll}
value & reduced glue \\
\hline
|long| & regular amount of glue \\
|short| & reduced glue for short equations \\
|cont| & amount for empty paragraph \\
|par| & amount for paragraph (and end the paragraph) \\
|top| & amount for top (and end the paragraph without interline skip) \\
|noskip| & no glue \\
|medskip| & medium amount of glue \\
\end{tabular}
\end{center}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Page Breaks.}

\DescribeKey{prebreak}
\DescribeKey{postbreak}
\DescribeKey{allowbreaks}
\DescribeKey{prepenalty}
\DescribeKey{postpenalty}
\DescribeKey{interpenalty}
\DescribeInterfaceMacro{\displaybreak}
Finally, the breaking of multi-line equations across pages
can be controlled as follows:
The setting |allowbreaks| (or |allowdisplaybreaks|)
taking values |0| (never) through |4| (permissive)
controls the permittivity of page breaks within multi-line equations.
The optional arguments |prebreak| and |postbreak|
taking values |0| (do not) through |4| (enforce)
suggest a break just above or below the equation environment.
The command |\displaybreak[|\textit{val}|]|
with values |0| through |4| (default)
suggests a break below the current line or below the equation environment.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Further Environments and Features}
\label{sec:further}

The package supplies some additional environments and features:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Equation Boxes.}

\DescribeEnv{equationsbox}
The package provides a boxed equation environment |equationsbox|
which can be used within arbitrary math content.
It works analogously to |equations| including optional arguments
and modifiers, but it offers a reduced range of functionality
such as (evidently) no numbering
(yet, the |lines| mode accepts multiple columns here).

\DescribeKey{top,t}
\DescribeKey{center,c}
\DescribeKey{bottom,b}
The equations box accepts several arguments:
|top|, |center|, |bottom| (or |t|, |c|, |b|)
specify the vertical alignment of the box.
\DescribeKey{margin}
\DescribeKey{marginleft}
\DescribeKey{marginright}
|margin|, |marginleft|, |marginright|
specify additional margin space around the equations box.
\DescribeKey{colsep}
|colsep| specifies the amount of separation between the columns.
\DescribeKey{frame}
\DescribeKey{wrap}
|frame|[|=|\textit{cmd}] encloses the equations box
by a \textit{cmd} such as |\fbox| which accepts one argument
(or a command sequence which ends with a macro accepting one argument).
|wrap={{|\textit{cmdl}|}{|\textit{cmdr}|}}|
surrounds the equations box by the two commands
\textit{cmdl} and \textit{cmdr}.

\begin{example}
\begin{scanexample}
\[ \begin{equationsbox}[margin=1em,
          wrap={\left\{}{\right\}}]
   x &= \cos\phi \\
\phi &= \arccos x
\end{equationsbox} \]
\end{scanexample}
\showexampleh
\end{example}

\DescribeInterfaceMacro{\<...\string\>}
The equations box can also be invoked
by the symbolic short form |\<|\,\ldots|\>|
when called within math mode.
The symbolic form accepts modifiers
to adjust punctuation and equality relations.
\DescribeMod{!}
Note that |equationsbox| uses the current line and column punctuation settings,
but it does not inherit the top punctuation from the containing block.
To this end, the modifier `|!|' invokes |\eqnpunctapply|
to terminate punctuation with the top punctuation for the block.

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\[`{,;.} \Longrightarrow
\<=[shape=l,frame]
   x = \cos\phi &
\phi = \arccos x \\
   x = (z+z^{-1})/2 &
\phi = -i\log z
\>! \Longleftarrow \]
\end{scanexample}
\showexampleh[0.45]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Cases and Matrix Environments.}

\DescribeEnv{cases}
\DescribeKey{cases}
\DescribeKey{condsep}
The |cases| environment is reimplemented
using the special mode |cases| of |equationsbox|
with two left-aligned cells
whose separation may be adjusted by the option |condsep|.
\DescribeKey{braces}
The equations box is wrapped by a left brace by default;
this behaviour may be adjusted by the option |braces|
taking the values |off|, |l|, |r|, |lr|.
\DescribeKey{intro}
\DescribeKey{introtext}
Furthermore, a common intro \textit{text} for all conditions
may be added by the option |intro={|\textit{text}|}|;
|introtext| sets \textit{text} in text mode with a trailing space.
\DescribeKey{textcond}
Finally, the option |textcond| determines that right cells are given in mode.
\DescribeKey{punctcases}
All features of |equationsbox|, such as punctuation,
are equally available for |cases|.
The global setting |punctcases| and the local setting |punctcol|
set the punctuation for the left column
whereas the right column uses |punctline|.

\begin{example}
\begin{scanexample}
\[ x =
\begin{cases}[introtext={if},braces=lr]
1 & \phi = 0 \\
0 & \phi = \pi/2
\end{cases} \]
\end{scanexample}
\showexampleh[0.7]
\begin{scanexample}
\[`{,.} x = \<[cases,textcond]
\cos\phi & one way \\
(z+z^{-1})/2 & or the other \>! \]
\end{scanexample}
\showexampleh[0.6]
\end{example}

\DescribeEnv{?matrix}
The set of |matrix| environments is reimplemented
using particular combinations of options for |equationsbox|:
The matrix is arranged in |lines| mode
with centred cells |shape=center|.
\DescribeKey{spread*}
The line spread is reset by |spread*|.
Punctuation is turned off by |punctall={}|.
\DescribeKey{style}
The cells are rendered in |\textstyle|
using the option |style=text|.
\DescribeKey{colsep*}
A small column separation |colsep*|
is selected by |colsep=short|.
\DescribeKey{delim}
Finally, the equations box is wrapped by a pair of delimiters
\textit{l} and \textit{r}
using the option |delim={|\textit{l}\textit{r}|}|.
Again, all features of |equationsbox|
are equally available for the |matrix| environments.
\DescribeKey{matrix}
Altogether, the combination is achieved by the shortcut option
|matrix={|\textit{l}\textit{r}|}|,
where \textit{l}\textit{r} may take the following abbreviations:
\begin{center}
\begin{tabular}{cccccccc}
\textit{lr} & `|.|' & |r| & |s| & |a| & |c| & |v| & |d|
\\\hline
brackets & none & round & square & angle & curly & bars & double bars
\\
result & $\ldots$ & $(\ldots)$ & $[\ldots]$ & $\langle\ldots\rangle$
& $\lbrace\ldots\rbrace$ & $\vert\ldots\vert$ & $\Vert\ldots\Vert$
\end{tabular}
\end{center}

\begin{example}
\begin{scanexample}
\[ \begin{pmatrix}
\cos\phi & -\sin\phi \\
\sin\phi & \cos\phi
\end{pmatrix} \]
\end{scanexample}
\showexampleh
\begin{scanexample}
\[ \<[matrix=v,shape=r]
\cos\phi & -\sin\phi &  0 \\
\sin\phi &  \cos\phi &  0 \\
0        &  0        & -1
\> \]
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Collective Numbering.}

\DescribeEnv{subequations}
\DescribeKey{subeqtemplate}
The environment |subequations| groups equations contained in the body
with a common primary equation number and an extra level
of numbering (typically: a,\,b,\,c,\,\ldots).
The numbering layout can be controlled via |subeqtemplate|.
For instance, the default behaviour of adding lowercase latin letters
to the parent equation number (|#1|)
is achieved by:
\begin{center}
|subeqtemplate={#1\alph{#2}}|
\end{center}

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\eqnlinesset
  {subeqtemplate={#1-\roman{#2}}}
\begin{subequations}
\[ x = \cos\phi \]
and
\[ \phi = \arccos x \]
\end{subequations}
\end{scanexample}
\showexampleh[0.55]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Text Intermissions.}

\DescribeEnv{intertext}
\DescribeInterfaceMacro{\intertext}
The environment |intertext| (equivalently the macro |\intertext|)
injects a (short) line of text
into a multi-line equation while preserving the equation alignment
across the text.
The |intertext| environment must replace the
end-of-line marker `|\\|' between two lines of the equation
(to avoid blank lines).
The environment accepts several of the vertical spacing adjustments
as an optional argument.

\begin{example}
\begin{scanexample}
\< x &= \cos\phi
\intertext[medskip]{and}
\phi &= \arccos x \>
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Injection.}

\DescribeControl{inject}
\DescribeControl{inject*}
At a lower level, the control |\eqncontrol{inject={|\textit{cmd}|}}|
injects some command sequence \textit{cmd} after the present equation line
but before interline spacing.
The control |\eqncontrol{inject*={|\textit{cmd}|}}|
injects after interline spacing instead.

\begin{example}
\begin{scanexample}
\< x &= \cos\phi
\eqncontrol{inject=\hrule} \\
\phi &= \arccos x \>
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Line Marks.}

\DescribeControl{markline}
\DescribeControl{qed}
The package provides a mechanism to mark an equation line
at the end of the present line or just below.
This mechanism can be used to display a QED mark:
\begin{center}
\begin{tabular}{l}
|\eqncontrol{markline={symbol=|\textit{sym}|,|\textit{opts}|}|
\\
|\eqncontrol{qed|[|={|\textit{opts}|}|]|}|
\end{tabular}
\end{center}
The QED symbol may as well be invoked
by |\qedhere[|\textit{opts}|]| of \ctanpkg{amsthm}.
The starred variants |markline*|, |qed*| and |\qedhere*|
should be used for long lines
where the mark would otherwise smash equation content
(equation numbers are avoided automatically).

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\<[n=l] x &= \cos\phi
\eqncontrol{markline={symbol=$\sqrt{}$}} \\
\phi &= \arccos x
\eqncontrol{qed={shift=.5ex}} \>
\end{scanexample}
\showexampleh[0.6]
\end{example}

The options \textit{opts} can be used
to adjust the placement
by |below| (placed on a separate line below the present line),
|baseline| (smashed at the current baseline),
|bottom| (smashed at the bottom of the present line),
to fine-tune the vertical position by |shift=|\textit{dimen}
or to adjust the symbol by |symbol=|\textit{sym}.
The default position and symbol can be adjusted by
the global settings |markpos|, |marksymbol| and |qedsymbol|.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Frames.}

\DescribeInterfaceMacro{\framecell}
\DescribeControl{framecell}
The package allows to frame cells of an equation block
via issuing a simple command within the cell:
\begin{center}
|\framecell[|\textit{cmd}|]|
\qquad or\qquad
|\eqncontrol{framecell|[|={|\textit{cmd}|}|]|}|
\end{center}
This command corresponds to |\Aboxed| of \ctanpkg{mathtools}.
In particular, when used within columns or aligned mode,
the frame will extend over both right and left alignment components
of a cell; in order to allocate the right amount of space,
it should be issued within the first cell of the pair.
The layout of the frame can be adjusted
by the optional argument \textit{cmd} which defaults to |\fbox|:
it must be a macro which accepts one argument
(or a command sequence which ends with a macro accepting one argument).
Note:
Any semi-automatic punctuation is included within the frame,
see \secref{sec:punctuation}.
Parts of a cell can be framed by the \amsmath/ macro |\boxed|,
which will not include semi-automatic punctuation.
Furthermore, the height and depth of the box are bounded from below
by a strut, see \secref{sec:vspace}.

\DescribeControl{frametag}
Similarly, the package allows to frame tags:
\begin{center}
|\eqncontrol{frametag|[|={|\textit{cmd}|}|]|}|
\end{center}

\begin{example}
\eqnlinesset{number=on}
\begin{scanexample}
\<* x &= \cos\phi \\
\framecell \phi &= \arccos x \>
\end{scanexample}
\showexampleh[0.55]
\begin{scanexample}
\[* \framecell[\fboxrule2pt\fbox]
  \mbox{important} \eqnpunct! \]
\end{scanexample}
\showexampleh[0.55]
\begin{scanexample}
\[ \framecell[\fcolorbox{white}{yellow}]
  \eqncontrol{frametag=\fboxsep2pt\fbox}
  \mbox{highlight}\]
\end{scanexample}
\showexampleh[0.55]
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Single-Line Composition.}

\DescribeInterfaceMacro{\eqnbreak}
\DescribeInterfaceMacro{\eqnsep}
\DescribeInterfaceMacro{\eqnjoin}
Several short pieces of math content
may well fit within a single equation line,
typically separated by some amount of space like |\qquad| or |\qquad|.
The package provides several context-aware commands for this purpose:
the commands |\eqnsep| and |\eqnbreak| insert some horizontal glue,
whereas |\eqnjoin| joins two parts of an equation with some conjunction.
The glue typically includes some amount of shrink
in order to accommodate the content when space is sparse.
Furthermore, |\eqnsep| and |\eqnbreak| also automatically insert
the punctuation for columns and lines, respectively.
\DescribeInterfaceMacro{\\}
\DescribeInterfaceMacro{\&}
For convenience, the line and column break commands `|\\|' and `|\&|'
map to |\eqnbreak| and |\eqnsep|
in single-equation mode where they serves no other purpose;
In stacked multi-line mode `|\&|' maps to |\eqnsep|.
The commands have several optional arguments:
\begin{center}
|\eqnsep|\textbar|\eqnbreak|\textbar|\\|\,%
\textit{mod}|[|\textit{skip}|]|\textvisiblespace
\qquad
|\eqnjoin|[|*|\textbar|[|\textit{skip}|]|]|{|\textit{conjunction}|}|
\end{center}
The modifiers `|.|', `|,|', `|~|', `|`{|\textit{punct}|}|',
`|!|' adjust punctuation and `|*|' chooses a shorter glue,
whereas the optional argument \textit{skip}
specifies the amount of glue explicitly.
\DescribeKey{linesep}
\DescribeKey{colsep}
The default amounts of glue for |\eqnbreak| or `|\\|' and |\eqnsep|
are determined by the settings |linesep| and |colsep|, respectively.
The starred variants |linesep*| and |colsep*|
determine the short amount of glue.

\begin{example}
\begin{scanexample}
\[ x = \cos\phi \\[4em]
\phi = \arccos x \]
\end{scanexample}
\showexampleh
\begin{scanexample}
\[`{,.} x = (z+z^{-1})/2 \\
\phi = -i \log z \]
\end{scanexample}
\showexampleh
\begin{scanexample}
\[ x = \cos\phi \eqnjoin*{\iff}
\phi = \arccos x \]
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Transposition.}

\DescribeKey{transpose}
\DescribeMod{/}
When the aligned mode is used to produce more than one column of equations,
the default line-by-line ordering of the content may be inconvenient.
The package offers a transposition mode |transpose=plain| in which the content
is specified on a column-by-column basis. Columns are separated by `|\&|'
(the character `\&' must be escaped as `|{\&}|' in this mode)
and the lines within each column are broken by `|\\|' as usual.
The continued transposition mode |transpose=cont|
(abbreviated by the modifier `|/|')
furthermore reduces the input by assuming that all secondary
alignment markers `|&|' indicate a continued equation
and imply a line break with an empty left equation cell.
Note that the transposition is implemented by reprocessing the input,
which imposes some restrictions:
all line and column breaks `|\\|', `|\&|' must be explicit
(must not be produced by macro expansion),
line breaks should not use optional arguments
(they only work on the first column),
and each section separated by `|\&|'
should describe only a single column
with one alignment marker per line (unless in continued transposition mode).
Furthermore, the continued mode processes the alignment marker `|&|',
which may cause issues when nesting aligned content.

\begin{example}
\begin{scanexample}
\<[transpose=plain]
x &= \cos\phi \\ &= (z+z^{-1})/2
\&
\phi &= \arccos x \\ &= -i\log z
\>
\end{scanexample}
\showexampleh

\begin{scanexample}
\<[transpose=cont]
x &= \cos\phi &= (z+z^{-1})/2
\&
\phi &= \arccos x &= -i\log z
\>
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{Alternative Content Description.}

\DescribeKey{alt}
\DescribeInterfaceMacro{\eqnalt}
The package provides a basic interface to describe the equation content
in an alternative form for the purposes of accessibility or documentation
(corresponding to the |alt| tag in HTML):
\begin{center}
|alt={|\textit{alt text}|}|
\qquad or \qquad
|\eqnalt[|\textit{opt}|]{|\textit{alt}|}|
\end{center}
At the moment the alternative text \textit{alt} is not processed further,
but an accessibility extension may implement the feature in tagged PDFs
or HTML conversion. The comma-separated optional arguments \textit{opt}
may specify the content further:
|line| and |cell| restrict the applicability
to the current equation line or cell, respectively.
Other keys might specify the content format and language.

\begin{example}
\begin{scanexample}
\<[alt={example equations}]
x &= \cos\phi \\
\eqnalt[line]{reverse relationship}
\phi &= \arccos x \>
\end{scanexample}
\showexampleh
\end{example}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{General Options}
\label{sec:auxiliary}

\DescribeInterfaceMacro{\eqnlinesset}
Options of general nature can be selected by the commands:
\begin{center}
\begin{tabular}{rl}
&|\usepackage[|\textit{opts}|]{eqnlines}|
\\
or&|\PassOptionsToPackage{|\textit{opts}|}{eqnlines}|
\\
or&|\eqnlinesset{|\textit{opts}|}|
\end{tabular}
\end{center}
|\PassOptionsToPackage| must be used before |\usepackage|;
|\eqnlinesset| must be used afterwards.
\textit{opts} is a comma-separated list of options.

The package supplies the following general settings:
\begin{longtable}{ll}
option & description \\
\hline
|defaults=classic|
  & mimic classic \latex//\amsmath/ (layout and dimensions) \\
|defaults=eqnlines|
  & \ctanpkg{eqnlines} layout with fontsize-relative dimensions \\
|linesfallback| & single column in align mode reverts to lines mode \\
                & value |reuse| avoids third measuring pass \\
|equationcr| & determine overloading of `|\\|' for single equations \\
             & |off|: native \latex/ error; |error|: package error; \\
             & |break|: insert horizontal glue (see \secref{sec:further}) \\
|amp| & overload `|\&|' encoding column breaks and equality relations \\
|scanequation| & scan single-line environments |equation|
                 and |\[|\,\ldots|\]| \\
|scanbox| & scan box environments |equationsbox|
                 and |\<|\,\ldots|\>| \\
|scanpar| & allow scanning of |\par| within equation body \\
          & (e.g., for use in nested |\parbox| or |minipage|) \\
|rescan| & rescan environment body for special commands (e.g.\ |\verb|) \\
|modifiereqn| & switch modifiers for equation blocks \\
|modifierbox| & switch modifiers for equation boxes \\
|modifiercr| & switch modifiers for `|\\|' \\
|modifieramp| & switch modifiers for `|\&|' \\
|modifierend| & switch trailing modifiers \\
|modifierwarning| & invoke a warning for unknown environment modifiers \\
|verbose| & track code location in log file for debugging purposes \\
|ampproof| & equip optional argument parsing with protection for `|&|' \\
|nativeequation| & native processing of single-line equations
                   (reduced functionality) \\
\end{longtable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Feature Selection and Package Options}
\label{sec:features}

The following few settings can only be specified when loading the package,
not via |\eqnlinesset|:
\begin{longtable}{ll}
option & description \\
\hline
|env=none| & provide only |equations| and |equationsbox| environments \\
|env=equation| & provide/overwrite |equation|,
                 |displaymath| and |\[|\,\ldots|\]| \\
|env=amsmath| & provide/overwrite \amsmath/ environments
                (including |equation|) \\
|amsmathends|=\textit{bool}  & patch \amsmath/ environments
                   with individual endings \\
|backup|=\textit{bool}  & backup original \amsmath/ environments
                   as |ams...| \\
|ang|=\textit{bool} & provide |\<|\,\ldots|\>| \\
|eqref|=\textit{bool} & provide |\eqref| \\
|matrix|=\textit{bool} & provide \amsmath/ |?matrix|
                         and |cases| environments \\
\end{longtable}

If the above settings are explicitly disabled, the package will only supply
the general purpose environment |equations|
and its boxed cousin |equationsbox|.
In that case, the specific equation environments and other features
can be activated by the command:
\begin{center}
|\eqnlinesprovide{|\textit{features}|}|
\end{center}
\textit{features} is a comma-separated list of features:
\begin{longtable}{ll}
feature & description \\
\hline
\textit{env} & provide/overwrite environment \textit{env}:\\
& |equation|, |equation*|, |displaymath|, |subequations| \\
& |gather|, |multline|, |align|, |flalign|, |xalign|, |xxalign| \\
& |gather*|, |multline*|, |align*|, |flalign*|, |xalign*| \\
& |multlined|, |gathered|, |aligned| \\
\textit{env}|=|\textit{name} &
   provide environment \textit{env} as \textit{name} \\
|sqr| & provide |\[|\,\ldots|\]| \\
|ang| & provide |\<|\,\ldots|\>| \\
|eqref| & provide/overwrite macro |eqref| \\
|tagform| & provide/overwrite macro |\tagform@|\\
|maketag| & provide/overwrite macro |\maketag@@@|\\
\end{longtable}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse
\TODO
\section{List of Options}
\label{sec:lists}

\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Information}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Copyright}
\label{sec:copyright}

Copyright \copyright{} \thecopyright/

Based on the \latex/ package \amsmath/:
Copyright \copyright{}
1995, 2000, 2013 American Mathematical Society;
2016--2024 \latex/ Project and American Mathematical Society.

This work may be distributed and/or modified under the
conditions of the \latex/ Project Public License, either version 1.3
of this license or (at your option) any later version.
The latest version of this license is in
  \url{https://www.latex-project.org/lppl.txt}
and version 1.3c or later is part of all distributions of \latex/
version 2008 or later.

This work has the LPPL maintenance status `maintained'.

The Current Maintainer of this work is Niklas Beisert.

This work consists of the files
|README.txt|, \verbpkg|.ins| and \verbpkg|.dtx|
as well as the derived files listed in \secref{sec:installation}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Credits}
\label{sec:credits}

This package is based on the \latex/ package \amsmath/
(initially named \markpkg{amstex})
which in turn is based on the \tex/ macro system \ctanpkg{amstex}
written by Michael Spivak.
The initial work of porting \ctanpkg{amstex} to \latex/
was done in 1988--1989 by Frank Mittelbach and Rainer Sch\"opf.
In 1994 David M.\ Jones added the support for flush-left layout
and did extensive improvements to the align family of environments
and to the equation number handling in general.
Michael Downes at the AMS served as coordinator
for the efforts of Mittelbach, Sch\"opf, and Jones,
and has contributed various bug fixes and additional refinements over time.
Since 2016, the package has been maintained by the \latex/ Project
with contributions by the above and David Carlisle.

This package has been forked from \amsmath/
in accordance with the LPPL, particularly paragraph 6.
The original package \amsmath/ is available
at CTAN within \ctanpkg{latex-amsmath}.
It uses the basic mechanisms for processing
numbered multi-line equations as developed in \amsmath/
(environments |equation|, |align|, |gather|, |multline|, |gathered|, |aligned|
and related), as well as code implementing these mechanisms.
It differs from \amsmath/ in the following aspects:
\begin{itemize}
\item
The implementations of |split| and methods unrelated to multi-line equations
and equation numbering have been dropped.
\item
Code has been restructured, macros have been renamed and extended.
\item
Numbering and horizontal adjustment schemes have been unified and extended.
\item
Options for math classes surrounding the alignment have been added.
\item
A punctuation scheme has been added.
\item
Vertical spacing has been redesigned.
\item
Optional parameters have been added to environments.
\item
Various configuration options and layout settings have been added.
\item
Cooperation with \ctanpkg{hyperref}, \ctanpkg{showkeys}
and \amsmath/ has been included into the package.
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Files and Installation}
\label{sec:installation}

The package consists of the files:
\begin{longtable}{ll}
    |README.txt|   & readme file \\
    \verbpkg|.ins| & installation file \\
    \verbpkg|.dtx| & source file \\
    \verbpkg|.sty| & package file \\
    \verbpkg|.tex| & reference manual file \\
    \verbpkg|.pdf| & reference manual \\
    \verbpkg|-src.tex| & source code documentation file \\
    \verbpkg|-src.pdf| & source code documentation \\
\end{longtable}
The distribution consists of the files
|README.txt|, \verbpkg|.ins| and \verbpkg|.dtx|.
\begin{itemize}
\item
Run \latex/ on \verbpkg|.ins| to create the package \verbpkg|.sty|
and further documentation files.
\item
Copy the file \verbpkg|.sty| to an appropriate directory of your \latex/
distribution, e.g.\ \textit{texmf-root}|/tex/latex/|\verbpkg.
\item
Alternatively, you may copy \verbpkg|.sty| to your project directory.
\item
Run (pdf)\latex/ on \verbpkg|.tex|
to compile the manual \verbpkg|.pdf| (this file).
\item
Run (pdf)\latex/ on \verbpkg|-src.tex|
to compile the source code documentation \verbpkg|-src.pdf|.
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Related CTAN Packages}

The package is related to other packages available at CTAN:
\begin{itemize}
\item
This package uses the package \ctanpkg{keyval}
to process the options for the package, environments and macros.
Compatibility with the \ctanpkg{keyval} package
has been tested with v1.15 (\markdate{2022-05-29}).
\item
This package reproduces the math environments functionality
of the package \amsmath/.
The present code is based on \amsmath/ v2.17t (\markdate{2024-11-05}).
Compatibility with the \amsmath/ package is maintained
whether \ctanpkg{eqnlines} is loaded before or after \amsmath/.
By default, \ctanpkg{eqnlines} overwrites
most math environments of \amsmath/ with its own implementations.
It can also preserve them as |ams...| if needed.
Alternatively, \ctanpkg{eqnlines} may assign individual names
to the maths environments and preserve the ones of \amsmath/.
The other features provided by \amsmath/
can be used.
\item
The package \ctanpkg{mathtools}
is a popular extension of the \amsmath/ package.
This package incorporates some of the features and improvements
provided by the \ctanpkg{mathtools} package.
Compatibility with the \ctanpkg{mathtools} package
has been tested with v1.31 (\markdate{2024-10-04}),
and it is maintained whether \ctanpkg{eqnlines}
is loaded before or after \ctanpkg{mathtools}.
Some features like emphasising equations via \ctanpkg{empheq}
do not (yet) work.
\item
This package has several overlapping goals and considerations
with the package \ctanpkg{breqn} in handling
long equations more conveniently.
However, the approach is very different from \ctanpkg{breqn}
which mainly aims at automation.
\item
This package cooperates with the package \ctanpkg{hyperref}
to create anchors and references within the electronic document.
Compatibility with the \ctanpkg{hyperref} package
has been tested with v7.01l (\markdate{2024-11-05}).
\item
This package cooperates with the package \ctanpkg{beamer}
in assigning default colours for math content.
Compatibility with the \ctanpkg{beamer} package
has been tested with v3.74 (\markdate{2025-06-15}).
\item
This package supports the display of labels and references
through the package \ctanpkg{showkeys}.
Compatibility with the \ctanpkg{showkeys} package
has been tested with v3.21 (\markdate{2024-05-23}).
\item
This package supports placement of QED symbols within |proof|s
through the |\qedhere| interface of the package \ctanpkg{amsthm}.
Compatibility with the \ctanpkg{amsthm} package
has been tested with v2.20.6 (\markdate{2020-05-29}).
\item
This package supports PDF tagging
using the framework defined in \ctanpkg{tagpdf} and \ctanpkg{luamml}
(when using the |lualatex| engine).
It uses and adjusts some methods from
the development framework \ctanpkg{latex-lab} (|math| and |amsmath| modules).
Compatibility has been tested with the package versions
\ctanpkg{tagpdf} v0.99w (\markdate{2025-10-31}),
\ctanpkg{luamml} v0.7.0 (\markdate{2025-10-20}) and
\ctanpkg{latex-lab} (\markdate{2025-11-01}).
Support for PDF tagging is preliminary, partial and fragile;
it may break due to future developments of the PDF tagging framework.
\item
This package is currently not compatible
with the package \ctanpkg{cleveref}
(thanks to Jon\'a\v s Dujava for pointing out).
The command |\Cref| will not refer properly to equation numbers
recorded by the |equations| environment.
Further features of either package and/or/in combination with \amsmath/
may fail due to the patching by the package.
The alternative package \ctanpkg{zref-clever} appears to work as intended.
Incompatibility with the \ctanpkg{cleveref} package
has been observed for v0.21.4 (\markdate{2018-03-27}).
Compatibility with the \ctanpkg{zref-clever} package
has been tested with v0.5.1 (\markdate{2024-11-28}).
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse
\subsection{Feature Suggestions}

The following is a list of features for consideration
towards future versions of this package.
Their potential use may range between useful and niche;
and their difficulty between easy and impossible.

Documentation:
\begin{itemize}
\item
complete code documentation
\item
list of all option keys with scope, defaults and special values
\end{itemize}

Additional functionality:
\begin{itemize}
\item
alignment for columns mode (two columns as before)
\item
extended columns mode, allow alignment in lines mode
\item
reduce intercolumn space below zero if indentation permits
\item
single column compressible lines in columns mode
(determine alignment line first)
\item
flexible columns mode (note math classes, punctuation, intercolumn space)
\item
routine to compose custom option environments
\end{itemize}

Fix or complete functionality:
\begin{itemize}
\item
|\vspace| for |equationsbox| (requires line container)
\item
adjust PDF tagging with development in kernel,
describe functionality when ready
\item
|\intertext| might not collaborate correctly with PDF tagging
\item
alternative alignment for `|\&:|' to align with relation (further left)
\item
change math classes at following alignment by control (requires cell container)
\item
modifier `|@|' or `|_|' for |\&| to just add space in |columns| mode
\item
scan for `|[]|' after `|;|' to add space; or use other modifier `|@|')
\item
adjust column separation with `|\&[]|' (perhaps use min, also allow shrink?)
\item
skip intercolumn for columns |A=B=C|
\item
clear several columns with `|\&*|'
\end{itemize}

Some technical and/or internal items to be done include:
\begin{itemize}
\item
test files
\item
check documentation for all features
\item
change |\@ifpackageloaded| to |\IfPackageLoaded...|
when command is less recent.
\item
change bool registers to |char| 0 and 1 and |\||ifodd|
\end{itemize}

\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Revision History}

\iffalse

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{vN.N.N+:} \markdate{20YY-MM-DD}

\begin{itemize}
\item
\ldots
\end{itemize}

\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v1.0.1:} \markdate{2026-03-23}

\begin{itemize}
\item
fix for not applying |math text| colour for boxes in \ctanpkg{beamer}
\item
traditional alias values |p|, |b|, |B|, |V| for |matrix| option in boxes
\item
suppress modifier warning for combination `|\>$|' ending a box%$
\item
minor setting adjustments
\item
package maintenance
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v1.0:} \markdate{2026-02-15}

\begin{itemize}
\item
stable release
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.15.2:} \markdate{2026-02-15}

\begin{itemize}
\item
added column punctuation for left column in |cases| boxes
(uses preset |punctcases|)
\item
added column separation |matrixsep| for |matrix| boxes
\item
added glue adjustment |classbreakskip| (muskip) for continued equation |\&;|
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.15.1:} \markdate{2026-02-12}

\begin{itemize}
\item
deactivated numbering for |equations|
and symbolic forms |\[|\,\ldots|\]|, |\<|\,\ldots|\>| by default
(to match with \latex/ and \amsmath/ behaviour;
enable by |\eqnlinesset{number=on}|;
use |\eqnlinesset{sqropt=nonumber}| to keep deactivated for |\[|\,\ldots|\]|)
\item
changed equality relation alignment modifier `\verbbar' to `|?|'
\item
added alignment modifier `\verbbar' for within terms
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.15:} \markdate{2026-02-07}

\begin{itemize}
\item
added column break operator `|\&|'
\item
added equality relation alignment modifiers `|=|', `\verbbar', `|;|' and `|:|'
\item
renamed continued equation modifier to `|/|' (was `|~|')
\item
added options |modifier...| to switch modifiers in various situations
\item
disabled modifiers for |matrix| environments to avoid warnings
\item
disabled modifiers for all environments;
modifiers remain active for symbolic forms
\item
activated numbering for square and angle symbolic forms by default
(revert previous behaviour by |\eqnlinesset{sqropt=nonumber,angopt=nonumber}|)
\item
added and adjusted options and controls for punctuation and equality relations
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.14.1:} \markdate{2026-01-30}

\begin{itemize}
\item
changed math classes for |delim| to open/close
\item
added modifier `|!|' for |equationbox|
(also trailing for |\<|\,\ldots|\>|) and |\\|
to trigger |\eqnapplypunct|
\item
added option |scanbox| to scan box environments
and enable trailing modifiers
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.14:} \markdate{2026-01-28}

\begin{itemize}
\item
added |cases| and |matrix| environments
\item
added punctuation modifiers `|.|' and `|,|'
to |\eqnsep|, |\eqnbreak|, |\\| and |equationsbox|
\item
made |\eqnpunctapply| work within cells and embedded groups
\item
made |\eqnpunct| work for left cells in a column
\item
added modifiers `|<|' and `|>|' for class options |ampeq| and |eqamp|
\item
added option |delim| for delimiter selection
\item
added option |style| for text and display math styles
\item
added option |spread*| to reduce line spread
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.13:} \markdate{2026-01-14}

\begin{itemize}
\item
added trailing modifiers to conveniently adjust punctuation
\item
added |verbose| mode for debugging purposes,
removed |eqnlines-dev| package version
\item
fixed spacing issues with `|\\~|'
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.12.2:} \markdate{2026-01-13}

\begin{itemize}
\item
registered environments with luamml for label processing
\item
use |\eqnlinesprovide| for starred variants separately
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.12.1:} \markdate{2025-12-28}

\begin{itemize}
\item
fixed unwanted deferring of numbering when using |\\~| in continuous mode
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.12:} \markdate{2025-12-27}

\begin{itemize}
\item
split off source code documentation into separate document \verbpkg|-src|
\item
added modified newline `|\\~|' to indicate continued equation
with deferred numbering and punctuation suppressed
\item
added |\eqnsep|,  |\eqnbreak|, |\eqnjoin| for single-line compositions,
mapped `|\\|' for single equations to |\eqnbreak|
\item
added modifier `|`|' to |equationsbox|
\item
removed faulty option |crerror|
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.11:} \markdate{2025-10-25}

\begin{itemize}
\item
added option |punctall| and modifier `|`|'
to specify several levels of punctuation at once
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.10.1:} \markdate{2025-06-23}

\begin{itemize}
\item
fix for setting default colours (|math text|) in \ctanpkg{beamer}
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.10:} \markdate{2025-05-29}

\begin{itemize}
\item
added |numberline| modes |center|, |median|, |top| and |bottom|
with continuous vertical adjustments
(thanks to Jon\'a\v s Dujava for testing)
\item
fixed spacing following |\paragraph|
(thanks to Jon\'a\v s Dujava for report)
\item
added control |inject| to add free-style content after the present line
\item
added control |markline| and |qed| to display a (QED) mark
\item
added support for \ctanpkg{amsthm} through |\qedhere|
(thanks to Jon\'a\v s Dujava for suggestion)
\item
fixed minor issues
\item
internal structure and minor interface changes
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.9:} \markdate{2025-05-18}

\begin{itemize}
\item
option |transpose| to transpose rows and columns in columns mode
(thanks to Christophe Bal for suggestion)
\item
added |\eqncontrol| interface for control within lines and cells
\item
internal structure and interface changes
\item
added |\vspace*| for persistent glue at page breaks
\item
added framed tags (|frametag|)
\item
added |\raisetag!| to enforce raising (or lowering) of tags
even if space is sufficient
\item
added modifiers, relaxed order, changed lines mode modifier from `|~|' to `|=|'
\item
fixed minor issues
\item
thanks to Jon\'a\v s Dujava for various reports and suggestions
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.8:} \markdate{2025-04-30}

\begin{itemize}
\item
added framed cells (|\framecell|)
\item
added automatic best line selection for tag placement
(|best| and |evadetag|)
\item
symbolic environment |\<|\,\ldots|\>| forwards to |equationsbox| in math mode
\item
added wrapping for |equationsbox| (|frame|, |wrap|)
\item
horizontal adjustment reworked and completed; |\shoveby| added
\item
extended |\label| to assign names to labels for |\namedref|
\item
interface for alternative representations (|alt| and |\eqnalt|)
\item
options to adjust line width and margins
(|linewidth|, |marginleft|, |marginright|)
\item
added option |scanpar| to allow |\par| appearing in equation body
\item
added continuous penalties (|prepenalty|, |postpenalty|, |interpenalty|)
\item
added overloading for |displaymath| and remaining \amsmath/ math environments
\item
minor interface changes (rename, recombine, values)
\item
documentation expanded
\item
several issues fixed
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.7.1:} \markdate{2025-04-09}

\begin{itemize}
\item
improvements for PDF tagging
\item
backup all available math environments at the start using |backup| switch
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.7:} \markdate{2025-04-03}

\begin{itemize}
\item
manual expanded, examples added
\item
fixes for numbering, tagging, options, |linesfallback|, zero lines
\item
expansions for vertical spacing modes, tag display, |subeqtemplate|
\item
some consolidations
\item
internal rearrangements
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.6.1:} \markdate{2025-03-27}

\begin{itemize}
\item
|\eqnpunct| can place punctuation within the current equation cell
\item
|numberline=none| now acts as |numberline=all| and |nonumber|
\item
fixed and extended |tagmargin|
with |tagmarginratio| and |tagmarginthreshold|
\item
padding now applies to single-line equations as well
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.6:} \markdate{2025-03-11}

\begin{itemize}
\item
preliminary PDF tagging support
(\url{https://latex3.github.io/tagging-project/};
\amsmath/ \emph{must} be loaded \emph{before} \ctanpkg{eqnlines}
to avoid errors
\item
classic \latex//\amsmath/ vs.\ \ctanpkg{eqnlines} presets
\item
changed vertical spacing schemes and added further options
\item
supplied dimensions processed by |\glueexpr|
\item
more independent of \amsmath/ structures
\item
internal reorganisations
\end{itemize}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\paragraph{v0.5:} \markdate{2025-02-25}

\begin{itemize}
\item
preview version published on CTAN
\item
thanks to Till Bargheer for testing and reports
\end{itemize}


\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%
%% End of file `eqnlines.tex'.
