Using tables to typeset proof - how to align equal signs?

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}

\documentclass[a4paper,12pt]{article}
\usepackage{amsthm,amsmath}
\begin{document}
We want to show that $-2 = 2$.

\begin{proof}
$\arraycolsep=1.5pt
\begin{array}[t]{rl|l}
-2     &= 2   & \text{ assuming the conclusion}\\
(-2)^2 &= 2^2 & \text{ square both sides} \\
4      &= 4   & \text{ as desired}
\end{array}$
\end{proof}

\end{document}

  • You could use further columns to align also the equal signs. For example, you could use a r column followed by a c column for the relation sign which is followed by a l column.

  • The array package allows to insert commands into the table column definition. For example, to get a right aligned math column, use >{$}r<{$}.

  • If all formulas are equations, you could eben specify the equal sign as the column separator: \begin{tabular}{>{$}r<{$}@{\,=\,}>{$}l<{$}|l}.

Tags:

Tables

Align