# Math Editing Ideas for Sakai

**Note: Please edit and revise, this is a working draft!**

**Current as of October 2010.** The message from David Roldan Martinez, containing several previous ideas sent to the Collab lists, is captured in the Nabble archive of Ref [4], below. His summary message of October 27th, and a fourth solution, is near the top.

Better support for Math has been something desired in Sakai for sometime [1], but every-time it has come up nothing has happened with it. Limited support for math has always been available if you attempted to install it in RWiki [2], but not available in any other tools. There have been many ideas researched and proposed in various lists and this is an attempt to gather them all up here and look into the specifics.

*From Matthew Jones October 2010*

Re: [Using Sakai] for equations in sakai course

jonespm@gmail.com on behalf of Matthew Jones [jonespm@umich.edu]

Sent: Thursday, October 28, 2010 3:03 PM

To:

markjnorton@earthlink.net

Cc:

Robin Hill; sakai-user@collab.sakaiproject.org

Attachments:

MathML will be somewhat nice in HTML-5, thought it's basically only available in Firefox and IE9 or older IE's with a plugin, though MathJax can display LaTeX and MathML. [1] Only partial support exists in Webkit based browsers [2]\.The biggest problem with MathML is it is very difficult to edit the math. You are almost entirely reliant on a wysiwyg of some sort.

For example typing creating something as simple as gif.latex.gif means you have to enter:

<math> <mrow> <msqrt> <msup> <mtext>a</mtext> <mtext>2</mtext> </msup> <mo>+</mo> <msup> <mtext>b</mtext> <mtext>2</mtext> </msup> </msqrt> </mrow> </math> In LaTex this is just "\sqrt{a^2+b^2}" Some of the editors like "http://www.fmath.info/" are kinda cool though. [1] http://www.pcworld.com/businesscenter/article/208588/html5_makes_math_easy.html [2] https://trac.webkit.org/wiki/MathML%20StatusOn Thu, Oct 28, 2010 at 11:34 AM, Mark Norton <markjnorton@earthlink.net> wrote:

On 10/27/2010 1:44 PM, Matthew Jones wrote:

Anyway, after Math, people will want Chemistry and Music too! We should have some consideration for these as well. Mark Norton started the page on this over 2 years ago. [1]

Lots going on in HTML-5, as well.

*From David Roldan Martinez October 2010*

Re: [Using Sakai] for equations in sakai course

sakai-user-bounces@collab.sakaiproject.org on behalf of DAVID ROLDAN MARTINEZ [darolmar@upvnet.upv.es]

Sent: Wednesday, October 27, 2010 1:26 AM

To:

sakai-user@collab.sakaiproject.org

Attachments:

Handout - See below, Solution 3Hi all,

I've reviewed all the mails I have from this and others lists and have found the following:

Solution 1:

Use Google Services to convert Tex to an image which uses an undocumented feature of Google charts, also in use by Google docs.

Put the following code into the source of the FCK area<img src="http://chart.apis.google.com/chart?cht=tx&chl=Tex goes here">. An example is: <img src="http://chart.apis.google.com/chart?cht=tx&chl=f_p = 3\sqrt {area} = 3\sqrt {2 \times 10^6 } = 53800Hz;\;53.8kHz">Please review Google usage policy at http://code.google.com/apis/chart/

Additional variables available per the Google Chart specsSolution 2:

Use MimeTeX. See attached document. http://www.olcs.lt.vt.edu/scholar/handouts/handoutMimeTeX.pdfSolution 3:

There is one third party plug-in for the FCK editor called WebEQ.Hope this helps.

David

*From Ramon Eixarch*

Re: [Using Sakai] for equations in sakai course

sakai-user-bounces@collab.sakaiproject.org on behalf of Eixarch Ferrer, Ramon [ramon@wiris.com]

Sent: Wednesday, October 27, 2010 2:43 AM

To:

sakai-user@collab.sakaiproject.org

Attachments:

ATT00001..txt? (344 B?)Hi David,

You missed an option to edit math equations in Sakai.

4.- WIRIS editor. A Plugin for FCKeditor http://www.wiris.com/demo-java/pluginwiris/fckeditor_wiris/

PS: the UPV is using WIRIS in it's Moodle platform.

Cordialment, Cordialmente, Best regards,

Ramon Eixarch

Maths for More - WIRIS

ramon@wiris.com

+34 932384684

+34 649752179

skype: ramoneixarch

twitter: twitter.com/wirismath/

From Matt Jones March 2010

Summary MathML/TeX: MathML: Future Standard to be supported by HTML 5 in browsers Very verbose (XHTML), hard to read, impossible to see the math equation in the code Not user friendly for input modifications, would definitely need an editor in front Only currently (05/10) supported by Firefox Probably not good for a REST based service because it's so verbose? Java->Image library is available (JEuclid) TeX: Long time standard for formatting Easy to read, easy to type and modify math equations Supported in browser with javascript library (like MathJax) Java-Image library is available (jlatexmath) Lots of equations still in this format, can convert to MathML though

From Zhen Qian October 2010 [3]

I think equation support can be divided into two parts:

