AlfredEq v2.0 - Alfred's Equation Editor

Alfred's Equation Editor is a beautiful app to edit mathematical expressions on the web. It was originally built for government agencies working on e-learning solutions. Simply license the software or code and embed it in your CMS/LMS/wiki.

Try it on ShareMath

Here you can see an example of AlfredEq embedded on ShareMath.com:

AlfredEq used by ShareMath.com

Main Features

Stop handwriting formulas or handcrafting MathML/TeX code.

Download Developer Edition

For evaluation purposes only and not for commercial use. Do not use on production servers.
Download AlfredEq-Release-v2-2012-10-25.zip

Files:
AlfredEq-README.html: this.
AlfredEq-README.md: the Markdown version of this help.

Embed-swfobject folder:
-AlfredEq_unlicensed.swf (default) and AlfredEq_RSL_unlicensed.swf. The RSL version uses Adobe hosted Runtime Shared Libraries to reduce load time (framework_4.6.0.23201.swz, textLayout_2.0.0.232.swz, spark_4.6.0.23201.swz, rpc_4.6.0.23201.swz). This moves about 1 MB of libraries to the Adobe network with long cache settings.
- It also contains sample html files using SWFObject. Default is the index.html which use SWFObject Static (not indexdynamic.html which uses SWFObject Dynamic). - French version of the sample html files: index.fr.html and indexdynamic.fr.html
- SWFObject files: swfobject.js, expressInstall.swf and the "src" folder.

DecodePNG folder:
- ActionScript 3 Base64Decoder.as library to decode PNGs.

LocalConnection folder:
- Example code to communicate between a Flash file and AlfredEq.swf using ActionScript 3. See Configure DefaultConfiguration.xml.

License the Software or the Code

Contact Carl Malartre/Scolab Inc. for pricing:
- 1-888-528-8878 ext. 801 (toll free in North America)
- (514) 528-8066 (Montreal region in Canada)
- info@scolab.com

Get Support

Contact Carl Malartre/Scolab Inc. for support:
- 1-888-528-8878 ext. 801 (toll free in North America)
- (514) 528-8066 (Montreal region in Canada)
- info@scolab.com

System Requirements

Documentation

Configure the Embed Code with FlashVars

We use SWFObject to load the Flash object. See the SWFObject Documentation.

"The FlashVars parameter of the HTML <OBJECT> tag sends variables into the top level of a SWF file when it loads in a web browser. The <OBJECT> tag is used to add SWF files to HTML pages. The <EMBED> tag can also be used, but is older and now obsolete." See Adobe's Pass variables to SWFs guide.

Warning: they are case-sensitive.

We are using two FlashVars:

Suppose you copy DefaultConfiguration.xml to /myfolder/myconfig.xml and use the French version:

<param name="flashvars" value="configLocation=/anyfolder/myconfig.xml&lang=fr" />

Configure DefaultConfiguration.xml

Edit the configuration file at "EquationEditor\data\DefaultConfiguration.xml". It is self-explanatory.


SaveTarget defines how the equation is saved when the user click on the save button. Save button will appear only if a method is defined here. Images are a capture of the equation returned as a Base64/EscapeMultiByte encoded PNG

@method:

@target:

@args:

Example:

<SaveTarget
    method="HttpRequest"
    target="/Authoring/MathLayout2/SaveDebug.ashx"
    args="markupAndImage"/>

LoadTarget defines how the content is initially loaded. If no method is defined, an empty equation is created.

@method:

Example:

<LoadTarget
    method="HttpRequest"
    target="/Authoring/MathLayout2/LoadDebug.ashx"/>

ReportProblem defines where the bug reports are sent. The script can accept the following parameters (see Server-side example):

Example:

<ReportProblem
    uri="/Authoring/MathLayout2/SendBugReport.ashx"/>

<GraphicalUserInterface
    footerVisible="true"/>

Catch these JavaScript events readyFunction: JavaScript function to call when actionscript edit functions are made available to JavaScript.

changeFunction: JavaScript function to call when the equation change.

Example:

<HostIntegration
    changeFunction=""
    readyFunction=""/>      

Call these JavaScript events List of ActionScript functions available to the JavaScript container. The container must wait a call to readyFunction before it can call the functions.

Returns the MathML markup
function exportSource():String

Returns a capture of the equation as a Base64/EscapeMultiByte encoded PNG
function exportImage():String

Set the content of the editor, clears the undo history
function setSource(value:String):void

Will open the send report window
function reportProblem():void

See w3.org's MathML 3 - Chapter 3 - Presentation Markup for these configurations, except for fontLookup.

