Hello
I'm piloting Moodle 1.8. We use WebCT CE6 at the moment with jsMath fliters on the server. I currently develop theory pages for maths using Dreamweaver, adding a script tag which tells the page to load the maths fonts.
I would like to be able to use the same pages in Moodle, but I do not understand how to include a script tag that will pull in the fonts in Moodle. When I look at the source code for a document I create in Moodle, this tag appears: however, if I put this tag in a document created in an external editor, it does not pick up the maths.
Does anybody know how to get moodle to put the maths fonts into an imported document.
Thanks
sorry the tag didn't appear it should be: <span id="Process_jsMath"></span>
You can force font pages to be loaded by editing the loadFonts field of the moodle/filter/jsmath/javascript.php file on your Moodle serrver. For example:
loadFonts: ["cmmib10"],will load the bold math font automatically. If you want to use the AMSsymbols package, you should modify the loadFiles field instead. For example,
loadFiles: ["extensions/AMSsymbols.js"],should work.
Hope that helps.
Davide
Hello
Thanks for your response. However, I don't have admin rights in Moodle. I would like to do it as a teacher or a course administrator.
Is there any way of doing this.
Thanks for your response. However, I don't have admin rights in Moodle. I would like to do it as a teacher or a course administrator.
Is there any way of doing this.
Well, there are two possibilities. If you want to load an extension like the AMSsymbols extension, you can use \require{AMSsymbols} (within math mode) to cause the AMSsymbols extensions to load. You can put it inside math delimiters at the top of the page if you want.
Most fonts don't have their own extension, however. In that case, you will need to try to access the font via the \char command, which is not the standard TeX command, but a modified one for jsMath. Use \char{font}{number}, where name is the name of the font (e.g., cmmib10) and number is the character position within the font (e.g., 65 or x41 in hex). This will autoload the font if it isn't already loaded.
Hope that helps.
Davide
Most fonts don't have their own extension, however. In that case, you will need to try to access the font via the \char command, which is not the standard TeX command, but a modified one for jsMath. Use \char{font}{number}, where name is the name of the font (e.g., cmmib10) and number is the character position within the font (e.g., 65 or x41 in hex). This will autoload the font if it isn't already loaded.
Hope that helps.
Davide
I'm sorry, I really don't understand what you are saying there, can you post an example as part of the body of an html document.
Sorry, I think I misunderstood your original message. It sounded to me like you had jsMath working but that you were not able to load some of the extra fonts that jsMath can use. I have re-evaluated that, and think that you have jsMath working in the documents created from Moodle directly, but you want to link to other HTML pages in which you want to include mathematics, and want to know how to use jsMath in those. Is that right?
In that case, you need to include a <SCRIPT> tag whose SRC attribute is set to load filter/jsmath/jsMath/easy/load.js from your moodle server (you will need to give a complete URL including your server name, but I don't know what that is for you).
You may need to edit the easy/load.js file, but since you are not the administrator, you may need to make a copy of this file and edit that yourself, then have your HTML file load your copy instead. Be sure to set the "root" location properly in your copy of the easy/load.js file.
More complete instructions are available on the jsMath web site at
http://www.math.union.edu/locate/jsMath/authors/
See if that helps.
Davide
PS, you don't see the <SCRIPT> tag in the moodle document itself because it is controlled by the javascript-mod.php file that is loaded automatically by moodle. So the jsMath information is hidden in that.
In that case, you need to include a <SCRIPT> tag whose SRC attribute is set to load filter/jsmath/jsMath/easy/load.js from your moodle server (you will need to give a complete URL including your server name, but I don't know what that is for you).
You may need to edit the easy/load.js file, but since you are not the administrator, you may need to make a copy of this file and edit that yourself, then have your HTML file load your copy instead. Be sure to set the "root" location properly in your copy of the easy/load.js file.
More complete instructions are available on the jsMath web site at
http://www.math.union.edu/locate/jsMath/authors/
See if that helps.
Davide
PS, you don't see the <SCRIPT> tag in the moodle document itself because it is controlled by the javascript-mod.php file that is loaded automatically by moodle. So the jsMath information is hidden in that.
this is driving me insane.
I have the script in all of the pages, but it still doesn't resolve.
Here is the some script from my document:
<link href="../../../styles/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script src="http://moodlething.college.ac.uk/filter/jsmath/jsMath/jsMath.js"></script>
<h1>Factorisation.</h1>
An important algebraic process is <strong>factorisation</strong>. You should be able
to factorise many simple quadratics by inspection eg. (a) ....
why won't it find the script in the document??
Tina
I have the script in all of the pages, but it still doesn't resolve.
Here is the some script from my document:
<link href="../../../styles/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<script src="http://moodlething.college.ac.uk/filter/jsmath/jsMath/jsMath.js"></script>
<h1>Factorisation.</h1>
An important algebraic process is <strong>factorisation</strong>. You should be able
to factorise many simple quadratics by inspection eg. (a) ....
why won't it find the script in the document??
Tina
I recommend that you load
http://moodlething.college.ac.uk/filter/jsmath/jsMath/easy/load.jsnot jsMath.js itself. (You may need to edit this file, so if you are not an administrator, you will have to make a copy of it somewhere in your course area and load that edited copy instead. In that case, it will be particularly important that you set the root: value correctly.)
The reason your page is not displaying math probably is because loading jsMath.js is not sufficient to have jsMath process the page. You also need to call one of jsMath.Process() or jsMath.ProcessBeforeShowing() (within <SCRIPT> tags). And if you want jsMath to recognize math inside TeX or LaTeX delimiters, you also need to load the tex2math plugin, and call jsMath.ConvertTeX() or jsMath.ConvertLaTeX, or one of the other alternatives, before the jsMath.Process command.
All of this will be handled for you if you use easy/load.js rather than jsMath.js. See the jsMath author's documentation for details of how to get jsMath to process math in web pages.
Davide
Thanks Davide
I am a server administrator for Tina and have looked through what you said.
I have linked to easy/load.js instead of jsMath.js and set root: "/filter/jsmath/jsMath",
The file calls the following, however it is still not processing the maths:
Yours
James
I am a server administrator for Tina and have looked through what you said.
I have linked to easy/load.js instead of jsMath.js and set root: "/filter/jsmath/jsMath",
The file calls the following, however it is still not processing the maths:
<script src="http://moodle.college.ac.uk/filter/jsmath/jsMath/easy/load.js">
</script>
<script src="http://moodle.college.ac.uk/filter/jsmath/jsMath/jsMath-easy-load.js">
</script>
<script src="http://moodle.college.ac.uk/filter/jsmath/jsMath/plugins/autoload.js">
</script>
Is there something else I may be missing. I have attached the load.js file in case that is set wrong.Yours
James
James:
Thanks for looking into this for Tina. Your load.js file looks good, though you shouldn't load the AMSsymbols extension unless you have also loaded the extra fonts for it (msam10 and msbm10); I assume you have loaded the mimeTeX plugin to make it consistent with the moodle jsMath filter, which (used to) do that by default. Unless you really need mimeTeX compatibility, I would turn that off (in easy/load.js as well as filter/jsmath/javascript.php). Finally, I'd turn off global mode in easy/load.js, as it does not work well within moodle.
But those are just details. The process looks like it is loading jsMath properly, and so things should be working for you. Are you getting any error messages in the javascript console? Is there anything unusual in the web server error log? Can you check the access log to see if filter/jsmath/jsMath/plugins/tex2math.js has been loaded, or filter/jsmath/jsMath/jsMath.js? These get called via ajax-style mechanisms by autoload.js, so won't show up as SCRIPT tags in the file itself.
At this point, I may need to see the contents of the page itself to check how the mathematics is being specified. Is it possible to let me look at one of the pages, perhaps as the guest user? You can send the URL via moodle's messaging system if you prefer. I may be able to figure out what is going wrong easier that way.
Davide
Thanks for looking into this for Tina. Your load.js file looks good, though you shouldn't load the AMSsymbols extension unless you have also loaded the extra fonts for it (msam10 and msbm10); I assume you have loaded the mimeTeX plugin to make it consistent with the moodle jsMath filter, which (used to) do that by default. Unless you really need mimeTeX compatibility, I would turn that off (in easy/load.js as well as filter/jsmath/javascript.php). Finally, I'd turn off global mode in easy/load.js, as it does not work well within moodle.
But those are just details. The process looks like it is loading jsMath properly, and so things should be working for you. Are you getting any error messages in the javascript console? Is there anything unusual in the web server error log? Can you check the access log to see if filter/jsmath/jsMath/plugins/tex2math.js has been loaded, or filter/jsmath/jsMath/jsMath.js? These get called via ajax-style mechanisms by autoload.js, so won't show up as SCRIPT tags in the file itself.
At this point, I may need to see the contents of the page itself to check how the mathematics is being specified. Is it possible to let me look at one of the pages, perhaps as the guest user? You can send the URL via moodle's messaging system if you prefer. I may be able to figure out what is going wrong easier that way.
Davide
Try http://moodle.ulcc.ac.uk/mod/resource/view.php?id=2572
I have copied across the relevant files and adjusted the settings in load.js as specified. I have taken out other bits and set global to 0.
Yours
James
I have copied across the relevant files and adjusted the settings in load.js as specified. I have taken out other bits and set global to 0.
Yours
James
Since Tina is using dollar sign delimiters rather than \( and \), you need to enable processSingleDollars in easy/load.js. This is off by default because single dollars are too common in non-mathematical text (e.g., "That costs from $3.50 to $5.00 a pound."), and so to have jsMath process it, you have to explicitly request it.
I think that will take care of things for you.
Davide
PS, you still have global mode enabled, and you may want to disable font warnings in order to be consistent with the settings in use by the moodle filter, as set in the filter/jsmath/javascript.php file. You may ask why that filter doesn't use easy/load.js itself. The reason is that the filter predates easy/load.js, and in fact, the moodle filter was used as the model for easy/load.js. The javascript.php file could simply call easy/load.js, but the available settings are slightly different, so I have left the moodle filer as is.
Also, you may want to warn Tina that the moodle jsMath filter does not have processSingleDollars enabled, and so she will need to use the LaTeX-style delimiters to get math in regular moodle pages.
I think that will take care of things for you.
Davide
PS, you still have global mode enabled, and you may want to disable font warnings in order to be consistent with the settings in use by the moodle filter, as set in the filter/jsmath/javascript.php file. You may ask why that filter doesn't use easy/load.js itself. The reason is that the filter predates easy/load.js, and in fact, the moodle filter was used as the model for easy/load.js. The javascript.php file could simply call easy/load.js, but the available settings are slightly different, so I have left the moodle filer as is.
Also, you may want to warn Tina that the moodle jsMath filter does not have processSingleDollars enabled, and so she will need to use the LaTeX-style delimiters to get math in regular moodle pages.
Thanks Davide, although your post led me there, it was actually something else completely different causing this. Various sites share the same jsMath folder and I needed to adjust the settings there, not on the local site version.
Yours
James
Yours
James
I'm glad that it's working for you now. Sorry it was such a complicated process.
Davide
Davide