Thought that might be the case so included such a note at the head of the page.
Basically, user beware, test it thoroughly and complaints to be made in this forum.. .
Thought that might be the case so included such a note at the head of the page.
Basically, user beware, test it thoroughly and complaints to be made in this forum.. .
Hei Mauno & Colin,
"Advanced Maths Tools' is nice idea.
I am very curious about how to colour Maths Symbol.
Now There are number of weapons for 'Maths symbol'.
If there will be chart which show comparatively features of each one.
Then we use each weapon smartly.
Best Regards,
Ravi
In mathjax syntax you can can add colors (text, background or border, in fact any css elements) by selecting the mathematical notations you have written and then using Select text color and Select background color buttons/palettes in editor toolbar (or html). Mathjax also supports colors in mathml but only \color in latex expressions.
In my asciimathml script latexmathml was written to give full color support and it works nicely with combination mathml & mathtex fallback with \textcolor and \colorbox syntax but requires \usepackage[usenames]{color} or \usepackage{color} either in tex filter tex preamble or in fallback tags if color package is installed in that existing latex distribution. Again if I set asciimathml script to use mathjax fallback it can use in latexmathml (latex) syntax colors with all other browsers than IE6-8 that would require mathtex fallback...
Even if mimetex supports only a few named colors with custom syntax like \red, \blue or \green google chart api tex (that otherwise is using mimetex syntax) can use all colors + gradient & striped fills with chart api syntax and you can change both textcolor and background color in editor googletex plugin with color tools at the top of plugin - background is set to transparent by default.
Mathtran does not support colors at all - here some background from year 2009: http://moodle.org/mod/forum/discuss.php?d=133132#p587630
More about this kind of issues in the coming docs - it may take some time to get the docs finished...
In fact MathJax has a much wider color and other style support than I knew before weekend when I visited an excellent test page by Dr. Carol J.V. Fisher in
http://www.onemathematicalcat.org/MathJaxDocumentation/TeXSyntax.htm
It is a huge page and gives much detailed information about special features of MathJax that are not all documented on main pages of MathJax.
I wonder if core developers and site administrators of moodle.org could allow adding mathjax script tags with some acceptable tokens to Moodle Docs - I was testing yesterday documentation with mediawiki (not with mathjax extension but with mathjax script tags in mediawiki theme) and it works fine using CDN mathjax. Here an example page:
http://korpelainen.net/m2mathwiki/index.php/Style
One more good point in using mediawiki is that it has printable pages available and if output of mathjax is set to HTML-CSS printing should give good quality output in all browsers - example
http://korpelainen.net/m2mathwiki/index.php?title=Style&printable=yes
The other option to add some more documentation to moodle docs might of course be to use current latex which can render most example as images.
Seems to me discussions along those lines with respect to ASCIIMathML went, well, nowhere. Seems to me that you and I, Mauno, were demonstrating use of maths in mediawiki for some time and are arguably lucky to have what we have now in Moodle docs (Blahtex,as I recall?) as Maths is not central to Moodle, to paraphrase one Moodle dev..... Even the suggestion that a separate space in the docs for use of math fell on deaf ears and tracker items litter the tracker system.
Well... asciimathml was just not crossbrowser compatible then and still today official scripts aren't and we are talking about "our files", "Peter's files", "David's files"...
On the other hand MathJax is today both production ready and well documented in http://www.mathjax.org/ , it has great sponsors (supporters) and adding support of MathJax to moodle docs would require just adding a couple of lines to moodle docs skin (moodledocs). Mediawiki of moodle docs seems to be in version 1.16.5 and my examples are in mediawiki version 1.17.0 so modification of skins may have some differences but in my case I have in skin file Vector.php and function initPage lines
$out->addHeadItem( 'mathjax','<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js">
MathJax.Hub.Config({config:["TeX-AMS-MML_HTMLorMML.js"],jax:["input/TeX","input/MathML","output/HTML-CSS"],extensions:["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js"],tex2jax:{displayMath: [ ['."'XX','XX'] ], inlineMath: [ ['Y','Y'".'] ]},TeX:{extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]}});
</script>'
);
to output cdn mathjax script tags in mediawiki. The mediawiki extension option is also available.
In the place of XX I use double dollars and in the place of Y tokens single dollars (did not want to output latex here).
On the other hand we see in moodle 2 (compared to moodle 1.9) what happens when lots of new features are added, number of lines of code doubles,... so I will use a compromise option and add some things to moodle docs with the tools that are in current mediawiki and use links to my personal wiki and demo site tools in such cases where moodle docs can't be used. One good point in Petr's book module is that it can be used to demonstrate also geogebra mobile examples so we will be able to show some things from the future tools...
No, I agree that MathJax will be good for the web and great for Moodle. I am just not going to hold my breath.... As far as Moodle Docs, I am thinking that it would be much better to try to agree on a public mediawiki which could be by design focused on supporting Math in Moodle and the like along the lines of what you, I, and other have done. It sems to me rather foolish to discuss using geogebra, geonext, jsxgraph etc in an environment that can't support their illustration. I tried to do something of the sort through the University here and they are simply not interested in getting involved with supporting computer aided Math instruction (I guess that in part explains why so many kids in Alaska can't do Math....)
I was a little suprised to see that most of the things we have in this package can be seen (both maths and graphs) also in mobile devices. Just tested with mymobile theme (with script tags in layout files / extras.php and $CFG->texteditors = 'textarea'; in theme config.php since mobile devices do not yet support editing of content with tinymce and therefore can't use editor / plugins) .
Here some screenshots from Opera Mini simulator:
Mauno, Thanks your everything you did. It just is so good.
I followed your method described in the post trying to turn mymobile theme to be friendly to your tools. I find that Mathjax can only be displayed properly if I refresh the page after it is loaded. For other things like google chart and jsxgraph, they just do not load. It happened on my 3Gs iphone and android phones.
Could you give me some hints to make it work?
As a proof of concept that opinions of core developers can change check http://tracker.moodle.org/browse/MDL-27622 where Martin D says:
(In related news I hope that sometime soon we might even switch from YUI to jquery even for all the other core stuff).
This kind of news are sensational - even inside parentheses - core moodle using jQuery !!! And it's not April!
For several years jQuery has been a "bad word" here in moodle.org - if you have mentioned that you like jQuery more than YUI since jQuery can do some things in a much quicker, shorter and simpler way than YUI you may have gotten "freezing feedback" since YUI is the choice that we use...
Times change like we do.
Well, that is good news..... but I am not going to be holding my breath
The most important thing in using colors or other formatting is that in mathjax all css and html MUST be outside delimiters/tokens so when we select mathematical notations we must remember to select also delimiters - mathjax renders first valid code and then adds styles to fonts. In editor and on screen it looks like this (fonts do not look always the same in different browsers)
But as soon as you need more than one color inside the same notation you need either mathml or such latex that supports syntax like \(text)color and \colorbox
- old examples like
with code like \colorbox{red}{testing dollars}\sum_{i=1}^{p}\sum_{j=1}^{q}\sum_{k=1}^{r}\textcolor{blue}{a_{ij}} \frac{\textcolor{green}{b_{jk}}c_{kl}}{\colorbox{Orange}{ text}}
For students and most teachers this kind of code is impossible to use - luckily you have also that flash based tool Fmath editor (disabled by default) and you can use most styles there
to render either images with the other plugin I have added or mathml with the other plugin - latex syntax is too buggy in this plugin to be used right now.
If you need to print your pages I recommend using in most cases MathJax (when possible) and these other tools mainly for "special cases" (notations or symbols that are not supported by mathjax)
Hei Mauno,
Nice Explanation as usual.
i will read it number of times.
Thanks again.
Best Regards.
Ravi
Hei Mauno,
I installed new package from http://docs.moodle.org/20/en/Advanced_Maths_Tools (MplugA)
Now,
Is there any need of 'Additional HTML' ? (For MathJax).
Do i remove it?
I can give colour to maths Symbol (using MathJax)
Thanks a lot
Regards,
Ravi
I think, No need to delete 'Additional HTML'.
There are different scripts for diff. renderer.
But,
'This Script(s)' can be included in Package.
-----------------
Hi Colin,
We can include 'read me' file in Package
Best Regards,
Ravi
[P.S. - I know mission is going on]
If you are using a theme that already has script tag code in theme's layout files included (from extras.php) - in this case mathstandard and stylist theme - you don't need any additional html tags.
In fact I should add some more details about possible extra css required/not required for jsxgraphs, latex images (class 'texrender' is needed for vertical alignment of tex images - or images need some style themselves) and for example editor.css (styles that you see in editor content area & styles list)
More about these next week... after weekend
I am a bit puzzeld by Mathjax. If I klick on the button it starts a popup with an extreme long working script. If I am lucky I can see and use the tabs, but except the dragmath interface in tab2 I really dont find anything. OK I am no mathematician, so perhaps this might be of more practical use than I would imagine, but imho I really dont know of what use this could be. What is that endless script for? What might be the content of the tabs? Why should'nt I just use the dragmath editor directly? If I paste the default code in the textfields of the math configuration I just get the code in the corresponding tabs of the Mathjax-popup. Is all this really the way Mathjax is intended?
Meanwhile all other mathfunctionalities of thoses mathplugs are really awesome.
great work
best
Steffen
Can you tell some more details about your environment - which browser, which operating system, which version of java..., which theme? Or is it a https site? Mac? (I have not tested all environments)
Can you debug any errors with your browser/moodle/java console,site error log ?
My dragmath opens in about 1-2 seconds after clicking tab 2.
Mathjax does not render images so you can't render actual result in editor content area and plugin should find and use the same delimiters you have given in settings - themes mathstandard and stylist use the same delimiters from settings - and tabs should render the code you have given in settings in about second if your mathjax is properly configured and in the correct place. Https sites may have difficulties with CDN address http://cdn.mathjax.org/mathjax/latest/MathJax.js - See http://www.mathjax.org/resources/faqs/ for more details.
It is possible to use mathjax to just render latex or mathml that you get from Dragmath plugin directly - if you use the same delimiters for mathjax that dragmath outputs with selected export format (MoodleTex is using double dollars) - if no other renderer like tex filter is using the same delimiters and does not render maths before mathjax. The idea of using configurable tabs is that teachers/administrators can add custom content to tabs and when they click that notation they get the code to textarea as many times as they need it. Writing code can be slow anyway.
Ideally tabs should be preconfigured and I was planning to add most symbols from http://www.mathjax.org/docs/1.1/tex.html#supported-latex-commands to the first tabs and some examples to the last tabs but have not found the time to select such "good examples".
I was also testing a mathml plugin where I had Wiris in one tab, dragmath in another tab and Fmath in 3rd tab and they all could add mathml to this textarea to be PREVIEWED before adding to main editor content area that does not render any other type of maths than images. So the main purpose of using one textarea before adding content from plugin to editor was to see what code looks like in preview window and when it is later rendered with MathJax scripts - latex syntax and mathml is not always similar with different renderers and different versions of mathml and you don't always (often) get things WYSIWYG...
Dragmath, Wiris and Fmath plugin (fmath_formula) with image output are most suitable for such users that do not understand syntax of latex, asciimath or mathml - and these 3 plugins help also those people who can write code but want to make things with click - click - method
+ you can disable such plugins that you don't need/use.
Hello Mauno,
Thank you very much for your detailed response. It definitly helps me to understand a bit more what it is about if I am right to take it as kind of a Latex and other Math-Symbol-Preview option.
I also have no problem with the Dragmath-Editor neither opend from its own button in the Tinymath-Editor nor in the GoogleTex-Plugin (which seems to me a bit similar to Mathjax).
I use the decaf theme which at least needs som scripting for its dropdown menus. Perhaps this might cause any conflict. Might there be perhaps any parts of the additional added html code of the header, which are not necessary beside the code of decaf, so deleting this might perhaps stop the endless working script when opening Mathjax.
I think I should keep an eye on your work it definitly brings moodle 2.1 a large leap forward
best Steffen
Javascript conflicts are possible (any errors you get to find out the reason are valuable) and like I said to Colin in one of the previous posts these plugins are not bug-free and they are still in alpha/beta level - some part of code may not be cross browser compatible and even if I have tried to test all the modern browers on my computers it is impossible for one person to test all kinds of combinations of different environments, browsers and so on.
For example in the old moodle 1.9 plugins overlib javascripts (different kinds of onmouseover things) caused conflicts and freezing of IE.
MathJax itself is a huge package of javascript and it has all kinds of special features - when I was testing how to use mathjax as asciimathml fallback (last week) everything seemed to work fine, even in IE6-8 with a tiny "trick" until I tested this "trick" in printing pages of book module that do not use theme header the same way as other modules do - and mathjax fallback was not rendered although those pages were using exactly the same code for mathjax as other pages! And image fallback did not have such problems at all
Last winter I had lots of problems with some scripts that did not seem to work until I noticed that the culprit was actually outside browsers - a local performance testing script...and for example the list of different kinds of IE issues in the past is huge...
I will use next 4 days for documentation of customization of plugins and some guide about syntax. At the same time I will create that public demo site to my test server and update the packages on next Friday (26th of this month) and post more details here.
This is actually harder than I remembered - new IE issues every week...
After upgrading moodle Decaf/IE problems vanished so it was probably a temporary issue in some version of moodle 2.X (??)...
Today when I was testing at work the coming public test site IE8 there told me that I have no access to mathjax javascript files on my test sites local folder (??) - CDN files were accepted...
Book module has same header tags both in Print book- and Print Chapter- options, still IE9 prints the whole book ok and does not render mathjax in chapter printing (??)...
And when you print something Mathjax needs to use output format HTML-CSS since output format NativeMML can drop such symbols like "+" so we should most likely drop NativeMML output format from mathjax configuration. We can still input also MathML and MathJax can output this MathML (to screen or printer) in HTML-CSS format.
Anyway I have uploaded the latest test versions (upgraded packages) to http://korpelainen.net/mlugatest.zip , http://korpelainen.net/mlugbtest.zip and corresponding book http://korpelainen.net/mplugbooktest.zip
I did not replace the original packages yet since there are a couple of IE issues that need some more testing and rewriting of code - on the other hand these new files have some bug fixes and new features that were not included to previous files. I have been separating asciimathml fallback to 3 optional fallbacks: mathjax fallback, mathtex fallback and mimetex fallback and IE6-8 have different problems with each of them. Mathjax fallback is a temporary solution that converts asciimathml and latexmathml tags first to latex syntax with mathjax tokens but since IE6-8 do not fire mathjax in correct time I needed to add extra "fakeIE" input format and then IE6-8 tries to find this format first and since it does not find such format asciimath script gets the time needed for rendering latex and then IE6-8 renders mathjax code. It means that IE6-8 is not doing anything sensible during the first 5 seconds but it renders asciimath-mathjax queue finally. Hopefully David L gets the straight asciimathml input format for MathJax done so that it can output HTML-CSS for IE as well
Mathtex fallback for IE6-8 works pretty well since mathtex can cache fallback images and it is this way relatively fast even in IE but very few sites can install mathtex and mimetex fallback has the worst support of different latex symbols. And experimetal (tex filter based) texviewer is at the moment too slow since it does not cache images and tex filter code can't be used since filters render code before javascripts
I did use a lot of time this week in comparing input/output syntax of different formats and it looks like the best way to go forward is to add support for all the (AMS) latex symbols that MathJax supports
http://www.mathjax.org/docs/1.1/tex.html#supported-latex-commands
to Asciimath mathtex fallback first and eventually to mimetex fallback (by combining old symbols) too.
At the same time I added new settings for tab 3 and 4 with tool tips mathjax plugin to allow picking up those most common (AMS) latex symbols from these tabs - and other tabs will have more content next week
Since these symbols are ordinary links that send symbols to textarea with javascript they could be as well "buttonized" (to make them look like a button) with css once the structure and order of the most common symbols is clear.
I'll be back next week.
IE6-8 renderer problem solved!!!
It was finally simple:
I had to add to function strarr2docFrag(arr, linebreaks, latex) in file lib/common/AMMathjax.php
if (expr && isIE) {newFrag.appendChild(AMTparseMath(arr[i],latex));MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}
to make MathJax launch at the correct time for IE6-8
(after creation of mathjax tags with mathjax tokens in function AMTparseMath)
and IE6-8 rendered asciimathml with mathjax faster than ever!!!
All packages upgraded to new versions and testpackages deleted.
The next step is to add full support of mathjax symbols to asciimath input/output tables - next week
hooray! Make sure to keep David and Davide up to date.
This same method could be used with any normal asciimathml javascript fallback version - it requires only 3 things:
Tiny changes to fallbacks:
var isIE = !(document.createElementNS);
Later
function AMTparseMath(str,istex) {
if (istex) {
var texstring = str;
} else {
var texstring = AMTparseAMtoTeX(str);
}
//alert(texstring);
if (mathcolor!="") {
texstring = "\\"+mathcolor + texstring;
}
texstring = texstring.replace(/textcolor/g,"color");
var node = createElementXHTML("span");
node.innerHTML = "<?php echo $CFG->filter_math_mathjaxi1; ?>" + texstring + "<?php echo $CFG->filter_math_mathjaxi2; ?>" ;
return node;
}
where these red mathjax delimiters could be given with a variable at the beginning of asciimathml javascript (for example double dollars)
and then this line
if (expr && isIE) {newFrag.appendChild(AMTparseMath(arr[i],latex));MathJax.Hub.Queue(["Typeset",MathJax.Hub]);}
in function strarr2docFrag(arr, linebreaks, latex) to render given fallback in those browsers that can't use "document.createElementNS" (mainly IE6-8).
But to make this even better we need to upgrade also AMsymbols to give full support for mathjax latex tags. I will do that during the next week and after those changes it will be possible to add "translated" asciimathml tags to output different mathematical symbols with local names in addition to english asciimathml tags.
I will also add one more version of asciimathml-mathjax fallback next week - a minimized script without latexmathml since mathjax can output all the things that latexmathml does and this way we can avoid also conflicts between such jquery scripts that reserve single dollar for custom use (some themes use jquery for menus etc)
I did test also David's asciimath input format in mathjax configuration and in the long run it might be good to have such format to mathjax but we can as well use this kind of workaround since it may take some time until asciimath input format can be used in core mathjax - IF it is implemented to mathjax core files.
Hei Mauno,
Some Long Mathematical Expressions can't adust in Moodle 2.1
Plz.
http://moodle.org/mod/forum/discuss.php?d=182130#p795680
Ravi
That looks like a tiny css bug in Quiz module, maybe Tim Hunt could help in that issue - similar problems were seen in many resources about year ago but Sam H. fixed most of them with a code that adds scrollbar under long content like long text or large images to avoid overlapping or cutting of content. It's partly a theme issue and partly a core code issue.
Some graphs and other embedded content can also have issues with small screens or large graph widths so all themes will need more css and possibly javascript for scaling large content if necessary - particularly in mobile themes and tablet themes.
And one of the related bugs still remaining is that forum posts can get pretty narrow after many posts shown nested - for example this post looks like this with a little smaller screen width, no more space for graphs, time to start a new post next week Note however that the scrollbar is there at the bottom of the long and narrow box!
Hei Mauno,
Yes, i want that- Scroll bar at the bottom if Long expression is there.
BTW, OK
i am waiting Moodle 2.1.2
(It is OK with Moodle 1.9- At the Bottom Scroll bar appear automatically)
If it happen with Moodle 2.1.2, then i will raise the Post.
How was weekend ?
Ravi
One more annoying IE6-8 fallback issue - if there is no original MathJax content on the page the previous procedure still does not seem to launch AsciimathML - MathJax fallback in IE6-8 !!!
A workaround could be for example to add to theme layout files (or additional body tags) something like
<?php echo $CFG->filter_math_mathjaxi1 . " ~ " . $CFG->filter_math_mathjaxi2; ?>
to render space with mathjax and this makes mathjax scripts run...
On the other hand it might be good to have some kind of "prechecker" of existing code to prevent loading of these javascripts if page has no MathJax tokens or asciimathml tokens - for performance reasons
The deeper the kludges the more difficult to maintain.
Remember back to when we were talking about an asciimathml core script that would call the various libraries and set switches as necessary for the environment? There is your pre-checker - lol. That is really what we are talking about, and it would make more sense to do as much of that via mark-up...
Or you can throw your hands up in disgust and abandon IE
Steffen,
I was able to reproduce the problem you described in IE9 set to different modes in Decaf theme but don't know yet what code there might freeze IE/MathJax - probably some "header hack" in Decaf.
From other themes avoid Mymobile theme (beta) until it is stable and fully tested - it is using heavy customization with mobile jQuery and most likely does not show any course content with math scripts. Core themes work fine with math plugins.
If you want to use some custom theme without site wide code in additional HTML you can edit either theme config.php or theme lib.php and add there (inside php tags)
$CFG->texteditors = 'tinymath,textarea';
to set tinymath the default editor for that theme
and add to theme layout files (general.php, frontpage.php etc inside theme folder layout)
<?php require ("extras.php"); ?>
just before </head>
and copy from attached extras.zip file extras.php to your theme layout folder.
Note also that if you use sitewide additional HTML for all themes with absolute paths you need to make sure that you have set delimiters ( in settings of math filter, $CFG->mathjaxd1 to $CFG->mathjaxi2) the same as in additional HTML where you can't use php.
MathJax problem in 2.1.2
When I try to update my moodle 2.1.2 to install new plugins I get an errormessage:
I hope this will be nothing serious. Right now it keeps me from upgrading my system with new plugins.
best
Steffen
Well... it sounds a little worrying since there should be no editor called MathJax...
You may have accidentally moved files of MathJax from folder lib to folder lib/editor.
I am going to upgrade all my Math plugin files during the next 2 days and add new packages to my test server on Friday or Saturday (15th of October) and before that I should test all the latest files of moodle 2.1.2 with math plugins.
Oops!
Thanks for your help!
fahl5