TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

We want to show that -2 = 2.
$-2 = 2$ & assuming the conclusion \\
$(-2)^2 = 2^2$ & square both sides \\
$4$ = $4$ & as desired


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.

share|improve this question
up vote 7 down vote accepted

Do it simpler.

\usepackage{mathtools}   % loads »amsmath«

  We want to show that $-2=2$.
      -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}
share|improve this answer
This is simpler, but it doesn't have a vertical bar between the steps and the explanations like my example had. Can such a vertical line be added? – Harold Jan 22 '11 at 23:43
See my edits above. – Thorsten Donig Jan 23 '11 at 11:31
Smashing! (no pun intended :) – Harold Jan 23 '11 at 16:01
We want to show that $-2 = 2$.

-2     &= 2   & \text{ assuming the conclusion}\\
(-2)^2 &= 2^2 & \text{ square both sides} \\
4      &= 4   & \text{ as desired}

share|improve this answer
Very nice. I learned a lot from this. Thank you. – Harold Jan 23 '11 at 0:00
  • 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}.

share|improve this answer
Neat tips, thanks. – Harold Jan 22 '11 at 23:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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