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$
3

3 Answers 3

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$
2
  • $\begingroup$ @DanielR: anytime there is MathJax, you can right-click on the rendered MathJax and choose "Show Math As > TeX Commands". $\endgroup$
    – robjohn Mod
    Mar 22, 2014 at 10:34
  • $\begingroup$ Ah, didn't know that. Thanks! $\endgroup$
    – Daniel R
    Mar 22, 2014 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$
0
4
$\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 .