I want something like
5 + 4 + 3 + 2 + 1
4 + 3 + 2 + 1
…
1
How to do it with MathJax?
A method using AMS math environments:
\begin{align}
5+4+3+2+1&\\
4+3+2+1&\\
\vdots&\\
1&
\end{align}
\begin{align} 5+4+3+2+1&\\ 4+3+2+1&\\ \vdots&\\ 1& \end{align}
Multicolumn:
\begin{align}
5+4+3+2+1&&5+4+3+2+1\\
4+3+2+1&&4+3+2+1\\
\vdots&&\vdots\\
1&&1
\end{align}
\begin{align} 5+4+3+2+1&&5+4+3+2+1\\ 4+3+2+1&&4+3+2+1\\ \vdots&&\vdots\\ 1&&1 \end{align}
Remark:
align
and align*
.\begin{...}...\end{...}
as math environments, so there is no need to enclose them with $$...$$
.I just found that aligned
is right-aligned by default. So it could simply be done like this:
$$\begin{aligned}
5+4+3+2+1\\
4+3+2+1\\
\vdots\\
1
\end{aligned}$$
Result: $$\begin{aligned} 5+4+3+2+1\\ 4+3+2+1\\ \vdots\\ 1 \end{aligned}$$
You can do it as follows:
$$\begin{array}{ccccccccc}5&+&4&+&3&+&2&+&1\\ &&4&+&3&+&2&+&1\\ &&&&&&&&\vdots\\ &&&&&&&&1\end{array}$$
You will get:$$\begin{array}{ccccccccc}5&+&4&+&3&+&2&+&1\\ &&4&+&3&+&2&+&1\\ &&&&&&&&\vdots\\ &&&&&&&&1\end{array}$$
$$\begin{array}{r}5+4+3+2+1\\4+3+2+1\\\end{array}$$
$$\begin{array}{r}5+4+3+2+1\\4+3+2+1\\\end{array}$$
$\endgroup$
Another implementation is by semi-manually adding the correct space with \phantom
, which could be useful if it appears inside more complicated objects:
\begin{align}
15
&=5+4+3+2+1\\
-5+15
&=\phantom{5+{}}4+3+2+1\\
-4-5+15
&=\phantom{5+4+{}}3+2+1\\
-3-4-5+15
&=\phantom{5+4+3+{}}2+1\\
-2-3-4-5+15
&=\phantom{5+4+3+2+{}}1\\
\end{align}
code (without things on the left of the $=$ sign)
\begin{align}
&=5+4+3+2+1\\
&=\phantom{5+{}}4+3+2+1\\
&=\phantom{5+4+{}}3+2+1\\
&=\phantom{5+4+3+{}}2+1\\
&=\phantom{5+4+3+2+{}}1\\
\end{align}
NB the {}
s are needed so that +
gives the spacing of a binary operator.