Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: ASCIIMathML.

ASCIIMathML: Difference between revisions

From MoodleDocs
No edit summary
Line 5: Line 5:


==Usage==
==Usage==
===Generally===
AsciiMathML has been massaged into quite a few formats,  and is presently available in a version 2.0.2 distribution [http://sourceforge.net/project/showfiles.php?group_id=106148 from Sourceforge] which can be quickly installed for Moodle as a javascripted based filter. However,  in exploring various features of asciimathml it was discovered that once installed per the default instructions the filter did not turn off (there is a Tracker item on this [need to add reference] and it is argued that the behavior may be do to artifacts in the usage of require_js ) and that there were issues with the filter not interacting appropriately with the Moodle quiz and message modules. It is possible that the filter may be made to behave more like a filter if the javascript files are moved and the php files edited to reflect their location.  In the interm, however, it was determined that asciimathml.js worked very well if simply referenced in meta.php,  and for those interested in using asciimathml,  it is suggested that a reference to it be placed in the appropriate theme and that a "common" location for the distribution files be identified (more on this below).
AsciiMathML has been massaged into quite a few formats,  and is presently available in a version 2.0.2 distribution [http://sourceforge.net/project/showfiles.php?group_id=106148 from Sourceforge] which can be quickly installed for Moodle as a javascripted based filter. However,  in exploring various features of asciimathml it was discovered that once installed per the default instructions the filter did not turn off (there is a Tracker item on this [need to add reference] and it is argued that the behavior may be do to artifacts in the usage of require_js ) and that there were issues with the filter not interacting appropriately with the Moodle quiz and message modules. It is possible that the filter may be made to behave more like a filter if the javascript files are moved and the php files edited to reflect their location.  In the interm, however, it was determined that asciimathml.js worked very well if simply referenced in meta.php,  and for those interested in using asciimathml,  it is suggested that a reference to it be placed in the appropriate theme and that a "common" location for the distribution files be identified (more on this below).


Line 34: Line 35:


Now don't forget to [http://www.mozilla.org/projects/mathml/fonts/ install the STIX fonts].
Now don't forget to [http://www.mozilla.org/projects/mathml/fonts/ install the STIX fonts].
==Discussion==
==Discussion==
Peter Jipsen created a google groups site [http://groups.google.com/group/asciimath?hl=en here] "for discussing issues and proposing additions to the JavaScript program ASCIIMathML.js that enables users to easily display mathematics and graphs (using MathML and SVG) on web pages or in blogs and wikis. Suggestions are welcome (see www.chapman.edu/~jipsen/asciimath.html for more). "
Peter Jipsen created a google groups site [http://groups.google.com/group/asciimath?hl=en here] "for discussing issues and proposing additions to the JavaScript program ASCIIMathML.js that enables users to easily display mathematics and graphs (using MathML and SVG) on web pages or in blogs and wikis. Suggestions are welcome (see www.chapman.edu/~jipsen/asciimath.html for more). "

Revision as of 20:01, 4 December 2008

ASCIIMathML

Introduction

Initially developed by Peter Jipsen ( see his remarks on the history of ASCIIMathML here ), ASCIIMathML has become one of the most widely and easily used tools for the expression and display of Mathematics on the web.

Features

Usage

Generally

AsciiMathML has been massaged into quite a few formats, and is presently available in a version 2.0.2 distribution from Sourceforge which can be quickly installed for Moodle as a javascripted based filter. However, in exploring various features of asciimathml it was discovered that once installed per the default instructions the filter did not turn off (there is a Tracker item on this [need to add reference] and it is argued that the behavior may be do to artifacts in the usage of require_js ) and that there were issues with the filter not interacting appropriately with the Moodle quiz and message modules. It is possible that the filter may be made to behave more like a filter if the javascript files are moved and the php files edited to reflect their location. In the interm, however, it was determined that asciimathml.js worked very well if simply referenced in meta.php, and for those interested in using asciimathml, it is suggested that a reference to it be placed in the appropriate theme and that a "common" location for the distribution files be identified (more on this below).

Additionally, a php version of ASCIIMathML has been developed by Steve Chan. Depending on usage, using the php version may or may not require the concurrent usage of an additional javascript file (arguably, if the web application displays xhtml, which Moodle does, the additional javascript file is not necessary.)

Stemming from an initial joint project with Peter Jipsen, David Lippman has also maintained a version of ASCIIMathML.js that provides fallback to a TeX interpreter such as mimetex. This can be important because ASCIIMathML requires that a) the browser used supports MathML (A W3C standard that Safari, for example does not support) and b) that adequate Math fonts are available to the browser (see note below about obtaining and installing fonts).

As part of extending the fallback option to make asciimathml usage more transparent for usage on Moodle, a Moodle version will be available.

Invoking Via meta.php

Because of all the discussion regarding asciimathml and possible conflicts and fallback options the following is inserted here as a general guide to such usage pending the adoption of Moodle 2.0 and sch integrations with tinyMCE as may be provided at that time.

Create a lib/editor/common directory and move the asciimath folder into it (i.e. DO NOT place it with other filters as it appears to continue to work whether it is turned on or not). If you are interested in fallback, you may copy this file to the asciimath folder and, backing up your original asciimathml.js file, replace it with this one, changing the references inside it to you local mimetex or mathtran server.

Now edit your meta.php to point to the new location. You will have a meta.php in your theme's directory and it will look something like the code below.... Note the inclusion of the two script stanzas. Just make sure the second points to the correct directory.

<script type="text/javascript">

_editor_skin = "xp-blue"; // If you want use a skin, add the name (of the folder) here
_editor_lang = "en"; // And the language we need to use in the editor.
var mathcolor = "black"; // You may change the color the formulae are displayed (default: red)
var mathfontfamily = "Arial"; //and the font (default: serif, which is good I think)
</script>

<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/editor/htmlarea/plugins/Equation/ASCIIMathML.js"></script>

Now don't forget to install the STIX fonts.

Discussion

Peter Jipsen created a google groups site here "for discussing issues and proposing additions to the JavaScript program ASCIIMathML.js that enables users to easily display mathematics and graphs (using MathML and SVG) on web pages or in blogs and wikis. Suggestions are welcome (see www.chapman.edu/~jipsen/asciimath.html for more). "