[Tex/LaTex] Using tables to typeset proof – how to align equal signs

aligntables

I'm a student teaching myself to use LaTeX (and related tools) to type up my homework. It's going great, and I'm already very happy with what I've been able to do so far. Though, I have questions.

I'm trying to type up a proof with steps in one column and explanations in a second column, separated by a nice vertical bar. A two column table has gotten me most of the way there:

\documentclass[a4paper,12pt]{article}
\usepackage{amsthm}
\begin{document}
We want to show that -2 = 2.
\begin{proof}
\begin{tabular}{r|l}
$-2 = 2$ & assuming the conclusion \\
$(-2)^2 = 2^2$ & square both sides \\
$4$ = $4$ & as desired
\end{tabular}

\end{proof}
\end{document}

However, the equals signs in the left column don't line up. Ideally, I'd like to be able to line them up as I would in an align environment or similar. Can this be done?

Moreover, I don't really like having to repeat the $ on every row of the left column. Is there a way to automate that?

Thanks in advance for any answers, this is my first question here too, so please let me know if I've accidentally violated any mores of this community.

Best Answer

Do it simpler.

\documentclass[12pt,a4paper]{article}
\usepackage{mathtools}   % loads »amsmath«
\usepackage{amsthm}

\begin{document}
  We want to show that $-2=2$.
  \begin{proof}
    \begin{align*}
      -2 &= 2 && \smash{\Big|}\text{ assuming the conclusion} \\
      (-2)^2 &= 2^2 && \smash{\Big|}\text{ square both sides} \\
      4 &= 4 && \smash{\Big|}\text{ as desired}
    \end{align*}
  \end{proof}
\end{document}