6
$\begingroup$

I want to make something like this with MathJax:

1 2 4
+ 5 3
------
1 7 7

How would I go about doing so? I searched on the TeX website, but people only gave answers with stuff like ${\$\$}$\begin{tabular}{cccc}$$, which only works for LaTeX, and not MathJax. Is there a way to render the above equation in MathJax, and how?

$\endgroup$
  • 1
    $\begingroup$ Array works with MathJax. It has a lot of common with tabular. See, for example meta.math.stackexchange.com/questions/6734/…, meta.math.stackexchange.com/questions/4240/… and other questions, that are linked there. $\endgroup$ – Martin Sleziak Mar 22 '14 at 5:46
  • $\begingroup$ @MartinSleziak I don't want a table in my addition equation... Is it impossible to create an addition equation vertically without having to create a table? At the very least, make the table edges invisible if at all possible. $\endgroup$ – TrueDefault Mar 22 '14 at 5:51
  • $\begingroup$ JChau: So this is not what you are looking for? $\endgroup$ – Martin Sleziak Mar 22 '14 at 6:05
8
$\begingroup$

One could use the array environment: $$ \begin{array}{r} &124\\ +\!\!\!\!\!\!&53\\ \hline &177 \end{array} $$ $\LaTeX$ source:

\begin{array}{r}
&124\\
+\!\!\!\!\!\!&53\\
\hline
&177
\end{array}
$\endgroup$
  • $\begingroup$ @DanielR: anytime there is MathJax, you can right-click on the rendered MathJax and choose "Show Math As > TeX Commands". $\endgroup$ – robjohn Mar 22 '14 at 10:34
  • $\begingroup$ Ah, didn't know that. Thanks! $\endgroup$ – Daniel R Mar 22 '14 at 12:01
6
$\begingroup$

Using only one column and adding some (positive) space after the plus is better than using negative space to fiddle with the two column spacing, in my opinion. I think the other version will fail in native MathML mode in firefox, for example, as it doesn't handle negative space very well.

\begin{array}{r} 124\\ +\quad 53\\ \hline 177 \end{array}

$\endgroup$
3
$\begingroup$

If you don't like "array", there is also "align" $$\begin{align} 124& \\ \underline{+\quad 53}& \\ 177& \end{align}$$

$$\begin{align} 124& \\ \underline{+\quad 53}& \\ 177& \end{align}$$

$\endgroup$

You must log in to answer this question.

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