% Copyright (C) 2026 Quan Sun
% Released under the LaTeX Project Public License, version 1.3c or later.
\documentclass{article}

% mathformule does not explicitly load an auxiliary package.  The section
% option also changes native numbering because both environments share a counter.
\usepackage[section]{mathformule}

% Add 1pt to the normal row separation in every multiline formule.  A local
% lineskip key, when present, replaces this correction for that environment.
\formuleskip{1pt}

\begin{document}
\section{Feature overview}

Native equation and formule numbers form one sequence.
\begin{equation}\label{eq:native-first}
  e^{i\pi}+1=0
\end{equation}

\begin{formule}\label{eq:single}
  E=mc^2
\end{formule}

Without a top-level ampersand, multiline rows share their left edge.  A
leading ampersand is also valid and explicitly leaves the first column empty.
\begin{formule}[multnum={arabic-roman},lbrace,lineskip=0pt]
  &f(x)=a+b \\
  &abc=cd
\end{formule}

Ampersands align columns and double backslashes end rows.  By default all
rows share one number.  The preamble setting adds 1pt to the normal row
spacing, and \verb|\\[2pt]| adds another 2pt after only the first row.
\begin{formule}\label{eq:shared}
  (a+b)^2 &= a^2+2ab+b^2 \\[2pt]
  (a-b)^2 &= a^2-2ab+b^2 \\
  (a+b)(a-b) &= a^2-b^2
\end{formule}

The value of \verb|lbrace| is placed in math mode before a brace covering all
rows.  \verb|lbraceskip| is a signed correction to the normal brace gap.  A
final row break, as used here, is optional and harmless.
\begin{formule}[lbrace={f(x)=},lbraceskip=2pt]\label{eq:left-brace}
   x^2, & x>0 \\
   0,   & x=0 \\
  -x,   & x<0 \\
\end{formule}

The right-side keys work symmetrically; negative corrections are accepted.
Here the local \verb|lineskip| value overrides the global correction.  Since
there is no ampersand, the two rows are left aligned automatically.
\begin{formule}[rbrace={=S},rbraceskip=-1pt,lineskip=-1pt]
  u+v=7 \\
  2u-v=5
\end{formule}

Bare \verb|multnum| uses Arabic subnumbers joined by a dot.  A row carrying
\verb|\notag| or \verb|\nonumber| has no number and consumes no subnumber.
\begin{formule}[multnum]
  x_1 &= y_1 \label{eq:dot-a} \\
  x_2 &= y_2 \notag \\
  x_3 &= y_3 \label{eq:dot-b} \\
\end{formule}

The other three subnumber styles are shown below.  Up to four alignment pairs
per row are supported in multnum mode.
\begin{formule}[multnum={arabic-arabic}]
  a_1 &= b_1 & c_1 &= d_1 \label{eq:dash-a} \\
  a_2 &= b_2 & c_2 &= d_2 \label{eq:dash-b}
\end{formule}

\begin{formule}[multnum={arabic.roman}]
  p_1 &= q_1 \label{eq:roman-dot-a} \\
  p_2 &= q_2 \label{eq:roman-dot-b}
\end{formule}

\begin{formule}[multnum={arabic-roman},rbrace={=T}]
  r_1 &= s_1 \label{eq:roman-dash-a} \\
  r_2 &= s_2 \label{eq:roman-dash-b}
\end{formule}

With only one row, \verb|multnum| is intentionally ignored.
\begin{formule}[multnum={arabic-roman}]\label{eq:single-multnum}
  u^2+v^2=w^2
\end{formule}

The following native equation continues the shared main sequence.
\begin{equation}\label{eq:native-last}
  \sum_{k=1}^{n}k=\frac{n(n+1)}{2}
\end{equation}

Cross-references: \ref{eq:native-first}, \ref{eq:single}, \ref{eq:shared},
\ref{eq:left-brace}, \ref{eq:dot-a}, \ref{eq:dot-b},
\ref{eq:dash-a}, \ref{eq:dash-b}, \ref{eq:roman-dot-a},
\ref{eq:roman-dot-b}, \ref{eq:roman-dash-a}, \ref{eq:roman-dash-b},
\ref{eq:single-multnum}, and \ref{eq:native-last}.

\end{document}
