# Documentation page

3 Aug 2012

The WIRIS quizzes system is based in WIRIS cas, which can do calculations both numeric and symbolic. When working numeric you may want to control the amount of digits of the numbers.

You can set the number of significant digits using the `Precision` setting.

But please remember this setting only applies to the output of values; i.e. the correct answer shown, and the variables in the wording and feedbacks.

In `Short answer` questions the student inputs an `Answer` that is compared with the `Correct answer`. This comparison is not affected by the `Precision` setting; that only affects outputs. You can set the number of digits for the comparison using the `Tolerance` setting. Informally the `Tolerance` sets the number of decimals that must match between the `Answer` and the `Correct answer`. If the `Tolerance` is set `Relative` then means significant digits; otherwise is `Absolute` and means plain decimal places.

Just remember `Precision` is for output and `Tolerance` is for input, and they are independent.

Here are more precise remarks:

• `Precision` and `Tolerance` are settings directly related to the WIRIS cas commands `precision()`, `tolerance()` and `relative_tolerance()`. You can take a look at the WIRIS cas manual.

• `Tolerance digits` 4 translates to `tolerance(10^-4)`. The bigger the `Tolerance digits` setting is, the smaller the actual tolerance is.

• In WIRIS quizzes, by default `Precision` is set to 4, and `Tolerance` is also 4 and `Absolute`. `Precision` can be an integer in the range 1..15. `Tolerance` can be any number, including negatives. If `Tolerance` is `Relative`, it should be less or equal than `Precision`, and in any case should be less than 15 to avoid trouble.

• No matter the `Precision`, internally the values are calculated with around 15 significant digits, what is called double precision according to the IEEE 754 standard. No matter these internal digits, answers are compared according to `Tolerance`.

• `Tolerance` is not strict, even when `Absolute`. For example, with tolerance absolute 1 you can not trust 0.09 is 0 and 0.11 is not. The actual tolerance is not exactly the number in the setting, but usually a little bigger.

• It is not fully true that `Tolerance` are the digits that must match between the `Answer` and the `Correct answer`. As a counter example, consider `Correct answer` of 4. and `Answer` of 3.9999999998765, that have all digits different. As a corollary; don't use `Tolerance` to make questions about rounding!

• If you want to make questions about rounding, and so the `Correct answer` is unique, use the Validation `has less or equal digits/decimals than ...`, and set `Tolerance` to 15. Or also use `Literally equal`.

• If you work without decimal numbers, neither the `Precision` nor `Tolerance` applies, because the system will work symbolic and the comparisons will be exact. But if the student answers a decimal number, then `Tolerance` do applies. Also decimal numbers can be the result of some operations, like `numeric_integration()` or `numeric_solve()`. Furthermore some of operations produce sometimes exact numbers and sometimes decimal numbers, like `asin()` or `argument()`. So the conclusions is: be prepared to get sometimes unexpected decimal numbers.

• You can convert the integer a into decimal just doing a·1. or a+0. for example. So if you want always decimal numbers, just do this operation near the end.
• Also be prepared to get the output in scientific notation, when the value can not be shown in fixed-point notation in less digits than `Precision`.

3 Aug 2012

## Main symptom

• When I login into my Moodle, I get only a blank page or only the header

## Probable cause

• You have just installed the WIRIS plugin, but the installation is incomplete. Please recheck the installation instructions.

• Or you have just updated your Moodle in place, maybe with CVS.

## Explanation

From time to time, Moodle changes the version of the TinyMCE editor.

For example, instead of keep using the folder

``````    <moodle>/lib/editor/tinymce/tiny_mce/3.4.9
``````

it uses the new folder

``````    <moodle>/lib/editor/tinymce/tiny_mce/3.5.1.1
``````

WIRIS plugin has some files in the old folder, so this change in Moodle leaves the plugin broken.

## Fix

The fix is to reinstall the package WIRIS plugin for TinyMCE and Moodle 2.x.

That is, please redo the steps 3 and 4 of the installation instructions.

In short, the steps are:

• copy the folder `tiny_mce_wiris` in plugins from the old version to the new,

• and add two lines in the `lib.php` file of the new version.

3 Jul 2012

This document explains how to embed the WIRIS editor in a Web page. The scenario when the editor is used together with an HTML rich editor is covered by the WIRIS plugins.

The embedding is compound by two steps. The first one is displaying the editor itself and the second one is calling the editor API to set and retrieve the MathML.

## Inserting an editor in a Web page

You can create a new page with the following content

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<script src="http://www.wiris.net/demo/editor/editor"></script>
<script>
var editor;
editor = com.wiris.jsEditor.JsEditor.newInstance({'language': 'en'});
editor.insertInto(document.getElementById('editorContainer'));
}
</script>
<body>
<div id="editorContainer"></div>
</body>
</html>

In the above code, the WIRIS editor is added into the <div> in the body. The actual insertion is done in the onload event. The variable editor is a global variable that will be used later to access the API.

## Setting and getting the MathML

Calling the editor API to get the MathML:

```alert(editor.getMathML());
```

To set the MathML:

```editor.setMathML("[itex]<mfrac><mn>1</mn><mi>x</mi></mfrac>[/itex]");
```

## Controlling the editor size

WIRIS editor will be resized to the same dimensions of the container <div>. Following the example, to set a 500x300 editor you can define the container <div> as

<div style="width:500px;height:300px" id="editorContainer"></div>

In any case, there is a minimal height of 200 pixels. You can also use percentual dimensions:

<div style="width:100%;height:300px" id="editorContainer"></div>

## Initialization parameters

See full table of the initialization parameters.