<!-- fontLookup(device|embeddedCFF) -->
<RenderingEnvironment
    displayStyle="false"
    scriptLevel="0"
    fontFamily="StixEmbed"
    fontLookup="embeddedCFF"
    fontSize="24"
    scriptMinSize="13"
    scriptSizeMultiplier="0.7"
    color="black"
    bold="false"
    italic="false"
    infixlinebreakstyle="before"/>

Server-side example

Image conversion example - ASP.Net & Visual Basic.Net

```VbNet Dim writer As New System.IO.FileStream(Server.MapPath(filename), IO.FileMode.Create)

Try
    Dim bytes() As Byte = System.Convert.FromBase64String(Server.UrlDecode(Request.Params("imageData")))
    writer.Write(bytes, 0, bytes.Length)
    writer.Flush()
Catch ex As Exception

Finally
    writer.Close()
End Try

```

How to get MathML or a PNG image VB.Net - ASP.Net & Visual Basic.Net

```VbNet <%@ Page Language="VB" %>

<script runat="server">

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

        ' How to save the equation as a MathML XML file
        If Not Request.Params("content") Is Nothing Then
            Dim documentXml As New System.Xml.XmlDocument()

            Try
                documentXml.LoadXml(Server.UrlDecode(Request.Params("content")))
                Dim saveLocation As String = Server.MapPath("CHANGETHIS_FILENAME.xml")
                documentXml.Save(saveLocation)
            Catch ex As Exception

            End Try
        End If

        ' How to save the equation as an image (PNG)
        If Not Request.Params("image") Is Nothing Then
            Dim filename As String = ""

            Dim writer As New System.IO.FileStream(Server.MapPath(CHANGETHIS_FILENAME.png), IO.FileMode.Create)

            Try
                Dim bytes() As Byte = System.Convert.FromBase64String(Server.UrlDecode(Request.Params("image")))
                writer.Write(bytes, 0, bytes.Length)
                writer.Flush()
            Catch ex As Exception

            Finally
                writer.Close()
            End Try
        End If

        ' If you want to send the MathML back to the client browser as a downloaded file, use something similar to this:

        ' Dim fileName As String = "CHANGETHIS_FILENAME.xml"
        ' Response.AddHeader("content-disposition", "attachment; filename=" & fileName)
        ' Response.TransmitFile(Server.MapPath(fileName))

    End Sub

</script>

```

Image Decoder

If you use ActionScript 3 but don't use Flex, you can download the open source Base64Decoder.as code (Apache v2 License) from the Apache Flex Repository.

Size, Web Caching & Runtime Shared Libraries

The editor app weights around 1.5MB. This looks big if you think of it as a web page, but think of it as an app loaded from the browser's cache.

Set your web server cache directives for the file AlfredEq.swf and setup ETags. This will help proxy caches. The web server should send an http header to tell all browsers, proxy and gateway caches to keep it for 1 to 30 days. Here's one day (in seconds):

Cache-Control: max-age=86400, must-revalidate, public

Use the "lighter" AlfredEqRSLunlicensed.swf. The RSL version uses Adobe hosted Runtime Shared Libraries to reduce load time (framework4.6.0.23201.swz, textLayout2.0.0.232.swz, spark4.6.0.23201.swz, rpc4.6.0.23201.swz). This moves 1 MB of libraries to the Adobe network with long cache settings.

Privacy & Tracking

This software collects anonymous app loading and click events for statistical purposes on Google Analytics and ShareMath.com. We do not track any data that personally identifies an individual.

Sample data sent to ShareMath.com:

event=alfredeq_loaded
&url=www.website.com/math/course1/page2
&referer=www.website.com/math/course1/page1
&playerType=standalone (see ActionScript 3 documentation)
&playerVersion=10.0.0
&alfredeqMajorVersion=2
&alfredeqCompilationDate=2007-06-09T22:46:21Z
&licencedBuild=false

Future Work: TeX Support, iOS/Android, JavaScript

Coded for the Flash Runtime

Project Licenses

Standing on the shoulders of giants, this project:

Credits

It was originally built by Scolab inc. for BuzzMath.com and Sharemath.com.

Special thanks to the SOFAD and CFORP's trust and financial support:

This app would be way less cool without them!


Notes

Tags: mathematical expressions, mathematical formulae, mathematical formulas, and formula editor.

Prior to 2012, AlfredEq "Alfred's Equation Editor" was also called BuzzMath Equation Editor and NmEquation.

This is written using Markdown and MarkdownPad.