1
$\begingroup$

I have this

\begin{array}{r} sum &= 1 + 2 + \ldots + (n - 1) + n \\[1ex] + \; sum &= n + (n-1) + \ldots + 2 + 1 \\ \hline 2\,sum &= (n +1) + (n+1) + \ldots + (n+1) + (n+1) \end{array}

for displaying the Gauss trick for summing integers proof, but the alignment is not great. Any suggestions on how to improve this?

$\endgroup$
  • 2
    $\begingroup$ You have not aligned the right-hand column. If you align it to the left then it will align to the equals sign. Use \begin{array}{rl}. If you also want to align the plus signs then you can use the array to do this manually, by putting each plus sign and each number in its own cell. $\endgroup$ – user1729 Feb 11 at 17:49
  • 3
    $\begingroup$ (incidentally, I would have used the align environment for what you wrote, rather than array: \begin{align*}sum&=1+2+\ldots+(n-1)+n\\...\\ \hline 2sum&=...\end{align*}. I would use array to align the plus signs, but that may not be good LaTeX practice...) $\endgroup$ – user1729 Feb 11 at 17:54
3
$\begingroup$

$$ \begin{array}{rrcccccccccc} &\text{sum}&=&1&+&2&+&\dots&+&(n-1)&+&n\\ +&\text{sum}&=&n&+&(n-1)&+&\dots&+&2&+&1\\ \hline &2\;\text{sum}&=&(n+1)&+&(n+1)&+&\dots&+&(n+1)&+&(n+1) \end{array} $$

$$
\begin{array}{rrcccccccccc}
 &\text{sum}&=&1&+&2&+&\dots&+&(n-1)&+&n\\
+&\text{sum}&=&n&+&(n-1)&+&\dots&+&2&+&1\\
\hline
 &2\;\text{sum}&=&(n+1)&+&(n+1)&+&\dots&+&(n+1)&+&(n+1)
\end{array}
$$
$\endgroup$
  • $\begingroup$ I just guessed this was the place to ask MathJax questions. Am I right? Also, is there a proper SE MathJax tutorial? I'm still confused by the MathJax - LaTeX gap, i.e., an answer found on SE.Tex doesn't always render in MathJax. $\endgroup$ – 147pm Feb 11 at 20:22
  • $\begingroup$ @147pm I don't recall when & where now, but I have seen a link to MathJax basic tutorial and quick reference several times. As far as I know, this is the "official" basic MathJax tutorial, and I've used its contents to answer most of my SE MathJax questions. $\endgroup$ – John Omielan Feb 11 at 20:47
  • $\begingroup$ Since you've used it above, what's the syntax to display a block of code? (As opposed to individual lines of code.) $\endgroup$ – timtfj Feb 11 at 22:13
  • 1
    $\begingroup$ @timtfj meta.stackexchange.com/questions/22186/… $\endgroup$ – Mike Earnest Feb 11 at 22:16
  • $\begingroup$ @Mike Thanks! It looks as though the button in the editor is easiest. (Though those lists of bullet points in the post could really do with specifying AND or OR between them! At first I thought I was reading a sequence of instructions, not alternative methods.) $\endgroup$ – timtfj Feb 11 at 22:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .