Rev 5540 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5540 | schaersvoo | 1 | 2012-07-01 |
2 | new version of insmath.c : |
||
3 | correct the call to texmath when / is found (to check) |
||
4 | if mathmlmode, replace \pmatrix by latex code (could be done in all cases) |
||
5 | now |
||
6 | |||
7 | wims.c should be modified |
||
8 | #include "mathml.c" |
||
9 | #include "texmath.c" |
||
10 | #include "rawmath.c" |
||
11 | #include "insmath.c" |
||
12 | |||
13 | |||
14 | comments : |
||
15 | |||
16 | rawmath = used on answers of students ; oef uses it when the type is function, complex, rational |
||
17 | It is used by insmath only if insmath_rawmath=yes |
||
18 | Transforms user math formula in computer math formula (should be accepted by |
||
19 | calculators). |
||
20 | |||
21 | 1 - Replace some badcharacters as **, ², ³. |
||
22 | 2 - If (mathalign_base < 2) unmatch=__replace_abs(p). |
||
23 | 3 - translate ++, +-, -+, ... into one sign |
||
24 | 4 - translate | | in abs |
||
25 | 5 - replace new lines or tabs by spaces |
||
26 | 6 - add zero in case of decimal digits if necessary : for example, replace 4. by 4.0 and .5 -> 0.5 |
||
27 | if rawmath_easy : |
||
28 | 7 - replace justapositions by multiplications if rawmatheasy=yes |
||
29 | |||
30 | htmlmath: must be applied to a formula coming from the computer and transforms it in |
||
31 | a "pretty" html formula |
||
32 | 1 - Replace < and > by html code if "htmlmath_gtlt=yes". |
||
33 | 2 - All digits or + or - following a ^ or _ are considered as in exponent/subscript ; |
||
34 | expression with ( ) following a ^ or _ are considered as in exponent/subscript |
||
35 | parenthesis are remove (if no sign before) except in case of exponent and only digits. |
||
36 | 3 - Get rid of 1*.. ..*1. |
||
37 | example : in 1 * x, x/1, the 1 is removed. |
||
38 | 4 - Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless. |
||
39 | 5 - Replace some names as greek letters by their equivalents. |
||
40 | 6 - Remove * or replace by multiplication sign. |
||
41 | 7 - Replace <=, >=, ->, =>, <=> by their equivalents. |
||
42 | |||
43 | texmath : must be applied to a formula coming from the computer and transforms it in |
||
44 | a "pretty" tex formula. So the input must not contain \ or tex codes. 3 (5+6) will give |
||
45 | strange thing (it should be 3*(5+6) ). Must apply insmath to the code generated by |
||
46 | texmath after. |
||
47 | 1 - transforms computer matrix as [ 4,5;6,7] in tex matrix |
||
48 | 2 - transforms A/B in {1 over B} A or { A over B} according to the priority of |
||
49 | the presume type of A and B (integer, numeric, variable, poly, transcend |
||
5562 | bpr | 50 | 3 - transforms cos(x)^n in cos^n(x) (list ??) not sure of that ! |
5540 | schaersvoo | 51 | 4 - transforms <=, <=> =>, -> |
52 | 5 - transforms a relation without a second member by adding 1 |
||
53 | 6 - Replace scientific notation 35E-05 by 10 power and add multiplication sign. Remove the + or 0 useless. |
||
54 | 7 - Remove * |
||
55 | 8 - Replace some names as greek letters by their equivalents. |
||
56 | 9 - interpret in latex formula as sum(), integrate, prod () (should come from maxima in this form) |
||
57 | So it is doing a little more than htmlmath because it was easier to have matrices and fractions in tex. |
||
58 | |||
59 | insmath: take a formula and send it to html or tex : |
||
60 | 1 - replace .. by , |
||
61 | 2 - If there is no \ or { , apply rawmath if it is asked : it is then assumed it is |
||
62 | "computer formula" (ts=0) , else it is an "tex formula" (ts=1) |
||
63 | 3 - If ts=0 and if it seems to contains a computer matrix ([;,]), apply texmath. |
||
64 | (here it can do should be dangerous, if the formula was not computer formula). |
||
65 | send to tex then return the image (END) |
||
66 | 4- (we are in a case where ts=0) : Do something to interprete font names or variables : |
||
67 | if word as "sqrt int integrate sum prod product Int Sum Prod conj abs" is found, |
||
68 | interprete it in texmath ; |
||
69 | send to tex then return the image (END) |
||
70 | 5 - (we are in a case where ts=0) : look for / (formula like 5/(1+x) ). |
||
71 | interprete it in texmath; |
||
72 | send to tex then return the image (END) |
||
73 | |||
74 | If ts=1, the formula is just send to tex then return the image. |
||
75 | |||
76 | What about mathml case. |
||
77 | |||
78 | 1 - htmlmath (version mathml) does the same thing than htmlmath |
||
79 | except that it transforms with tex codes rather than html codes |
||
80 | and send it after to mathml (html-math=mathml-math) |
||
81 | 2 - texmath is exactly the same (recall that the output of texmath is just tex code non interpreted) |
||
82 | 3 - insmath : replace \pmatrix{ } by latex syntax ; |
||
83 | do exactement the same thing that the insmath with gifs except that the call to gifs |
||
84 | is replaced by a call to mathml. |
||
85 | |||
86 | |||
87 | |||
88 | |||
89 | |||
90 | |||
91 | 2012-06-17 |
||
92 | stupid typo "char mml_buffer[sizeof(MAX_LINELEN)+1]" prevented mathml to work on GENTOO linux |
||
93 | (leiden mirror ) |
||
94 | it should ofcourse be "char mml_buffer[MAX_LINELEN+1]" |
||
95 | strange that |
||
96 | OpenSuSE 11.4(32) OpenSuSE 12.0(64) |
||
97 | FreeBSD 8.0(64) FreeBSE 9.0(32) |
||
98 | had no problems with this (...) |
||
99 | 2012-06-12 |
||
100 | add user option to use zoom on MathML : |
||
101 | to test: |
||
102 | -use latest wims_mathml |
||
103 | -use latest adm/light pages (increase/decrease size and switch on/of zoom) |
||
104 | -copy mathml.c.ZOOM to mathml.c |
||
105 | |||
106 | Zoom -for now- is simply : 150 + current_fontsize % |
||
107 | And is implemented as "hardcoded" javascript eventhandler. |
||
108 | Every MathML string <math>...</math> will be increase in size when clicked. |
||
109 | Could be more sophisticated (...) if interesting ? |
||
110 | The \tooltip{message}{formula} is not implemented in firefox (yet), |
||
111 | but will not show MathML in the message, so it can not be used for zooming. |
||
112 | MathJax -also- uses javascript for zooming. |
||
113 | |||
114 | 2012-06-11 |
||
115 | resizing in adm/light works, finally (pfff) |
||
116 | |||
117 | 2012-06-11 |
||
118 | It works fine (!) when using: |
||
119 | !set wims_texsize=8 in the modules |
||
120 | (or any other number) |
||
121 | But in adm/light it somehow is not working (hmmm) |
||
122 | |||
123 | 2012-06-10 |
||
124 | mathml.c : tex_size is configurable in wims_mathml. |
||
125 | The interfacing with mathml.c works fine ! |
||
126 | But on my systems the "getvar("wims_texsize")" will not give the setting from adm/light... |
||
127 | So I think there must be some other variable in wims defining the user_texsize ?? |
||
128 | I've left some DEBUG info enabled in mathml.c |
||
129 | It will print in /tmp/texsize.txt the current values used. |
||
130 | |||
131 | 2012-05-03 |
||
132 | - add comments |
||
133 | - clean a little rawmath.c by doing functions (correct a bug by the way in "5E+03") |
||
134 | - put singlespace in insmath.c |
||
135 | - change the function mystrncpy to be compatible with 64 bits - use it in mathml. |
||
136 | - delete modif of Oef2wims/sp.c (no difference now with the wims/src) |
||
137 | - put mathml() in another file |
||
138 | - option in mathml() now - |
||
139 | option 1: change the pointer *p (can be used in htmlmath); option 0: output a string as before |
||
140 | (to use directly in insmath) |
||
141 | - change src/insmath.c in consequences |
||
142 | - put the command htmlmath in rawmath.c as it was at the origin |
||
143 | |||
144 | 2012-05-28 : add replace_matrix for \pmatrix in texmath |
||
145 | |||
146 | 2012-05-25 |
||
147 | add test in mathml if the string is empty : nothing is done. |
||
148 | |||
149 | 2012-05-23 |
||
150 | htmlmath -> _htmlmath ; htmlmath take in account mathml |
||
151 | define small functions to understand what is done in htmlmath (comments from Karim ...) |
||
152 |