Choosing the language

In the previous example, we passed the following parameter

`{'language': 'en'}`

which specifies to use English for the text in the user interface.

Changing the toolbar

The parameter 'toolbar' can be used to specify the icons of the toolbar. For example,

`{'language': 'en', 'toolbar':'<toolbar ref="quizzes"/>'}`

tells the editor to use the simple toolbar used by the WIRIS quizzes tools. The definition of the toolbar is the XML fragment:

```<toolbar ref="quizzes"/>
```

To learn how to specify the toolbar in detail visit custom toolbar.

Changing the styles

It is possible to define the default styles of the editor. For example, you can change the font size, font family, color and background color.

```{'backgroundColor':'#008060', 'color':'#ffffff', 'fontSize':'32px',
'fontFamily':'Times New Roman'}```
8 Jun 2012

## 1 Requirements

• Cute Editor for .NET installed.
• A valid license to install the plugin in a production environment; otherwise, you can use the downloaded file just for demo purposes.

## 2 Copy files

Unzip the Cute Editor WIRIS plugin and copy the cuteeditor_wiris directory into your Cute Editor directory. The name of the WIRIS plugin directory must be cuteeditor_wiris.

1. Create an application through your IIS control panel at cuteeditor_wiris/integration.
2. Give write permissions to cuteeditor_wiris/cache and to cuteeditor_wiris/formulas folders to the web server user. Those folders will be used to store formula MathML codes and temporal images.

## 3 Include WIRIS plugin for Cute Editor on your own platform

<script type="text/javascript" src="CuteSoft_Client/CuteEditor/cuteeditor_wiris/core/core.js"></script>

and the following one after <CE:Editor id="Editor1" runat="server" />
<script type="text/javascript" id="wirisScript" src="CuteSoft_Client/CuteEditor/cuteeditor_wiris/cuteeditor.js"></script>

If you're using a submit button instead of the save button of the Cute Editor toolbar to post the data add the submitForm(); function in your onclick or onclientclick attribute as below.

onclick="submitForm();"
onclientclick="submitForm();"

2. Add the following button holder in the .config file used for the button configuration in CuteSoft_Client\CuteEditor\Configuration\AutoConfigure

<item type="g_start" />
<item type="holder" name="wirisbuttons" />
<item type="g_end" />

3. In order to add the Wiris buttons in the Cute Editor toolbar you need to modify the Code file of the page containing the editor as explained below. Add in the Page_Load function the following code where Editor1 is the editor id.

//If null, default browser language is chosen.
//change if you need a particular language. e.g. it-IT, es-ES
string currentLanguage = null;

CuteEditor.ToolControl tc = Editor1.ToolControls["wirisbuttons"];
if(tc!=null)
{
System.Web.UI.WebControls.Image Image1 = new System.Web.UI.WebControls.Image ();
Image1.ToolTip    = "WirisEditor";
Image1.ImageUrl    = "CuteSoft_Client/CuteEditor/cuteeditor_wiris/core/icons/formula.gif";
Image1.CssClass    = "CuteEditorButton";
SetMouseEvents(Image1);
Image1.Attributes["onclick"]="CuteEditor_GetEditor(this).ExecCommand('WirisEditor')";
System.Web.UI.WebControls.Image Image2 = new System.Web.UI.WebControls.Image ();
Image2.ToolTip    = "WirisCAS";
Image2.ImageUrl    = "CuteSoft_Client/CuteEditor/cuteeditor_wiris/core/icons/cas.gif";
Image2.CssClass    = "CuteEditorButton";
SetMouseEvents(Image2);
Image2.Attributes["onclick"]="CuteEditor_GetEditor(this).ExecCommand('WirisCAS')";
}

if (currentLanguage != null){
Editor1.CustomCulture = currentLanguage;
}else{
currentLanguage = Page.Request.UserLanguages[0];
}
var scriptTag = new HtmlGenericControl {TagName = "script"};
scriptTag.InnerText = "var currentLanguage ='" + currentLanguage + "';";

and the following function if not present.

void SetMouseEvents(WebControl control)
{
control.Attributes["onmouseover"]="CuteEditor_ButtonCommandOver(this)";
control.Attributes["onmouseout"]="CuteEditor_ButtonCommandOut(this)";
control.Attributes["onmousedown"]="CuteEditor_ButtonCommandDown(this)";
control.Attributes["onmouseup"]="CuteEditor_ButtonCommandUp(this)";
control.Attributes["ondragstart"]="CuteEditor_CancelEvent()";
}

## 4 Configure

Edit cuteeditor_wiris/configuration.ini to set your own values. This table specifies all possible parameters.

## 5 Check that the plugin works correctly

In order to check if the plugin is installed correctly, there is a page that makes some tests on your server. Open this link to see where is your test page.

4 Jun 2012

## 1 Requirements

• Moodle version 2.x.
• Wiris plugin for Moodle 2.x version 3.17.20 or greater.
You can know your Plugin version at your `http://<moodle>/filter/wiris/info.php`.
update the plugin

## 2 Copy files

Unzip moodle2-wiris-quizzes-x.xx.xx.xxxx.zip and copy the content of the types folder into the folder question/type under the root of Moodle.

## 3 Installation

Since Wiris Quizzes is a Moodle plugin, it will start automatically the installation after the files are copied into the correct folder. If the installation doesn't start go to Moodle Home Page or Site administration > Notifications page.

## 3 Check all is OK

The best way to check all is OK is just to make a question, save and display it.

Additionally there is an info page at `http://<moodle>/question/type/wq/info.php`. In any issue, please send screenshots of that to support.