- The ability to render good quality image for equation in browsers
- The ability to support creating/editing LaTex/MathML equation.
As for part (1), I think the trend now is to use MathJax display engine(http://www.mathjax.org/), which support all browsers and both LaTex and MathML. Here is a previous discussion thread for replacing jsMath with MathJax: http://old.nabble.com/-Building-Sakai--MathJax-to-replace-jsMath-in-rWiki--td29464530.html

For part (2), I haven't checked their licences or prices yet. Some plugins render equation images and embed into FCKEditor. DragMath (http://www.dragmath.bham.ac.uk/integrations.html) can output LaTex formatted string, which can be displayed by MathJax afterwards.

Part 1 seems to be a low-hanging fruit, and I hope that can solve at least 50% of user needs. Equation support is on our top to-do list here. We'd love to hear suggestions from other teams.

As mentioned Math can be divided up into 2 (probably 3) parts and one can be implemented without the other.

### Ability to identify what element of the page is Math

In the rwiki, math content is seperated using the {math} tag. Obviously you wouldn't want the full page to be rendered and displayed as math so you'd need some new tag to indicate that the content needs to be displayed as Math. Either this would be a simple plugin to the current editor (which would allow you to copy/paste MathML or LaTex into it and wrap a div around it with a specific class) or something else. MathJax by default can scan the whole page, but it is inefficient and picks up elements that really shouldn't be rendered as math.

### Ability to render good quality image for equations: Ref: [4] [5]

- Use MathJax to render the math
- MathJax is a very nice replacement for JSMath, it seems much easier to use, is faster overall and seems better supported across browsers.
- Needs to have some small modifications to avoid scanning the entire page
- Some characters like < are being htmlencoded to < by ProcessFormattedText. This is going to be a problem. [\5]
- A definite possibility for rendering

- Use Google Chart API to render the math
- Anything that renders images will not be accessible as it displays an image
- Limited by the maximum length of a GET request
- Relies on Google charts to display this. Might be good for a preview

- Use a java servlet (that we'd have to write) to render the math
- This would likely be something written around jLaTeXMath for LaTeX or JEuclid for MathML. Currently most browsers still don't support MathML so this isn't really an option, and MathML editing is impossible without a UI anyway.
- Some similar issues to Google chart API, could be implemented differently. Would still return a static image.
- This would probably be similar to the Google API: Take a parameter, render and cache the result
- The advantage is that it wouldn't be depending on an external API.
- The problem is that this piece would need to be written and tested. Ideally it would be a drop in replacement for the Google Chart API

- Use a commercial (or limited use) servlet (like codecogs) or MathTran to render the math
- Possible problems: Local cost, service might go away in the future, depending on an external site to be up at all times

### Ability to support creating/editing LaTex/MathML

<TODO: Fill this in>

Some possible ideas? <opinion>Personally I think anything that is a Java Applet is a bad idea. Flash would be better. Most people that edit this would likely be able to do it client side in Matlab, Mathematica or something so it's not a **huge** deal to provide an editor but it would be nice.</opinion>

DragMath

http://www.stattler.com/blog/latex-equation-drupal-blog

http://www.codecogs.com/pages/forums/pagegen.php?id=1639

Wiris

Not currently considered here (:

- MathML versus LaTeX. (I don't think this matters too much. MathML will eventually win but it's impossible to just edit without using an editor. LaTeX is good for quick equations. And LaTeX and TeX are the basis for many extant problem sets, papers, extracts, and other teaching materials that instructors would like to share on the web. We'd have to support both and it seems easy for libraries like MathJax to display either, and it looks like there are some ways to go from latex to mathml
- Accessibility: Are any of these accessible?

Brian Richwine Oct 2010

If work towards bringing math to Sakai is taking place, it would be great if the results were accessible.

Accessible math (for screen-reader users for instance) still has a little ways to go. The only accessible paths I've seen supported involve using MathML. Browser plug-ins (like MathPlayer for IE) let users navigate and explore the equation audibly, can highlight math as it is spoken, and allow for in browser magnification of the equation. There are MathML-to-Braille translators which would make the work of folks who have to convert course materials for blink students into Braille much easier if the math was already in MathML.

LaTeX is really a printer markup language, and as a result, is not as purely semantic as MathML is. LaTeX codes for equations are frequently chosen from a standpoint of achieving a specific visual result, and often don't supply enough information semantically and hierarchically to make the relationships between terms clear. Equations coded in MathML are semantically and hierarchically correct and machine readable and as such can be computed - equations coded in LaTeX are predictable in their appearance but often are semantically and hierarchically ambiguous and thus are not machine readable for the purpose of computation. Since equations coded as LaTeX aren't always machine readable, they also aren't in a format that adaptive technologies such as screen-readers can announce clearly and accurately to their users. It is our experience that LaTeX to MathML convertors (such as using MathJax with MathPlayer) fail to do an accurate job for this reason.

Those of us who use LaTeX and TeX have found no substitute for its rich and detailed markup, the closest method possible to making up a new notation for a system and writing it on the board. Quite often, getting the right symbols, diagrams, notation, and placement is more important that capturing the entire hierarchical semantics, because the semantics is the subject of the exposition.

1: http://old.nabble.com/-Building-Sakai--jsMath-in-other-rich-text-fields-td29275170.html

2: http://confluence.sakaiproject.org/display/DOC/Rwiki

3: http://sakai-project-mail-list-archives.1343168.n2.nabble.com/Using-Sakai-math-editor-for-fckeditor-td5662970.html

4: http://sakai-project-mail-list-archives.1343168.n2.nabble.com/Using-Sakai-for-equations-in-sakai-courses-td5658865.html

5: http://old.nabble.com/-Building-Sakai--MathJax-to-replace-jsMath-in-rWiki--td29464530.html

## 1 Comment

## Jez Cope

ASCIIMathML is another option for input, and uses a simpler syntax than LaTeX or MathML (though many LaTeX commands can be used as well). It displays the result by translating it to ordinary MathML, so maybe it could play nicely with MathJax?