Réseau National de télécommunications

pour la Technologie l’Enseignement et la Recherche.

# Forum: developers

Monitor Forum | Start New Thread
| |

RE: mathml [ Reply ] By: Bernadette Perrin-Riou on 2012-07-04 10:30 | [forum:13845] |

Of course in the last message the balise td does bad thing. I continue with some discussions we have with Joke in email: Joke : !htmlmath is an easy way to do some basic typesetting on a string/formula I use very often things like: formula=x^2+$c*x+$d html_formula=!htmlmath $formula answer=!exec maxima solve($formula = 0,x); question=Given the formula $html_formula . Determine the roots. In the latest svn version ; the $html_formula will be typeset in "mathml" (which of course is even better looking, but that is not the point) Bernadette :x^2+$c*x+$d is a computer understandable formula even if it has not been produced by the computer. So it is ok (if no, maxima will not accept $formula). You do not send something as formula=balise td x^2+$c*x+$d The fonts are not the same in mathml and htmlmath. I think you are the person who uses the most htmlmath. So we can add now a mathmlmath command (the name must be mathmlmath and not mathml, see htmlmath : math -> html, texmath : math -> tex; mathmlmath : math -> mathml) ? And I will transform some of the old htmlmath in mathmlmath command in the distribution or in some Xiao or modules of me if I think it is better. insmath will use mathmlmath command. Why not ? Now that I have understand the "specifications" and that we are ready to tell them to anybody, we may have such a function (some weeks ago, I was not ready to do that because I did not really understand the specification of texmath htmlmath.). Bernadette |

RE: mathml [ Reply ] By: Bernadette Perrin-Riou on 2012-07-04 09:19 | [forum:13844] |
||

For the first remarl : htmlmath must be applied on mathematical formulas, in stat module it is applied on | number So it must be (I have done) fix. The specification of htmlmath is that it transforms mahtforumula from a computer to browser comprehensible mathematic. Put a | inside is incorrect. It was the same thing when I tried incorrect things on texmath, it gives strange results ... Bernadette |

RE: mathml [ Reply ] By: joke evers on 2012-07-04 06:44 | [forum:13843] |

The html -> mathml conversion in tables can be seen in the "server statistics" module. There the use of html-math is clearly better (cpu ) than a mathml -construct. A few other remarks: We've implemented a \input{} command in mathml. It will gives inputfields within the mathml construct (formula) The "id" "style" etc etc of the inputfield can be set as arguments of \input{} It is not compatible with insmath-with-gifs ! (latex error) The module using these inputfields must check is the user uses mathml. If mathml is not enabled a "normal" inputfield will be shown Furthermore there a \size[350]{string} ; this will set a size only for the "string" This too is not supported in latex, but it will not give a error, The javascript based zooming will interfere with wims javascript drag&drop library. This is because the draggable object are stored in a js- array...the zooming still works but there is no dragging/dropping :) We should probably exclude zooming from this type of module. Home-made Drag & Drop using wz-dragdrop.js is ofcourse compatible (eg zooming and drag/drop) These things -and others- are implemented to experiment with the vast amount of opportunities mathml will provide... and I expect in 5 years time MathML to be our default. |

RE: mathml [ Reply ] By: joke evers on 2012-07-04 06:34 | [forum:13842] |

The wims-variable "useropts" is marked "readonly" in wims.cgi. And thus can only be set in the adress-string of the module (...&cmd=resume&useropts=621...) A wims-module can not set this variable...a class can not set mathml. Furthermore -at this point in time- only a few browsers support MathML natively (eg firefox) So MathML should "always" be set by the actual (browser) user of a wims server. A drawback -in my view- of the current version is that when mathml is enabled, "html-math" is replaced by mathml-construct. I would prefer -at this point in time- mathml to replace only the "very expencive" insmath-gifs. Mathml will in future be as good looking as LaTeX: there are new font-projects started, which will in a few years provide the necessary fonts. In Javascript there is the MathJaX project: it gives -again in my view- much (!) better results then latex-gifs : but it uses 75 mb fonts to be installed on the server or to be delivered by the mathjax webfont server.(not a very good idea; privacy,availability) I have no doubt that these fonts in time will be available for normal browsers. Kind regards, Joke |

RE: mathml [ Reply ] By: Bernadette Perrin-Riou on 2012-07-04 06:19 | [forum:13841] |

This function insmath tries to standardize the formula (via rawmath) : if it is asked mathml mode : htmlmath produces mathml code ( via tex) The decision to take mathml or not must be for the moments the decision of each user. But Joke began to developp answer types with mathml, in this case it should be different perhaps, but it is premature to do it in public version (but much hope !) Joke has also developped a zoom (go to adm/light/useropts.phtml.lang and decomment some lines). But the javascript is in competition with javascript correspondance answers so we don't put imake it public). I see also some problems when the formula are in some html tables (for example in oef answer). So we must have to look at them (tables have no sense there, as Olivier tells us very often). See later ! breakable block is better adapted for ipod or ipad etc. I decided already to transform latex2wims not to use tables. Things are less rigid but it seems to be the future ! Bernadette |

RE: mathml [ Reply ] By: Eric Reyssat on 2012-07-03 20:28 | [forum:13840] |

