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

纵饮孤独 提交于 2019-12-21 05:22:11

问题


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?


回答1:


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




回答2:


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:



来源:https://stackoverflow.com/questions/22867785/way-to-show-long-division-symbol-in-mathjax

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!