long division symbol in DragMath?
Number of replies: 13I've run into a couple of snags. I have perfected making the fractions using DragMath. However, I really need the long division symbol for my lesson on dividing decimals and can't seem to figure this out for the life of me. If you know how to make this symbol, I would REALLY appreciate your help.
I am also having trouble when I am trying to line up the decimals in adding/subtracting questions. I use the space bar to line them up in my editing box and all looks good. But then when I 'save and display', all my spaces get taken out and things are no longer lined up. It ends up being a confusing mess.
These 2 things are incredibly frustrating...and help?? PLEASE.
Thanks in advance.
Steph
Re: long division symbol in DragMath?
As I understand your problem its not that you can't find the division sign, but that you want to show long division and do the long division in dragmath?
That is a bit of a problem in that there is really no long division symbol.... it is a combination of a paren and a bar....
Here is an example of long division using tex:
$$\begin{array}{r@{}r@{}r@{}}
&&2\\
\cline{2-3}
5\;|&\;1&2 \\
&1&0 \\
\cline{2-3}
&&2 \\
\end{array}$$
Dragmath is easily extensible and I think there might be some ways to get you where you want to go, but I will have to find some time to fiddle with that a bit and see if we could cobble something in the xml (as opposed to trying to edit the java) and I wil have to get back to you on that.
As far as decimals, you don;t want to use leading zeros?

Re: long division symbol in DragMath?
I guess I would have to do something like this and put in zeros?
1269 divided by 3 would look like this...
00423
3)1269
But even still they don't quite line up, do they...not to mention it looks awful and will probably be confusing for literacy students. (also, for the top of the long division symbol are you just underlining??)
This was the same kind of issue when wanting to multiply decimals like this 3.24 x 3
3.24
x003
looks awful too and again confusing since 3 is supposed to be a whole number.
Re: long division symbol in DragMath?
Otherwise you could use either of the tex expressions I posted earlier if your tex is configured correctly.....
$${\begin{array}{@{}r@{}l@{}r@{}}
& & a\\
\cline{2-3}
b & \big) & c\\
\end{array}}}$$
$${\begin{array}{@{}r@{}l@{}r@{}}
& & \:a\\
\cline{2-3}
b & \big) & cd\\
\end{array}}}$$
Guide here to help with tex commands like, yes, spacing.... ;=}
http://www.artofproblemsolving.com/LaTeX/AoPS_L_GuideLay.php
The key is getting your tex working.....
AT present MathML menclose which would allow us to do this in asciimath won't be supported in Firefox for a few months....
Re: long division symbol in DragMath?
Re: long division symbol in DragMath?
... and an edited image from print preview screenshot (preview can be zoomed) attached
I would prefer latex here otherwise but code gets rather complex. Font in Excel is Arial Unicode MS to produce symbols like arrows. You can also edit cell width, height etc to make it look better...

Re: long division symbol in DragMath?
\begin{array}{r@{}r@{}r@{}}&&2\\\cline{2-3}5\;|&\;1&2 \\&1&0 \\\cline{2-3}&&2 \\\end{array}
I also found this suggestion:
\setlength{\tabcolsep}{1pt}
12\,\begin{tabular}{|lllll}
\hline
1 & 2 & 3 & 4 & 5 \\
\end{tabular}
$$\setlength{\tabcolsep}{1pt}
12\,\begin{tabular}{|lllll}
\hline
1 & 2 & 3 & 4 & 5 \\
\end{tabular}$$
Of course there are the longdiv macros which will help with setting longdiv (see e.g. http://users.comlab.ox.ac.uk/jeremy.gibbons/hiw/hey-18n2.ps and http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=longdiv ), but of course you would need something in dragmath to invoke the macro
But I also wrote to Chris Sangwin about some shortcuts as my efforts to kludge a solution for you were pretty gnarly.....
Re: long division symbol in DragMath?
Re: long division symbol in DragMath?
What I provided was actual Tex, which is what dragmath can produce - Are you running the Tex filter in your Moodle? Are you the Moodle admin for your Moodle? Can you upload a screen capture of what you did get? Its possible if your tex filter is not fully functional you are getting a display via mimetex and that doesn;t always handle things appropriately.
That all being said and assuming you are not your Moodle admin, ask your Moodle admin about use of Tex macros (such as longdiv) which would make things much easier for you as then you would only need to say \longdiv{numerator}{denominator}, which won't work in Moodle: $$\longdiv{4}{2}$$ is not what \longdiv{4}{2} is supposed to produce.
Here is a note from Areseneau regarding /longdiv http://www.mail-archive.com/lyx-users@lists.lyx.org/msg13750.html in which he provides a rather crude simplediv command related to an example I provided earlier:
\newcommand{\simplediv}[3]{\ensuremath{\begin{array}{@{}r@{}l@{}r@{}}
& & #3\\
\cline{2-3}
#2 & \big) & #1\\
\end{array}}}
Here's a note on using sty files.....
http://www.artofproblemsolving.com/LaTeX/AoPS_L_GuidePack.php
Re: long division in Moodle
This is an example taken from this tip: http://www.tug.org/TUGboat/hiw/hey-18n2.ps
$$\newdimen\digitwidth
\settowidth\digitwidth{0}
\def~{\hspace{\digitwidth}}
\def\divrule#1#2{%
\noalign{\moveright#1\digitwidth%
\vbox{\hrule width#2\digitwidth}}}
13\,\begin{tabular}[b]{@{}r@{}}
949 \\ \hline
\big)\begin{tabular}[t]{@{}l@{}}
12345 \\
117 \\ \divrule{0}{4}
~~64 \\
~~52 \\ \divrule{2}{3}
~~125 \\
~~117 \\ \divrule{2}{3}
~~~~8
\end{tabular}$$
And this should produce a division problem $$346/4$$ if Moodle tex includes the longdiv macro......
$$\mbox{\longdiv{346}{4}}$$
Not happening......
Re: long division in Moodle
Unfortunately, since I am new to Moodle and not a super techster, a lot of it doesn't make sense to me.
I guess I was hoping the answer would be easy and something I just missed. I am surprised to hear this isn't the case.
Thanks again for trying.
Steph
Re: long division symbol in DragMath?
Mauno has pointed out here:
http://moodle.org/mod/forum/discuss.php?d=122098&parent=537270
that there is an underlying issue with using Tex macros.
However, one could compare the macro as against the blacklist, delete the necessary items from the blacklist, upload the macro, rehash text and you will be able to access the macros. I don't think this is going to present any major security risk for you if your moodle is completely locked down (i. e. only your own vetted users have access)
Re: long division symbol in DragMath?
Yes, I agree.
Most of those blacklisted commands are not necessarely dangerous but some commands like \def in a wrong place may result in an infinite loop and can also be used for Denial of Service attacks - everybody who has tried to study programming has sometimes caused some unexpected loops ... and that's why some innocent looking commands like \line are blacklisted - to be honest I have never tried to draw an infinite line loop... maybe spirals or fractals sometimes
Re: long division symbol in DragMath?
But there is no such thing as a secure system unless you eliminate users... all a matter of relative security... as was argued by iñaki, is doing anything actually within confines of existing GUI to be considered a DoS attack? My guess is we could easily figure a way to keep a server busy.... but it would be only one page, one process, and would be addressed pdq.... so such actions while presenting a risk, present a risk arguably so nominal as to be worth limiting notation? This is another reason why client side rendering (asciimath for example) is so important....