The latest version can always be downloaded as http://download.moodle.org/download.php/modules/jsmath.zip
Davide
in both cases nothing happens; within moodle-administration I activated jsMath, but when I type in one of the input-windows mathematical text between doubledollarsigns the input is not 'translated' in mathematical text;
am I doing something wrong?
I have downloaded the latest version(b) from the jsMath-website and from the cvs-environment I downloaded the filter.php-file.
When you view a page containing mathematics (like the one you created using double dollars), you should see a small "jsMath" button at the lower right-hand corner of the screen. If you do, then jsMath and the filter.php have been installed correctly. If you see this and are still not seeing typeset mathematics, let me know.
If you DON'T see this, then it is probably a configuration problem. Here are some things to try: first, view the source of the page that contains the mathematics, and look for jsMath.js (it should be in a SCRIPT tag near the first piece of mathematics on the page). If you see this, then the filter is running correctly, but jsMath is not loading. Check the URL for jsMath.js to make sure it matches the location of jsMath on your server. (It should be something like "http://yourserver.edu/moodle/filter/jsmath/jsMath/jsMath.js".)
If the URL is correct and you still aren't seeing mathematics, try typing the URL into your browser by hand and see if your browser can load the jsMath.js file, or whether you get an error message. It is possible that the file permissions are not correct and the server is not sending the jsMath.js file. You should also check that you can load the moodle/filter/jsmath/jsMath/plugins/tex2math.js file as well. if either of these fail to load, you will not see any mathematics.
You might also be able to get more information from the web server's error log, as this may tell you more details about why one of the files is not being able to be served (e.g., file doesn't exist, file permissions don't allow it, etc.)
Hope one of these helps.
Davide
Thanks for your fast answer. Now, with the right capitalizing, I get the jsMath button! Unfortunately I don't see typeset mathematics. In the places that are doubledollarsigned, there is blank space.
Can you tell me what browser (and version number) you are using, and one what type of computer? Also, can you tell me the version number of jsMath that is reported in the jsMath control panel (obtained by clicking on the jsMath button at the bottom of the screen). Finally, what font mode are you using (it is listed just below the jsMath version on the control panel, in parentheses)? You can send me this information my email and once we get things worked out, I will summarize to this forum; no need to carry on a debugging session on line.
If your browser has a JavaScript Console, are there any messages listed there? (Look through the menu items to see if there is a JavaScript Console anywhere. Note that the Java Console is a different thing.)
Davide
Hi'
I can get JsMath working on my home server running moodle 1.6, but not on the one at school running 1.5+.Here I get the error messages -
Notice: Use of undefined constant version - assumed 'version' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 54
Notice: Use of undefined constant processDoubleDollars - assumed 'processDoubleDollars' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 55
Notice: Use of undefined constant processSingleDollars - assumed 'processSingleDollars' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 56
Notice: Use of undefined constant processTEXtags - assumed 'processTEXtags' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 57
Notice: Use of undefined constant mimetexCompatible - assumed 'mimetexCompatible' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 58
Notice: Use of undefined constant scale - assumed 'scale' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 59
Notice: Use of undefined constant showFontWarnings - assumed 'showFontWarnings' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 60
Notice: Use of undefined constant filter - assumed 'filter' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 61
Notice: Use of undefined constant loaded - assumed 'loaded' in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 62
Any ideas?
thanks kathy
$CFG->jsMath = (object)array(
version => 1.0, // version of this file
processDoubleDollars => 1, // process $$...$$ in text
processSingleDollars => 0, // process $...$ in text
processTEXtags => 1, // process <tex>...</tex> in text
mimetexCompatible => 1, // make jsMath handle mimetex better
scale => 120, // the default scaling factor for jsMath
showFontWarnings => 0, // show jsMath font warning messages
filter => 'filter/jsmath', // where the filter is found
loaded => 0 // internal use
);
with
$CFG->jsMath = (object)array(
'version' => 1.0, // version of this file
'processDoubleDollars' => 1, // process $$...$$ in text
'processSingleDollars' => 0, // process $...$ in text
'processTEXtags' => 1, // process <tex>...</tex> in text
'mimetexCompatible' => 1, // make jsMath handle mimetex better
'scale' => 120, // the default scaling factor for jsMath
'showFontWarnings' => 0, // show jsMath font warning messages
'filter' => 'filter/jsmath', // where the filter is found
'loaded' => 0 // internal use
);
in moodle/filter/jsmath/filter.php.
The error messages seem to be complaining about the names being used on the left of the arrows, which php is trying to interpret as constants. Putting the quotes around them should clear up the messages. Good luck. Davide
Thanks for that Davide,
it is almost working without errors - just one
Notice: Undefined property: stdClass::$loaded in C:\apachefriends\xampp\htdocs\filter\jsmath\filter.php on line 84
line 84 is
if ($CFG->jsMath->loaded) {return $text;}
any further ideas?
thanks
kathy
So my second guess would be that something is not right with the initialization of the 'loaded' property at the top of the file (around line 60). If you inserted the quotes that I suggested above by hand, check that you have not accidentally inserted anything else on the 'loaded' line (like perhaps an extra space or character inside the quotes).
If you copied and pasted the code from my message, that probably won't be the problem. In that case, can you email me the copy of the filter.php that you are using? I'll see if I can see anything that might be the problem. Also, can you determine what version of php you are using?
Davide
Hello,
I replaced the 2.3b-version in 2.3c, but this is no solution for my problems; I get exactly the same behaviour as I mentioned above and described in my email I sent you.
Davide
I work with jsMath version 2.3c and moodle 1.5.2
I've configured the filter to process with simple dollar. It works with IE6, firefox mozilla and opera
When I configure the filter to process with double dollars. It works with mozilla firefox, opera but not with IE6.
In IE6, the filter seems to process the mathematics but finally nothing is displayed. I tried several options in the jsMath control panel but without results.
The javascript console indicate an error
ligne : 184
Car : 96
Erreur : '/' attendu
Code: 0
URL : http://s139702870.onlinehome.fr/moodle/mod/resource/view.php?id=1726
With firefox mozilla (double dollars configuration), I always have a javascript error
Erreur : unmatched ) in regular expression
Fichier Source : http://s139702870.onlinehome.fr/moodle/mod/resource/view.php?id=1726
Ligne : 222, Colonne : 31
Code Source :
jsMath.tex2math.pattern.tex = /((^|[^\])(\[^\[\(])*)(\\((([^\]|\[^\)])*)\\)|\\[(([^\]|\[^\]])*)\\]|(\$\$)(([^$\]|\.)*)\9)/;
Thanks for your help.
Stephane
Let me know if that doesn't take care of it for you.
Davide
I don't have anymore javascript error.
In IE6, I noticed that when in the code of the page, mathematical formulas are between paragraph tags <p> , they are not displayed.
Stephane
Davide
You can see the problem on my test site
http://s139702870.onlinehome.fr/moodle/
go to the course category "Mathématiques" and the course "Test Jsmath"
You can use the forum.
Connect as a guest
Thanks
Stephane
You can get the new copy of jsMath either from the jsMath site, or the Moodle CVS repository.
Davide
Now, it works very well for me in Mozilla firefox, IE6 and opera
Just a detail in IE6
When I create a web page with a mathematical formula, the width of the formula goes beyond the space box create by moodle.
Stephane
I don't get the same results that you do. Here is a screen snapshot from your site as I see it from here (using IE6.0.29)
The problem is not in the forum but when I create a web page in moodle (function Add a ressource =>Compose a web page).
In my course click on the link "essai" and you can see the problem with IE6.029
http://s139702870.onlinehome.fr/moodle/
category : Mathématiques
Course : Test JsMath
Thanks
Stephane
Davide
I also worked around a bug in Opera that prevents it from measuring the mathematics within some tables, and fixed a bug in jsMath that was causing Opera to misalign mathematics within tables.
Finally, I added a new option for the jsMath filter that allows you to make double-dollars operate as single-dollars (i.e., they produce in-line math rather than display math), which I understand was the behavior for the mimetex-based filter.
You should get both the new version of filter.php and version 2.3e of jsMath from the Moodle CVS repository.
Hope this takes care of your problem.
Davide
Thank very much
I will advice you if I find another problem
Jsmath is a fantastic script
Stéphane
Thanks Davide. I get now the math-text onscreen.
Still one question about this: the math-text is always placed in the middle of a new line. For example, when I type:
given $$f(x)=x^2$$ and $$f(x)=3x-1$$, I get four lines:
one line with 'given' (at the left)
one line with the right formula: the word displaystyle etc can be read at the left, but the formula is placed in the middle
one line with the next formula: the word displaystyle etc can be read at the left, but the formula is placed in the middle
one line with 'and'
Can the placing be manipulated?
At this time I am happy that math is possible for me!
Sjaak
Can you tell me what you ahve used to indicate mathematics in the example above (the mimetexc filter has removed it, so I can't tell what you used). Is it dollars, double-dollars, 'tex' tag, or what?
Davide
I placed the mathtext between doubledollarsigns.
Sjaak
an addendum to my earlier mail describing the misplacement of the math-text:
the word displaystyle etc can be read for a very short time at the left, but then the correct formula itself is placed in the middle.
Sjaak
It would be possible to do the work of tex2math in the jsMath filter itself, so that the math will already be placed in the SPAN and DIV tags that jsMath needs, but the processing that tex2math does is fairly sophisticated, and the patterns are sufficiently complicated that I didn't want to try to convert it to php (I've never programmed in php before this filter, and didn't want to take time to figure out how to do in php what I already have working in JavaScript). And even if you did this, it would not really help, since jsMath still has to go over the page to convert the TeX to typeset math.
Since jsMath is rather slow about processing the mathematics, it does so asynchronously, meaning that it lets the page be displayed and then goves over the page to insert the mathematics. That way, you can start reading the page before the math is all processed. On pages that have only a little bit of math, that would not be necessary, but on ones with a lot of math, it is a big help. Without it, there could be a substantial delay before the page was made visible.
JsMath does have a method of converting the mathematics before the page is displayed, but it can't be used from within the onLoad hander, since some browsers (like MSIE) display the bage before running the onLoad hander. The call to jsMath would have to be made within the body of the page, and that would require a change to the moodle page-building code to put a single call to jsMath at the bottom of the page. (The filter runs on a per-message basis, not a per-page basis, so when the filter runs, it doesn't know if it is the last piece of math on the page, so can't tell if the jsMath call should be inserted or not.) It would be possible to call jsMath for each message as the page is being built, but that would slow things down ever further.
A compromise could be to do the tex2math conversion in the filter and set the style to 'display: none' so that the tex code would not appear until jsMath processed it. The drawback here is that if someone views the page with a browser that doesn't handle javascript, they will never see any math. With the current set up, they at least get to see the TeX code, which often is readable enough to get the idea across.
Davide
That's an impressive and for me an interesting explanation. BTW: for me it's not a problem that displaystyle etc will show up first; I only thought that my problem about the centering of the text maybe had to do with this behaviour. But as you told me in your next mail, it has to do with use of \(...\); and that is working.
Thanks, Sjaak
Apparently the mimeTeX filter used double-dollars for in-line math (a misfeature in my opinion). I'll see if I can add a flag to the jsMath filter that allows it to treat double-dollars as single ones.
Davide
Inline math in MSIE is possible with \(..\).
As often, every solution gives new problems. On different computers the inline-placing is not always correct. In MSIE it sometimes goes wrong with , for example,
Given $$f(x)=x^2$$ and $$g(x)=\frac{x}{x-1}$$.
The first math-text is placed correct, but math-text with fractions, like the second, is on some computers placed too low; g(x) is placed at the level of about a subscript and x is placed at about the height of the 'normal' sentence.
Until now, in Opera it seems no problem.
Sjaak
That being said, I am not able to reproduce the behavior you describe. Can you set up a page in a public forum where I can see the problem? I'll see what I can do. Thanks.
Davide
Here's an example of what can be seen on some computers.
But on other computers it's no problem. That makes it difficult to detect the problem.
Sjaak
In the meantime, do I understand you to say that IE on some machines works OK and on others it doesn't? If so, can you determine what might be a common factor? (Different versions of Windows, or of IE itself; different monitor settings or resolutions?)
One thing to try is change the font size for the page (in the view menu) and reload the page, or change the scaling factor in the jsMath control panel. Do you get different results with different settings?
Finally, if you change the size of the window (make it smaller so the lines wrap differently) does that make a difference? For example, if you can get the two pieces of mathematics to be on different lines, does that change anything?
It does look like this might be a difficult one to figure out.
Davide
I made a forum within a course within my moodle-environment. I'll sent you the address and the enrolment key by mail.
Sjaak
Davide
I also updated the filter to allow a bit more control over what gets processed by jsMath. You can now mark sections so that they will NOT be processed for mathematics (so they can include the math delimiters without them being turned into mathematics). You do this by using a <DIV CLASS="tex2math_ignore"> around the text that you don't want to be processed. (You can also nest within it additional tags that are CLASS="tex2math_process" to turn processing on again.)
It is also possible to turn off tex2math entirely for the complete page by including a tag with ID="tex2math_off" anywhere on the page. The idea is that when you start a forum or a discussion, you can include <SPAN ID="tex2math_off"></SPAN> in your message and that will disable tex2math completely.
Note that it is possible for anyone to enter such a tag in their message (perhaps meliciously) and it will turn off math on the entire page. Of course, you will be able to tell who did it, since it will be within a specific message, and most students will not know you can do this.
If you don't want to risk that, you can set the allowDisableTag
to zero at the top of the filter.php. That will prevent the ID="tex2math_off" from being processed.
Hope this helps. Davide
Thanks
Sjaak
I have just updated the jsMath filter stored at the Moodle CVS repository. This brings jsMath up to version 2.4. This version includes a new feature where you can double-click on an equation to get a display of the TeX code used to create the equation. (You can drag the resulting window around by the drag bar at the top, and can close it using the small box at the upper left, or by ALT-clicking anywhere in the window.)
Another new feature is that the filter will not process mathematics that is within a PRE block, so for code listings, for example, you can use these to prevent the dollar signs and so on from being processed within the code listing.
One more addition is the ability to set the strings to be used for indicating in-line and display mode mathematics. You can edit the data at the top of the filter.php file to set your own strings for these if you don't like the TeX/LaTeX ones. Read the comments in the filter.php file, and follow the instructions there.
Finally, there is a new checkbox on the jsMath control panel that allows you to turn off the tex2math processing entirely, so if there is a page where the mathematics is being incorrectly processed, you can turn off the tex2math conversion and see the unmodified page. This last feature is the result of a request from an administrator who was having students enter code fragments that included \(...\) and \[...\] and so on, and these were being turned into mathematics by jsMath.
If you have pages where the discussion will NOT include mathematics, it would be possible to make jsMath ignore these pages entirely. One idea I have for this would be to allow you to mark a page by entering a special hidden tag that jsMath could look for to see if it needs to skip the page. If this sort of feature would be useful to you, please let me know.
Hope this helps some of you out.
Davide
thanks for your continued to support to moodle family
One of the main problems with jsMath in IE was when the text that contains the mathematics is scaled, as it is with most Moodle pages. The rendering was poor in that situation, but that is now fixed. The baseline alignement problems, while not quite so serious, were also annoying, but I think those are taken care of as well. So I think you will have better luck with it now.
when I updated all the files including the 7MB font folder etc, I could not get the jsMath filter working. I do not even see the jsmath control button at the lower right corner.
That probably means that jsMath.js has not been loaded by your browser. The reason is most likely a naming problem with the directories on the server. The jsMath directory in moodle/filter should be called "jsmath" not "jsMath" as it was originally called in my earlier messages. (This is because of how the directory is named in the Moodle/contrib directory of the CVS repository.) If it is not named correctly, the filter will not be able to locate the jsMath.js file correctly.
Also, the directory that contains jsMath.js should still be named jsMath. So you should have:
moodle/filter/jsmath moodle/filter/jsmath/filter.php moodle/filter/jsmath/jsMathand the moodle/filter/jsmath/jsMath directory should contain all the jsMath javascript files, plus the Plugins directory and the fonts directory. If your filter/jsmath directory was named filter/jsMath, you will need to change it (but first turn off that filter in the Moodle administration menu, and after you change the name, activate the filter again).
If that doesn't take care of the problem, let me know.
Davide
1. the native Tex font radio button option is disabled. Why it is so? I already downloaded the Tex fonts and put them in \filter\jsmath\jsMath\fonts\.
2. Using image fonts to render math equations destroys the colour highlighting etc and it is quite slow also. I understand that creating coloured font images for all symbols and all sizes is nearly impossible. My suggestion is to improve the native unicode font resolution and keep as default. this will also avoid uploading 7MB of image fonts to the webserver and updating it quite frequently.
3. I could not render LaTex syntax like \align etc. I think these syntax have not been implemented.
4. Quite often my collegues use Mathtype and export either with AMS-TEX translation or LaTex syntax translation. However, I found that, one has to manually edit the exported math equation to clear any line breaks and bring it one continuous line. Is it not possible to simply ignore white spaces and render the images?.
This syntax does not render at all:
\left( {\begin{array}{*{20}c}
{a_{11} } & {a_{12} } & {a_{13} } \\
{a_{21} } & {a_{22} } & {a_{23} } \\
{a_{31} } & {a_{32} } & {a_{33} } \\
\end{array} } \right)
This syntax renders the matrix as a single row matrix: (the line breaks are manually removed here)
\[\left( {\begin{array}{*{20}c} {a_{11} } & {a_{12} } & {a_{13} } \\ {a_{21} } & {a_{22} } & {a_{23} } \\ {a_{31} } & {a_{32} } & {a_{33} } \\ \end{array} } \right)\]
This syntax renders the correct matrix\cr is used instead of\\|)
\[\left( {\begin{array}{*{20}c} {a_{11} } & {a_{12} } & {a_{13} } \cr {a_{21} } & {a_{22} } & {a_{23} } \cr {a_{31} } & {a_{32} } & {a_{33} } \cr \end{array} } \right)\]
Is it possible to rectify these minor problems?
Thanks for your continued interest in moodle family
- the native Tex font radio button option is disabled. Why it is so? I already downloaded the Tex fonts and put them in \filter\jsmath\jsMath\fonts\.
That is not where they go. Those TeX fonts need to go on the user's machine (i.e., on the machine that is running the browser), not on the server.
- Using image fonts to render math equations destroys the colour highlighting etc and it is quite slow also. I understand that creating coloured font images for all symbols and all sizes is nearly impossible.
Yes, you are correct that in image mode the mathematics can't be colored. This is a known (and documented) limitation, and I can see no way around it. It's one of the reasons that images-for-symbols-only is the default rather than full image fonts. At least then the variables and numbers will be colored.
- My suggestion is to improve the native unicode font resolution and keep as default. this will also avoid uploading 7MB of image fonts to the webserver and updating it quite frequently.
You should not need to update 7MB of image fonts frequently. I do not anticipate that these fonts will change at all in the future. I understand your desire to have the unicode fallback work better, but it is what we call in programming a "fragile" mechanism, meaning that it is not very reliable. It depends in a fundamental way on the fonts installed on the user's system, and I have no control over that, and they vary widely from system to system. I can not rely on the needed characters being available, and when they are, I can't rely on them being taken from the font I expect, and so can't be sure of the size of the characters or whether they fit in well with the rest of the font, etc. And while most of the characters can be found from fonts on the Mac and the PC, this is far less effective on most Unix installations.
Because I use a Mac myself, I have tuned the fallback pretty well to work with a default font installation on OS X, but I have a lot less experience with the PC, and the results there are not so satifactory (I don't really even know what a default font installation is). I've also noticed that what worked well a year ago when I developed jsMath no longer works as well on the PC (some characters are now mispositioned). I assume this is due either to font changes or system updates on the machine where I test jsMath (which I don't control myself). I plan to go through the fallbacks again to update them, but this is one indication of why the unicode approach is less reliable than the image mode.
Under most circumstances, the image mode does a much better job than the unicode fallback. The three exceptions are colored text, changing the font size, and printing. The first I can't really do anything about; the second, you need to reload the page after changing the text size (or select the "scalable" checkbox on the options panel); and for the third, there is the "his-res fonts for printing" button on the control panel.
If you really want to make unicode the default fallback, you can do that (it will take a small edit to the filter.php file). If that's what you want, let me know and I'll tell you how to do it. As I said, I'll go back over the fallback fonts when I get a chance, but I don't expect a substantial improvement.
- I could not render LaTex syntax like \align etc. I think these syntax have not been implemented.
You are right, there are lots of LaTeX environments that are not implemented. Nore are all the commands for labels and references, or for line numbers. There is far too much to LaTeX to make it practical to implement it all, and jsMath is already huge as it is. Every new feature adds to its download time, so there is s trade-off to adding more to it. I have plans to give jsMath a more modular structure, and the ability to load extra code on demand (i.e., only when the mathematics being typset actually requires it), but that is still in the future, and will have the drawback of causing a delay in the rendering as the new code is loaded).
I'm not all that conversant in LaTeX (I learned TeX when LaTeX was still in its infancy, and so never really took to it, so I don't know all the environments or other commands that might be desired. If there are important ones missing, make a list, and I'll see what I can do, as time permits.
- I found that, one has to manually edit the exported math equation to clear any line breaks and bring it one continuous line. Is it not possible to simply ignore white spaces and render the images?.
JsMath does handle white-space and line breaks properly, but I expect that the Moodle text editor has added <br/> tags at the end of those lines, and that will prevent the tex2math
converter from recognizing it as mathematics (the mathematics can not contain HTML tags). There is not much I can do about the fact that the editor introduces those tags. The way that tex2math
locates the mathematics on the page would make it difficult to ignore these tags (though I'll think about whether that might be possible). So the only place where that could be handled is in the jsMath filter. It would be a major change to the way it works, and and would require duplicating a lot of the logic from tex2math
in the filter itself, so I'm a little hesitant to do that. I'll think about whether there isn't a better solution.
The issue of the backslashes is also probably due to the editor. JsMath should handle \\ fine, but I suspect they are being converted to single slashes by the interface somewhere (I have seen discussions about this problem elsewhere). I don't think that is something I will be able to change.
Not using the fancy HTML editor interface would be one solution to both these problems, but I doubt you would want to do that.
- Thanks for your continued interest in moodle family
You're welcome. I'm always pleased when people want to use jsMath, and do what I can to make it work for them.
Davide
venkatesan
tex2math
plugin to jsMath, on which the jsMath filter relies, and should be able to get around the line-break problem. Still have to test it on MSIE, and there will undoubtedly be problem that I need to work out (there always are).
- Is it possible to incoporate editing facility within the popup window and update the equation on the moodle page?
Not very likely. It would be possible to edit the TeX in the browser window, but there is no easy way to have that be saved again on the server. It would be possible to "fake" a submission of a form like the one you get when you edit a message, but the problem with that is jsMath would need access to the unfiltered original message, which it doesn't have. (It only has a modified vesion of the message; one that has passed through all the Moodle filters that are active.)
- This could make minor corrections easier without loading the whole page again.
Making permanent changes would require reloading the page at least once. Anything else would require substantial rewrites to Moodle itself.
There was a group that was working on integrating jsMath with the HTML editor at one point so that the math could be more easily previewed. I'm not sure what the status of that project is.
Davide
Hi David,
Is there a library of syntax used when wrtiting text to generate images with jsMath?
Thanks,
Eric
If you are asking "How do you enter mathematics so that jsMath can typeset it?" then the answer is that you use the typsetting language called TeX. This has been around since the late 1970's, and there are many introductions to TeX on line.
A glossary for the mimeTeX filter that is part of Moodle is available at
http://moodle.hughesmark.com/mod/glossary/view.php?id=268, and jsMath handles most of what it listed there, so that is one place you can start.
You can also find a list of most of the TeX symbol names at the jsMath home page.
Hope that helps.
Davide
David,
Thank you very much for your reply. That was exactly the information I was looking for. I apologize for such an amatour question. I am very new to Moodle and the concept of online education, and I am still trying to get my hands around all the features.
Eric
I think this should work well for you, but since it is brand new code, there may still be some bugs lurking in there. If you see anything that doesn't seem right, let me know. You need to get both the filter.php file and the jsMath.zip file from the CVS archive. (You don't need to download the fonts again; they aren't changing).
I also checked on the \\ issue, and it looks like you can use these in the Moodle editor without trouble. I cut and pasted the example array that Venkatesan included in his message above, and it worked fine. Note, however, that if you DON'T use the WYSIWIG editor, but instead use the standard browser type-in area, when you edit a post, double backslashes are converted to single backslashes in the text that appears in the type-in box initially, so that might have been the source of the problem.
Finally, I think it may be time to start a new discussion. This one has gotten pretty long, and it takes quite a while for Moodle to render it now.
Davide
1. The
2. Since I'm a chemist many times myself and my collegues lot of chemical reactions and we write many things above and below the right and left arrows. I think the following LaTex synatax can be included also.
\xrightarrow[y]{x}
\xleftarrow[y]{x}
\underset{y}{\overset{x}{\longleftrightarrow}}
\underset{y}{\overset{x}{\longleftrightarrow}}
similarly for left and right harpoon
These will be quite useful for us in writing all our chemical equations.
I think you can start a fresh thread with updated version.
- The <tex> syntax is not rendering eventhough the filter.php is correctly set. I would like to use this instead of \( \) syntax due to its compatability with the moodle tex filter.
Can you send me the configuration section of your filter.php file? It is hard to determine the problem without knowing the settings you have in place. I suspect that you have turned off processing of the other math delimiters, but unfortunately, that won't work. The way the filter works is that it changes the <tex> tags into whatever the filter is using for in-line math delimiters. If you have turned them all off, there is nothing for it to use. (It will default to single dollars, but these will not be processed by jsMath, since you have turned them off.) JsMath can't look for the <tex> tags itself, because they are not "real" HTML tags, and most browsers will discard them before jsMath gets to see the page, so they won't be there for jsMath to find.
While writing this, I realized that it would probably be better just to convert these to the <SPAN CLASS="math"> tags that jsMath looks for, rather than making tex2math
handle them. I'll have to make that change in the next version. In the meantime, if you don't want to process the dollars or \(...\) notation, you need to enable cutsom delimiters (so the filter has SOMETHING to use for marking mathematics). You can make them as complicated as you want, since no one is going to be typing them directly, and they should be something that won't appear naturally. For example [%%MaTh%%]...[/%%MaTh%%] and [%%DiSpLaY%%]..[/%%DiSpLaY%%].
As for the arrows, I will see about making them available; it should not be hard. For the moment, you can get \overset{x}{y} as \buildrel{x}\over{y}, but the others are not easily handled at the moment.
Davide
. '<script language="JavaScript" type="text/javascript">'."\n" . ' jsMath.Setup.Script("plugins/tex2math.js");'."\n"to
. '<script language="JavaScript" type="text/javascript">'."\n" . ' jsMath.Setup.Script("../moreArrows.js");'."\n" . ' jsMath.Setup.Script("plugins/tex2math.js");'."\n"(i.e., insert the middle line). The "X" in front of "language" isn't supposed to be there, but something in the Moodle censoring mechanism is working hard to make sure I'm not submitting JavaScript code to this forum. Be sure you don't insert the X when you edit the filter.php file.
That should make \xrightarrow, \overset, etc. work for you. I wasn't quite sure what the harpoon commands were supposed to be, so I did \xuprightharpoon, \xupleftharpoon, \xdownrightharpoon and \xdownleftharpoon. Not sure if that's what you had in mind or not. Let me know if these should be changed.
Davide
Hi Davide,
I am going through the forum and I am a littlr confused as to which is the final filter / function for math functions.
I shall be grateful if you could point me in the right direction for download and installation.
I apologise for this botheration.
Regards
Garry
http://cvs.sourceforge.net/viewcvs.py/moodle/contrib/jsmath
or you can download the whole thing via:
http://download.moodle.org/download.php/modules/jsmath.zip
Hope that helps.
Davide