For some mathematical derivations, I am using the witharrows
package.
How can I typeset the equation number for the last equation and assign a label to it for later cross-references in text?
The following is a MWE
\documentclass{article}
\usepackage{witharrows}
\begin{document}
$\begin{WithArrows}[displaystyle]
{(a + b)}^2 &= {(a + b)}{(a + b)} \Arrow{FOIL operations} \\
{} & = a\cdot a + a \cdot b + b \cdot a + b \cdot b \Arrow{evaluate each sub-expression}\\
{} & = a^2 + ab + ba + b^2 \Arrow{scalar multiplication is commutative}\\
{(a + b)}^2 & = a^2 + 2ab + b^2 % <---- typeset this equation and assign label/tag, e.g. eq:aplusbsquared
\end{WithArrows}$
As seen in eq~\ref{eq:aplusbsquared}, blah blah ....
\end{document}
I would like to assign an equation number to the last equation and cross-reference it later in text.
I tried all standard methods. \label
, \tag
etc. do not work since this package is based on aligned
environment. Any help will be much appreciated.