I'm new to LaTeX and I'm trying to figure out how to correctly format a proof. Can someone show me a basic template for how to do this?

The part I am having the most trouble with is creating new columns and customizing alignment... for instance, how do I add a right-aligned annotation (i.e. by distributive property) to a line of this sample proof? Should I use eqnarray* or is there a better option?

Consider \eqnarray vs align with regards to your last question of using eqnarray*. The short of it is that you should rather avoid it in lieu of something like the align environment from amsmath.
– WernerSep 2 '11 at 16:57

4 Answers
4

Adding to egreg's remarks: to add right-aligned annotation — in parentheses — you can use the \tag macro; to have annotation without parentheses, use the \tag* macro. (This must be given before the line-break; for this reason, I like to put the line break immediately before the following line, but that's just my personal style.) And again, as egreg noted, you should use \qedhere on the last line of an equation environment, if your proof ends at an equation.

If you find yourself having multi-line equations where you want equation numbers — but only on the last line — the macro \notag will also come in handy. (I insert them just before the line-breaks, to make it easy to copy the sequence \notag \\ &= for multi-line equations.)

I wouldn't abuse \tag for annotations: with the lefteqn option they will go to the wrong side. Use rather align's features: a&=b &&\text{remark}
– egregSep 2 '11 at 17:14

Hm. I didn't know that, perhaps as a result of not using lefteqn. I adopted this method (those rare times when I've used it) as it is a way of getting remarks flush with equation numbers.
– Niel de BeaudrapSep 2 '11 at 17:23

@alexjlockwood: typically, it means "advance to the next column". In eqnarray (don't use it!) equations are blocked into groups of three columns: right-aligned, center-aligned, and left-aligned, after which you jump rightwards some distance to start a new equation further to the right. In align, equations are blocked into groups of two columns: right-aligned, and left-aligned. You'll also encounter & any time you use a table, or a matrix, or similar sorts of environments.
– Niel de BeaudrapSep 2 '11 at 17:37

3

@alex: Jumping of Niel's comment, there is a somewhat more specialized environment called alignat that gives you complete control over how the equation breaks into columns. It's useful if you have several stacked equations which should be aligned at multiple points, with appropriate padding added to make that happen. I only mention it because this effect is impossible to obtain otherwise, but it will be a long time before you need to use it. You should read amsldoc.pdf (or the result of texdoc amsmath) to learn about how these things work.
– Ryan ReichSep 2 '11 at 18:01

The alignment is better (eqnarray should never be used for serious mathematical writing) and, moreover, the "end-of-proof" can be placed aligned with the last equation; \qedhere is necessary only when the proof ends with an alignment environment or with a list (enumerate, itemize or description); the && before \qedhere is only necessary when there are other comments.

thanks for the info! should the QED symbol always be placed to the far right of the last line of text? is that convention?
– Alex LockwoodSep 2 '11 at 17:28

@alex: It has become convention because of how amsmath places the symbol :) The important point is that you should use \qedhere if the last line is inside an equation, since otherwise the QED ends up alone on the next line, which is ugly.
– Ryan ReichSep 2 '11 at 17:57

4

@alex, @Ryan -- the qed symbol (sometimes called the "tombstone") was placed to the far right by many math publishers long before amsmath came into being. that said, the position is considered to be a "house style". the originator appears to be Paul Halmos; see Handbook of Writing for the Mathematical Sciences, by Nicholas J. Higham, quote on p.11. before the square, "qed" in small caps was often used to indicate the end of a proof, and some authors still prefer that.
– barbara beetonSep 2 '11 at 19:15

"eqnarray should never be used for serious mathematical writing" - I've used it for 10 years now ...
– Martin BrandenburgMar 28 '15 at 1:50

This is not an elegant solution but might be an option nevertheless. You can also fake it with a tabular. This way, you can print some borders if you want (just in case of those provide-the-missing-part tests so loved by some high school math teachers).