Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Way to show long division symbol )‾‾‾‾‾‾ in MathJax

Tags:

latex

mathjax

Is there a way to format long division in MathJax so it looks like this:

     125     (Explanations)
   4)500
     4        (4 ×  1 = 4)
     10       (5 -  4 = 1)
      8       (4 ×  2 = 8)
      20      (10 -  8 = 2)
      20      (4 ×  5 = 20)
       0      (20 - 20 = 0)

but obviously correctly formatted?

like image 333
Jamie Twells Avatar asked Apr 04 '14 16:04

Jamie Twells


People also ask

How do you make a division symbol in latex?

\div is a mathematical symbol, so it should be inside a math formula: $6\div 3=2$ should work. If you want to use it in text, do \usepackage{textcomp} and use \textdiv .

How do you insert a long division symbol in Word 2007?

To get the long division symbol (not ÷) on Microsoft Word document - Type 27cc then press Alt+X. (If you're not familiar, that meant to hold down the Alt key, then press and release the X key. Not necessary to press Shift.)


2 Answers

Here is a modification of Werner's answer that gets you what you want. It uses MathJax's enclose extension to insert a MathML <menclose> element that handles the long-division symbol.

$$
\require{enclose}
\begin{array}{rll}
    125 && \hbox{(Explanations)} \\[-3pt]
   4 \enclose{longdiv}{500}\kern-.2ex \\[-3pt]
      \underline{4\phantom{00}} && \hbox{($4 \times 1 = 4$)} \\[-3pt]
      10\phantom{0} && \hbox{($5 - 4 = 1$)} \\[-3pt]
      \underline{\phantom{0}8\phantom{0}} && \hbox{($4 \times 2 = 8$)} \\[-3pt]
      \phantom{0}20 && \hbox{($10 - 8 = 2$)} \\[-3pt]
      \underline{\phantom{0}20} && \hbox{($4 \times 5 = 20$)} \\[-3pt]
      \phantom{00}0
  \end{array}
$$

The result is

enter image description here

like image 100
Davide Cervone Avatar answered Oct 30 '22 15:10

Davide Cervone


You can use

$$
  \begin{array}{rl}
    \underline{125} & \hbox{(Explanations)} \\[-5pt]
    4 | 500 \\
      \underline{4\phantom{00}} & \hbox{($4 \times 1 = 4$)} \\
      10\phantom{0} & \hbox{($5 - 4 = 1$)} \\
      \underline{\phantom{0}8\phantom{0}} & \hbox{($4 \times 2 = 8$)} \\
      \phantom{0}20 & \hbox{($10 - 8 = 2$)} \\
      \underline{\phantom{0}20} & \hbox{($4 \times 5 = 20$)} \\
      \phantom{00}0
  \end{array}
$$

This is how it renders on Math.SE:

enter image description here

like image 37
Werner Avatar answered Oct 30 '22 16:10

Werner