tutorial

Introduction

meditor is a text editor with symbolic computation capabilities. It uses a scripting engine to run/evaluate code fragments. It has a pluggable architecture, whereby both scripting engine and symbolic computing library (or in fact any library) modules can be plugged in. The general operation is then to:

- run some preliminary definitions
- evaluate resulting expressions

Running definitions/evaluating expressions

By default, meditor comes with the Rhino/Nashorn scripting engine, and no symbolic computing library. The scripting features of meditor are grouped in the Math menu. To run a code fragment, first select it (newline included):

a = 1;

, and then run it (Ctrl+Q). To evaluate an expression, again select it (without the newline):

2*a

, and press Ctrl+E. The result replaces the original expression:

2.0

. To reset the scripting engine, re-run meditor.

Installing custom scripting engines and symbolic libraries

To do symbolic computation as such, some modules must be installed. Various scripting engine and symbolic library combinations are possible, for instance:

- beanshell + jscl
- jython + jas

Once installed, the engine must be enabled in the settings (Math->Preferences, Engine tab)'s Language item. Examples of meditor worksheets can be found on https://meditorworld.appspot.com/

Rendering MathML and SVG

If the Engine panel's Rendering checkbox is selected, then if evaluating an expression yields an object of type jscl.editor.rendering.MathObject, then its toMathML() method is called and its return value is pasted instead of the object itself. The resulting expression is then rendered as MathML in the editor's textpane.

Similarly, if evaluating an expression yields an object of type java.awt.Component, then a window opens, allowing to interact with the component. Then, when the window is closed, the component is rendered as a SVG fragment in the editor's texpane.

Evaluating (or running code with) MathML expressions

If one evaluates (or runs code with) MathML expressions, these are first translated to the used scripting language, through an xsl stylesheet, which is specified in the Engine panel's Stylesheet item.

Sharing meditor worksheets

The docs folder of the meditor repository on GitHub is intended for user contributions. It is mirrored in the website mentioned above.

Expressions can be copy/pasted to/from http://en.wikipedia.org/ through the Math->Copy to wiki and Math->Paste from wiki menu items. The MathML fragments will be translated to/from TeX in the process.

The documents can be exported to pdf (File->Export, "PDF Files"), with their MathML/SVG content rendered, and eventually printed.