[Tex/LaTex] Underline inside eqnarray


I have now the version


and want to change it to something like

I want it like this

The equations are in eqnarray and I want to underline only the last line. Is this possible?

Best Answer

The trick is to underline the parts to the left and the right of the & separately. The \mathstruts are used to vertically align the two halves and add extra space before the = and below the denominator. For large structures one can use \vphantom to equalize the depths.


\frac{12(x+7y)}{4} - \frac{12(3x+8y)}{3} &= 1 \cdot 12\\
\underline{\frac{21(3x+4y)}{\mathstrut 3} - \frac{21(4x+5y)}{7}} &
\underline{\vphantom{\frac{21(3x+4y)}{\mathstrut 3} - \frac{21(4x+5y)}{7}}=4 \cdot 21}\\
-9x - 11y &= 12\\
\underline{\mathstrut 9x + 43y} &\underline{\mathstrut= 84}