Details
-
Type:
New Feature
-
Status:
Open
-
Priority:
Minor
-
Resolution: Unresolved
-
Affects Version/s: 1.9
-
Fix Version/s: None
-
Component/s: Filter: {none of the above}
-
Labels:None
-
Database:Any
-
Affected Branches:MOODLE_19_STABLE
Description
As more users discover how simple ASCIIMathML is to use and that it is able to do TeX as well as as its native ASCIIMathML text expressions, ASCIIMathML is becoming the most popular Math filter deployed. Add to that the abilioty to use DragMath with it so that students can both use a GUI to create a Math expression and then view as well the ASCIIMathML text expression and this becomes a very powerful tool. When you look at how you can then increase functionality by for example ading OpenOffice Math syntax to both ASCIIMathML and DragMath, you begin to see that we have a set of very flexible tools that can be used to address a broad range of user needs.
It would also be very helpful to be able to specifically tag pages for filtering, so that the filter would oly run against a page if targeted.
Activity
- All
- Comments
- History
- Activity
- Source
- Test Sessions
I am all for a system wide core Maths filter, and ASCIMathML has a lot going for it in terms of being standards based and having addition functions in terms of graphing etc.
As per my comments on this thread:
http://moodle.org/mod/forum/discuss.php?d=98589
I think it is important that we try to make this compatible across all browsers by having a fall back option for browser which don't yet support MathML (Opera and anything based upon webkit e.g. safari)
I really like asciimathml, it's really nice. Now, we need a "graceful degradation" way of dealing with all browsers (most of them) that don't support MathML natively, and others that don't have a plugin. Either a preference in user profile (something along the lines of `MathML: "display images", "display MathML"`) or something else... What should the default be?
About being "able to specifically tag pages for filtering", there is an issue (that I can't find at this moment) about modifications to the filtering system. This should be suggested on that issue, if it's not already there.
David Lippman provide an untested version of asciimathml with fall back to mimetex. I posted it in the Math Tools forum with some suggestions regarding using mathtran instead and Andy Kemp has posted a largely functional but not ready for primetime version which will get worked over to resolve this and that over the next week or so (Mauno can jump in here when he gets back from vacation ;=} ). This will use the existing feature of warning about fonts for firefox or mathplayer for IE and will fallback to passing the equation to mathtran. We can change the warnings of course as well (maybe something to the effect of, "You are using an incredibly poor browser which does not address W3C standards for which some should be ashamed...."; or not...) We might want to simply delete the warnings altogether.
I think that most Moodle users are probably not Safari users just because historically Safari did not provide access to any of the common html editors. And frankly I am a bit prejudiced and sometime think that anyone who wants to use IE should just suffer ;=}
But I suppose we could set the asciimath so that it did Mathtran unless the js detected firefox and a math font or IE and MathPlayer and then set a cookie for that session..... that way it would be transparent, though we could add a little onetime something that indicates that the user is in fallback mode and provides instruction for changing that (and if installing fonts for firefox add that you are best off rebooting after loading the fonts.... LOL) What do you think??
I don't know about user profile selection because there are people who are forced to use different browsers in different locations, and do you really want to have to change your profile every time you start moodle? But if we did the cookie or flag as suggested above it makes it transparent enough, don;t you think??
I tried either add an issue or add this to an issue on tagging for filtering but at the moment can't seem to find it.... however, there are a couple of things worth talking about here along these lines:
1) As Mauno has noted and I have confirmed, asciimathml.js likely is not working as a "filter" anywhere. This could be a bug or a feature and I have entered this in tracker but no one has commented on it. I think its present behavior is more streamlined and faster then it acting s a filter, but if it is not to be a bona fide php based filter then we should not call it a filter but come up with some other adjective. We could look at moving asciimathml.js and then fiddling the php files and getting the thing to run as a "well behaved" php filter, but if that is going to slow things down, why bother?
2) As Andy has noted, there seems to be some intriguing and undocumented uses of js in standard modules via require_js or other artifact (as in the issue he identified concerning quiz.js) and as I opined some time ago, we could be running into situations where we have numerous js libs running against the same page, with rather unexpected results....
3) Pending a system tagging solution for filtering (at present I think you are largely limited to providing lists of courses to parse, as is documented in the php filter files for asciimathml - which as I indicate, I don't think are getting sourced) it seems to me that the experiments that Mauno was attempting and discussing as far as setting asciimathml up in a course theme or for a user may really be the way to go.... but that would require some additional admin gui to make it easily administered.... Others have noted that Drupal and other CMS are much more customizable from inside the application, and I would like to see us move in that direction, but how much how fast is the question. And working by committee makes things move, well deliberately......
All that being said, the initial work has to be:
1) cleaning up the js so as to address an errors
2) modding the code to provide default and cookie setting if that is our direction.
3) confirming with Jonathan Fine that mathtran fallback is acceptable
4) identifying how asciimathml will be implemented (as in filter, applied through theme, etc)
I would love to see asciimathml and svg become part of a standard editor, in addition to being a standard display technology, but as Mauno suggested, this will not happen immediately. I don;t know that I would like to see a special Math editor.... Ithink it is important enough that a calculator and math notation and graphing features should be part of every editor, eventually.... and I think asciimathml may help us get to something even ore functional than as demod at: http://www.pierce.ctc.edu/dlippman/HTMLArea/examples/demo.html but that is going to have to come after moodle 2.0 is released.....
But, I don;t see why a 1.9.x HEAD should not have working dragmath and asciimathml and complementary editing and display features configured for xinha (along the lines of xinharepla as htmlarea overlay), FCKEd and tinyMCE with user selection..... we can alway pull features from 1.9.x HEAD for 2.0
1) Mathtran fallback works as well as mimetex, though there are some Tex/LaTex syntax issues with MathTran.
2) MathTran folks are happy to have MathTran serve as fallback
3) David Lippman has posted some recent fixes which I am going to try to work into session cookies http://asciimath.googlegroups.com/web/mathgraphcheck.js?hl=en&gda=wG0Y00IAAADVTzcPwEITiq7P6CkzK_kAUpZUUaUBGwSKjWH9-IBX5GG1qiJ7UbTIup-M2XPURDSwBSEFkCjDAI41ck1b_d9YMQ4HhOIVlic7wv2V2HiqYg
Mathieu - I'm assigning this to you to evaluate whether it should be moved over to the Moodle (MDL) project in the tracker, perhaps under the HTML Editor component. Before moving it, I thought I would check with you and see how you though we should best proceed with this issue. I don't think I am the best one to evaluate this as you and Mauno have been most active in the HTML Editor discussions with Marc Grober. Feel free to re-assign this back to me if you think that is most appropriate or to move it as you see fit. Thanks for your help. Peace - Anthony
Well, back to you Mathieu ;=}
As noted above, I think the graceful degradation problem is solved, though as soon as I find some time I want to use cookies to make sure it is a session degradation as opposed to a page by page degradation, but that should be almost trivial.
The filter issue is for practical purposes trivial, though perhaps not for generic Moodle structural purposes (as in when is a filter not a filter.....) but again, this can be fixed, though I think at the cost of implementing what I think is a better solution that bypasses the type of inconsistency we see when we try to use multiple js files as in quiz. If asciimathml is incorporated by way of theme the result is fast, slick and undoable, either via gui controls over theme elements (which we agree need to be introduced into Moodle) or manually (which couldn't be simpler. Yes, those insistent on using plain tex filter can disable asciimath and turn on whatever tex filter they wish..... while those who are still waiting for documentation on how moodle does tex need wait no longer...... and asciimath is a solution not limited to moodle... works same way no matter where it is.
so,, what next?
Is there a patch, or some code, working (or not) that I can have a look at, see what this would change, or how it would work?
Anthony - I don't think this is deeply related to the html editor (it should work even if the editor is turned off). It's more related to the filters component... I'm happy to follow this thread, but I think Eloy should be involved before any of this gets committed to core.
The nicest example perhaps of what this might look like in Moodle 2 might be Mauno's invocation as a theme in xingarepla, which was posted in the forums.
SInce then I posted a script with mimetex fallback and then Andy Kemp posted the scripted modded to fallback to mathtran. http://moodle.org/file.php/5/moddata/forum/130/438839/ASCIIMathML.js.zip
Peter created a google groups site for asciimath and David posted some fixes for browser check (links posted above.
I am trying to find the time to change the browser check so that it sets session cookies so that once the user is advised of whatever issue, it will continue to fall back without complaining for that session.
I created a subversion repository and once I get things cleared away I can provide anyone access, or we can ask Anthony to create one on Moodle along the lines of what he did with dragmath.
I have to agree that while could be tightly couple with an editor, looking at the display functionality its more filter like, though as Mauno noted, by default is not acting as a php filter.
Wow, first of all, let me say, I don't know anything about all that Math stuff! B-)
From a "pure" filter perspective, some basic questions:
1) Is it all GPL?
2) Is it a 100% drop-in replacement for the current mimetex filter, so it will handle old mimetex syntax automatically?
3) Is it "light" enough to work as a filter? Processing each content displayed in any Moodle page?
4) Does it exist in a way we can play with it?
IMO, if it's better, easier and 100% BC compatible... I cannot see any reason for a replacement (as a filter).
Of course, if so, it has a lot of sense t have one math editor to handle it under the new HTML editor (that's the perfect way). But that's another story. First we need to decide the filter thing.
Great work! Ciao ![]()
P.S: I've added Martin here too to let him know.
1) Is it all GPL?
"This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version."
2) Is it a 100% drop-in replacement for the current mimetex filter, so it will handle old mimetex syntax automatically?
The answer is yes, but if I left it like that you might eventually get the feeling I was pulling the wool over your eyes.... so let me explain.
As proposed (utilizing the additions by David Lippman), it actually does a fallback to either mimetex.cgi or mathtran.js (Jonathan FIne has been looking at this as well) where the browser can't interpret the text expression (Andy Kemp initially pointed out that the solution should address the fact that some browsers are not MathML compliant and that any solution should address this).
When not in fallback mode asciimathml interprets tex text expressions itself:
"The LaTeXMathML modifications were made by Douglas Woodall, June 2006.
(for details see header on the LaTeXMathML part in middle of file)" referring to the javascript file. It seems to do so flawlessly, and of course the purist could still decide to implement the current tex filter (which likewise falls back to mimetex (if available) when the primarty code is not available). Additionally it interprets asciimath text expressions and SVG expressions using a companion d.svg file, which need not be independently referenced. I am hopeful that it will at some point also parse OpenOffice Math text expressions in that one can add delimiting tokens and conversion tables (essentially, the script sniffs the browser and then based upon what it finds it searches for text expression tokens - such as $s- and on finding same converts the parsed content based on the appropriate table. Among other things this means one can easily change, add or modify the tokens and even use text (for example, the graphing feature uses
<agraph> .... <endagraph>
and asciimath, in addition to using backticks, can employ
<amath> ... <endamath>
3) Is it "light" enough to work as a filter? Processing each content displayed in any Moodle page?
Well, here we get into some discourse.... it is light and faster than jsMath, but, as presently packaged does not turn off when a filter. Mauno discovered this and I posited that this was because the js files were being somehow included in require-js based on their location, but we could never get anyone else to comment and frankly I did not have the time to relocate files and then change pointers in the php to test.....
But, what we have seen is that implementation by reference in meta.php results in a faster and less troublesome usage (there are so many js additions here and there - such as quiz.js - that things are starting to bump into each other..... and turning this on and off as part of a theme makes great sense.
Installed in /lib/editor/common and called via meta.php asciimath works everywhere and works quickly. This usage, because its essentially the last shot at the display, works in HotPots, quizzes, forums, wikis, etc. without any apparent issues.
4) Does it exist in a way we can play with it?
Well, this is probably the best point....
We are talking about less than 200K all told (the script is now at 163K with the session cookie code that I added.
The code is open and relatively easy to follow. Unlike the current tex solution for which this is no documentation and which potentially requires debugging asciimath is not only open and simple, it is hugely popular and widely used.
Other matters.....
This could be done via php (there is a php version of an earlier version of asciimathml by Steve Chan) and even perhaps via server-side js, but for the present I am arguing that the js via meta.php is a tremendously simple and elegant solution that afford huge flexibility with tremendous functionality. As to the latter, the code also supports svg, its own calculator and was the basis for an Equation Editor in XInha (while not as sophisticated as dragmath, it does hold promise as being able to facilitate editing of inserted equations by use of arrays, something that no other editors even approaches.... but that is for another day. I have Mauno's xinharepla (both dragmath and EqEd have buttons on xinha's toolbar and asciimath is running via meta.php) running in a sandbox and could not be happier.
I think from Peter Jipsen's perspective, the most important point is that asciimath's syntax has been designed to be intuitive so it is much easier to use, especially for students...
My distance education high school mathematics students have found Asciimath intuitive for forum postings. Browser requirements were not onerous.
Better support for Asciimath would be to enable it wherever appropriate. The last I checked, the Asciimath filter was not enabled in Chat and in Message. That is, recipients of a an immediate (JS/frames) chat or message line did not see the mathematics notation. Subsequently the math rendered fine in the chat transcript or saved message.
Something that would assist acceptance would be allowing filters to also be enabled for a course or a theme rather than for the whole server. This would reduce filter load and prevent puzzlement when an author entered a stray ` ` or $ $.
Thanks for your comments Greg.
Mauno has done some great work on thematic usage that might enable user based selection of various elements not unlike Drupal, but I think it will be some time efore anything like that becomes core.
That being said, however, let me point out a few things.
1) As noted in the forums, you can implement asciimathml via themes now. I am working (or supposed to be working) on fisnishing up some touches and a package so that it can be easily implemented with fallback where the browser is inadequate to mimetex or mathtran, and that is working now though there are some bugs when it comes to addressing all possible exceptions outside firefox..
2) The existing filter is poorly behaved. I don;t want to say broken as that may not be the case, but it does not work in quiz or chat because of conflicts with the js that runs those two apps. HOWEVER, by moving the asciimathml invocation to the theme, the problem with any js conflict is resolved.
3) I am wondered, but have not had the time, to test the filter if the asciimath files are moved to another directory and the location altered (it was my theory that in some way require_js included the asciimath filter directory and because of that the asciimathml.js file was being invoked whether the filter was turned on or off) . I mention this as the filter does have a line of code intended to allow one to limit by course the application.
4) I think you will find if you move your asciimathml to involcation via theme (referencing same in meta.php) that the response is quite snappy, even with asciimath parsing and calling d.SVG. I do need to point out that you can run asciimathml with the tex filter as asciimath does not use the same tokens (i.e. it uses $ for tex while the tex filter uses $$. That being said, I don;t know why someone would want to use the tex filter when asciimath can render not only asciimath text expression but tex as well and fallback to mimetex ot mathtran (for someone who just wanted to do tex one could use LatexMathML - which is in part incorporated in asciimathML but why??) Additionally, asciimathml can be extended (it has already been extended a number of times) to parse any tokens through the inclusion of appropriate tables..... so I am hoping that at some point asciimathml (as well as dragmath) can also do OpenOffice Math text expressions and there are a number of folks who have been bugging google to use asciimath through google docs style sheets to provide for the ability to do math in google docs without bitmaps.... (feel free to make the suggestion yourself if you are a google user......)
I can only say that Asciimath is about the easiest way to get math working in Moodle ... In Belgium, we basically have a choice between the commercial SmartSchool (which offers extended math capabilites, but is very expensive) and open source solutions like Moodle or Dokeos. Moodle is the most flexible one, and Asciimath surely is the easiest way to display math in Moodle, both for the IT-coördinators and users. I surely hope Asciimath will be included in the next release of Moodle!
I need more time to read, understand and try all this (lot of text above) but let's look at it for 2.0.
Martin, if you want to test new features I have some new info and demos in http://moodle.org/mod/forum/discuss.php?d=105436#p490416
I have worked with ASCIIMATH and moodle 1.8+ versions works fine by adding it into the filter. It was a tough time to crack the same for moodle 1.9.3+, let me put it as a tedious jobs to make the asciimath work by adding it to themes.
As guided by Mauno the necessary changes were done in the theme folder for all the themes, so that, asciimath is compatible whenever a theme is change. The changes were done in the required code for file "meta.php" , "config.php" and including asciimath in lib/editior/common folder. This helped me to work with the asciimath in moodle 1.9.3. But, this affected the other features in moodle as I'm not able to edit or add new course or user on the moodle site, a blank page is viewed, some issues in parameter parsing.
I'm developing practice quiz for subject like Math, Physics and Chemistry for grade 9th to 12th where there I need to display molecular formula and algebra equations. Its fine for a technical person to wok around with the application but it will be difficult for a new user or non-technical person to do such work around.
Hence, I strongly recommend to have an inbuilt utility for asciimath and a science tool to display and allow students/users to add/edit formula to the science and math assignment in the latest version of moodle (i.e. Moodle 2.0).
Frankly, Eloy, I see little reason to keep changing this item to reflect some future "fix" that will never take place.
You are right, there should not be any fix version, fixing...
Need to add the ability to use asciimathml.js to reference d.svg so that graphing can also be added at display time. It is a bit difficult to discuss use of math in Moodle at Moodle.org at present because of the limit to the tex filter. This could be partially remediated with the introduction of Nwiki but will still present a problem in the forums where that module strips js
SInce this item was added to tracker Mauno Korpelainen has also demonstrated the scripts use as part of a site or course theme.