2012-07-01
new version of insmath.c :
correct the call to texmath when / is found (to check)
if mathmlmode, replace \pmatrix by latex code (could be done in all cases)
now
wims.c should be modified
#include "mathml.c"
#include "texmath.c"
#include "rawmath.c"
#include "insmath.c"
comments :
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
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
??) not sure of that
!
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.
2012-06-17
stupid typo "char mml_buffer[sizeof(MAX_LINELEN)+1]" prevented mathml to work on GENTOO linux
(leiden mirror )
it should ofcourse be "char mml_buffer[MAX_LINELEN+1]"
strange that
OpenSuSE 11.4(32) OpenSuSE 12.0(64)
FreeBSD 8.0(64) FreeBSE 9.0(32)
had no problems with this (...)
2012-06-12
add user option to use zoom on MathML :
to test:
-use latest wims_mathml
-use latest adm/light pages (increase/decrease size and switch on/of zoom)
-copy mathml.c.ZOOM to mathml.c
Zoom -for now- is simply : 150 + current_fontsize %
And is implemented as "hardcoded" javascript eventhandler.
Every MathML string <math>...</math> will be increase in size when clicked.
Could be more sophisticated (...) if interesting ?
The \tooltip{message}{formula} is not implemented in firefox (yet),
but will not show MathML in the message, so it can not be used for zooming.
MathJax -also- uses javascript for zooming.
2012-06-11
resizing in adm/light works, finally (pfff)
2012-06-11
It works fine (!) when using:
!set wims_texsize=8 in the modules
(or any other number)
But in adm/light it somehow is not working (hmmm)
2012-06-10
mathml.c : tex_size is configurable in wims_mathml.
The interfacing with mathml.c works fine !
But on my systems the "getvar("wims_texsize")" will not give the setting from adm/light...
So I think there must be some other variable in wims defining the user_texsize ??
I've left some DEBUG info enabled in mathml.c
It will print in /tmp/texsize.txt the current values used.
2012-05-03
- add comments
- clean a little rawmath.c by doing functions (correct a bug by the way in "5E+03")
- put singlespace in insmath.c
- change the function mystrncpy to be compatible with 64 bits - use it in mathml.
- delete modif of Oef2wims/sp.c (no difference now with the wims/src)
- put mathml() in another file
- option in mathml() now -
option 1: change the pointer *p (can be used in htmlmath); option 0: output a string as before
(to use directly in insmath)
- change src/insmath.c in consequences
- put the command htmlmath in rawmath.c as it was at the origin
2012-05-28 : add replace_matrix for \pmatrix in texmath
2012-05-25
add test in mathml if the string is empty : nothing is done.
2012-05-23
htmlmath -> _htmlmath ; htmlmath take in account mathml
define small functions to understand what is done in htmlmath (comments from Karim ...)