3

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.

with_arrows_mwe_output

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.

2

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.

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

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

I would use the option b of the environment WithArrows:

\begin{equation}
   \begin{WithArrows}[b,displaystyle]
   line 1 \\
   line 2 \\
   ...
   last line % without \\
   \end{WithArrows}
   \label{...}
\end{equation}
  • 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.