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


    {(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

As seen in eq~\ref{eq:aplusbsquared}, blah blah ....

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.


The version 1.7 of witharrows (2018, Jul 18) provides new environments {DispWithArrows} and {DispWithArrows*} which give a way to control numbers, tags and labels in a way similar of the environments {align} and {align*} of amsmath.

A & = B \Arrow{text} \notag \\
  & = C \notag \\
  & = D \notag \\
  & = E \label{my-equation}

Reference to the equation \ref{my-equation}.

I would use the option b of the environment WithArrows:

   line 1 \\
   line 2 \\
   last line % without \\
  • Thank you for the solution. Much appreciate it. Have accepted the answer. – Krishna Jul 7 '18 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.