On 22 October 2012 16:05, Marc Grober <
marc....@gmail.com> wrote:
> I thought you had produced a MathJax implementation for longdiv or
> polynom and raced to the URL ;-)
well...
That was producing MathML3 mlongdiv which mathjax doesn't like much,
but it was also producing a plain text ascii art representation. With
a bit of encouragement that can be annotated with latex commands
making it into a array-and-underline combination that doesn't have the
accessibility advantages of mlongdiv but does have the advantage of
working with mathml2 systems such as mathjax.
Something like:
\def\?{\phantom{0}}
\begin{array}{r@{}l}
&\?\?\?37986704\\
325\hspace{.2em})\hspace{-.2em}\overline{\strut\hspace{1em}}\hspace{-1.5em}&\overline{\strut12345678912}\\
&\underline{\?975}\\
&\?2595\\
&\?\underline{2275}\\
&\?\?3206\\
&\?\?\underline{2925}\\
&\?\?\?2817\\
&\?\?\?\underline{2600}\\
&\?\?\?\?2178\\
&\?\?\?\?\underline{1950}\\
&\?\?\?\?\?2289\\
&\?\?\?\?\?\underline{2275}\\
&\?\?\?\?\?\?\?141\\
&\?\?\?\?\?\?\underline{\?\?\?0}\\
&\?\?\?\?\?\?\?1412\\
&\?\?\?\?\?\?\?\underline{1300}\\
&\?\?\?\?\?\?\?\?112
\end{array}
Then I just had to get my head round some of the examples Davide has
posted from time to time on how to hook a JavaScript function as the
back end for a new tex macro \longdiv and:
http://html5mathml.googlecode.com/svn/trunk/longdiv-mj-mml2.html
The body of which is simply
<body>
<p>\longdiv{
12345678912}{325}</p>
$$
\longdiv{
12345678912}{325}
$$
<p>\longdiv{534}{17}</p>
$$
\longdiv{534}{17}
$$
</body>
with mathjax rendering the displays as long division.
It isn't quite right yet (column alignment is out by one in some cases
but that can't be that hard to fix when I'm next awake)
David
--
http://dpcarlisle.blogspot.com/