Creating formulae easily

Name

DragMath Equation editor

Module type

Integration

Author

Marc Grober

Released

2008

Maintained

Actively

Languages

Catalan, Czech, Dutch, English, Farsi, Finnish, French, German, Italian, Norwegian, Polish, Portuguese Brazilian, Russian, Spanish, Swedish

Compliance

Not a regular module

Documentation

Online documentation

Errors

None displayed (if you can get TeX notation filtering running)

If you want to include formulae on your site, this can be achieved by turning on the TeX notation filter, which can convert TeX syntax to a rendered image. However, if you are not familiar with TeX and its syntax, this might be a difficult way to create a simple equation. Even if you do know TeX, the syntax can be tricky and erroneous syntax will not be rendered correctly. A tool that can assist in producing syntactically correct notation may be helpful to you.

The DragMath editor is a Java Applet that can be launched from the HTML editor in Moodle. It assists you in creating formulae that can be inserted into labels, web pages, forum posts, and other locations where the HTML editor is used. When the written text is presented in HTML form, the TeX notation is rendered as an image containing the formula in mathematical form.

Getting ready

Before installing the DragMath editor, you need to turn on the TeX Notation Filter at Site Administration | Modules | Filters | Manage Filters. In most cases, you do not have a need to alter any of the settings associated with this filter. The Mimetex converter, distributed with Moodle, is capable of transforming most mathematical constructs in TeX. There have been issues with the TeX filter running on later versions of PHP. If you encounter this, you may have to upgrade your Moodle instance.

Getting ready

As this is an integration instead of a regular module, it is not completely self contained, but there are not too many locations affected. The zip file for the editor contains a lib directory. This can be copied to /moodle/ and will copy its content into subfolders of the lib directory. This will not overwrite any files, but as the lib directory already contains one of the subdirectories, it will ask if it should unzip the files into an existing folder.

Apart from unzipping the files, you also need to make an addition to the file /moodle/lib/adminlib.php. In this file, search for the following line, which should be located around line 3200.

'insertsmile' => 'em.icon.smile.gif',

Below this line, insert the following line. Be sure to include the comma at the end.

'insertdragmath' => 'em.icon.dragmath.gif',

The addition of this line will cause the DragMath editor icon to appear in the HTML editor beside the emoticons icon.

The DragMath editor is a Java Applet, so the Java Runtime Environment (JRE) needs to be installed on the user's machine.

How to do it...

Once the DragMath editor is installed and the TeX Notation Filter is enabled, you can add formulae.

Using an HTML editor, enter the text that you want to appear around the formula, then click to place the cursor at the location where you wish to insert a formula.

How to do it...

The DragMath editor icon is located next to the emoticon icon and appears as an alpha symbol within a square root. Clicking on the DragMath icon will launch a pop-up window and the DragMath Java Applet will load (assuming the JRE is installed for your browser). You may have to resize this window and if it is the first time using the applet, you will be asked to allow the applet to run.

How to do it...

The DragMath editor allows you to include various symbols and constructs in your formula by dragging them into the working area. For example, to include a square root in your formula, click on the second tab, find the icon for a square root and drag this onto the working area.

How to do it...

Fractions, powers, integrals, and functions can be achieved in the same way.

Sometimes it can be difficult to get a dragged element into the correct location. You may have to click undo and try again until you get it where you want it.

When you have the equation you want, click on the Insert button and the TeX version of your formula will be inserted where the cursor was located.

How to do it...

The formula is ready to be filtered by the TeX Notation Filter when this page is rendered.

How it works...

The text entered in the HTML editor will be passed through each of the enabled filters before it is sent to the user's browser. If the TeX filter encounters text beginning and ending with $$ it knows that the content in between needs to be treated as TeX syntax and rendered as an image.

There are some checks before the conversion is made. If the same string of TeX has been rendered recently, it will reuse the same rendered image instead of re-rendering the TeX again. This is useful if a class of students view the same document containing such a formula, on the same day.

How it works...

The final product is a mathematical formula, right where you wanted it, and achieved without learning TeX with the aid of the DragMath editor.

See also

  • Algebra Filter (standard in Moodle)
  • jsMath Filter (see Modules and plugins database)
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.58.50.156