I am not sure to understand the idea of Bernadette's message, but what I understand is this : The old way : the \(...) syntax calls insmath to display at best a math formula. This function insmath tries to standardize the formula (via rawmath), then chooses to transform it to html code (if possible, via the htmlmath function) or TeX code (if html not possible, via the texmath function). The html code (if any) is included in the page ; the TeX code (if any) is transformed to a gif image, included in the html page. The new way : A new flag allows to choose between the old way of displaying math formulae or a new one using mathml. When this new flag is on (i.e. mathml is choosen) : - htmlmath now produces TeX code instead of html code. - TeX code coming either from texmath (as before) or from the modified htmlmath is translated to mathml code (instead of a gif image), and this code is inserted in the page. - insmath does a few other slight modification when analyzing the formula to choose between htmlmath and texmath. Precisions about this new flag : - it is set on a global site scale by the site manager (maintenance page / dynamic graphics) - it may be switched by any wims user (preferences page) - I don't know if it may be switched for an entire class by the teacher. I even don't know if it would be a good idea ! What is changed when this flag is on "mathml" position ? - The formulae look usually better, especially when small exponents/indices appear : enlarging all characters using the navigator commands acts also on math formulae. - The formula is no more an unbreakable block. This might be sometimes better and sometimes worse than before. Eric |

mathml [ Reply ] By: Bernadette Perrin-Riou on 2012-07-01 09:10 | [forum:13837] |

I tried to understand the generation of the formula in wims, especially the functions rawmath(), insmath() and texmath() to see what to do with mathml and at which step there is a bifurcation mathml/gifs. For that, I (try to) make a "documentation" for these three commands. After that, I think it is clearer for me of what have to be done for inserting mathml. The idea here is not to use all the possibility of mathml that the gifs have not. It will be for later (I know that Joke has already thought of very interesting things !). Any comments are welcome ! Bernadette (hope that the formatage will be correct !) rawmath = used on answers of students ; oef uses it when the type is function, complex, rational It is used by insmath only if insmath_rawmath=yes Transforms user math formula in computer math formula (should be accepted by calculators). 1 - Replace some badcharacters as **, ², ³. 2 - If (mathalign_base < 2) unmatch=__replace_abs(p). 3 - translate ++, +-, -+, ... into one sign 4 - translate | | in abs 5 - replace new lines or tabs by spaces 6 - add zero in case of decimal digits if necessary : for example, replace 4. by 4.0 and .5 -> 0.5 if rawmath_easy : 7 - replace justapositions by multiplications if rawmatheasy=yes htmlmath: must be applied to a formula coming from the computer and transforms it in a "pretty" html formula 1 - Replace < and > by html code if "htmlmath_gtlt=yes". 2 - All digits or + or - following a ^ or _ are considered as in exponent/subscript ; expression with ( ) following a ^ or _ are considered as in exponent/subscript parenthesis are remove (if no sign before) except in case of exponent and only digits. 3 - Get rid of 1*.. ..*1. example : in 1 * x, x/1, the 1 is removed. 4 - Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless. 5 - Replace some names as greek letters by their equivalents. 6 - Remove * or replace by multiplication sign. 7 - Replace <=, >=, ->, =>, <=> by their equivalents. texmath : must be applied to a formula coming from the computer and transforms it in a "pretty" tex formula. So the input must not contain \ or tex codes. 3 (5+6) will give strange thing (it should be 3*(5+6) ). Must apply insmath to the code generated by texmath after. 1 - transforms computer matrix as [ 4,5;6,7] in tex matrix 2 - transforms A/B in {1 over B} A or { A over B} according to the priority of the presume type of A and B (integer, numeric, variable, poly, transcend 3 - transforms cos(x)^n in cos^n(x) (list ??) 4 - transforms <=, <=> =>, -> 5 - transforms a relation without a second member by adding 1 6 - Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless. 7 - Remove * 8 - Replace some names as greek letters by their equivalents. 9 - interpret in latex formula as sum(), integrate, prod () (should come from maxima in this form) So it is doing a little more than htmlmath because it was easier to have matrices and fractions in tex. insmath: take a formula and send it to html or tex : 1 - replace .. by , 2 - If there is no \ or { , apply rawmath if it is asked : it is then assumed it is "computer formula" (ts=0) , else it is an "tex formula" (ts=1) 3 - If ts=0 and if it seems to contains a computer matrix ([;,]), apply texmath. (here it can do should be dangerous, if the formula was not computer formula). send to tex then return the image (END) 4- (we are in a case where ts=0) : Do something to interprete font names or variables : if word as "sqrt int integrate sum prod product Int Sum Prod conj abs" is found, interprete it in texmath ; send to tex then return the image (END) 5 - (we are in a case where ts=0) : look for / (formula like 5/(1+x) ). interprete it in texmath; send to tex then return the image (END) If ts=1, the formula is just send to tex then return the image. What about mathml case. 1 - htmlmath (version mathml) does the same thing than htmlmath except that it transforms with tex codes rather than html codes and send it after to mathml (html-math=mathml-math) 2 - texmath is exactly the same (recall that the output of texmath is just tex code non interpreted) 3 - insmath : replace \pmatrix{ } by latex syntax ; do exactement the same thing that the insmath with gifs except that the call to gifs is replaced by a call to mathml. |