Fractions in Quiz module

Fractions in Quiz module

by Daphne Gonzalvez -
Number of replies: 12

We are using Moodle 1.7

There is a great deal of inconsistency in the display of fractions. The Multiple choice questions translate the code perfectly in the question text and choices.

The Matching questions translates the code in the question text, but not in the choices.

The Cloze question refuses to translate the code in the text and the blanks.

Has anyone found a solution to this problem?

Average of ratings: -
In reply to Daphne Gonzalvez

Re: Fractions in Quiz module

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Daphne,
What do you mean by "translate the code"? Can you provide some examples?
Joseph
In reply to Joseph Rézeau

Re: Fractions in Quiz module

by Daphne Gonzalvez -

Hi Joseph

This is the code for a fraction that works well in the Multiple choice

$$\frac{365}{365}$$= (you'll need to see this as this forum is converting it to the fraction) I'll explain: Double dollar signs back slash then 365 within curly brackets twice followed by double dollar signs.

When I put it into the CLOZE or the options in MATCHING

I get frac365365 not 51b9fa290ffe1b36c4cb7dad5c9dd76f.gif=

That is what I find puzzling. How can the code work in the MULTIPLE CHOICE question,  but not at all in CLOZE and not in the choices in MATCHING?

Your help is appreciated.

Daphne

In reply to Daphne Gonzalvez

Re: Fractions in Quiz module

by Cristina Berisso -

Hi Daphne,

There is no C.M.S. that I know which would allow you to enter fractions like the one you mention or complicated mathematical expressions in any modest one line of a drop-down menu. What all systems do when the matching options are large objects (images for example) or expressions that are different from a simple one-liner ASCII text (like the math expression that you are trying to type) is to list the options in a reference table with letters as labels (a, b, c, ...), and then give those letters as the matching options of the dropdown menu. I appended below some examples (from different CMS's) on how such questions are generally adapted to use "a, b, c, ..." labels for matching questions.

Note: There are some "Math" UNICODE characters that can help you to enter some Math symbols in the dropdown menu, but the list is finite and for certain will not include the variety of fractions that you need. This is the link that Jeff Forssell kindly gave me http://www.atm.ox.ac.uk/user/iwi/charmap.html (look for the list #22 that contains Math symbols)

Hope this helps...

matching question in Moodle

matching question in WebCT

In reply to Cristina Berisso

Re: Fractions in Quiz module

by Daphne Gonzalvez -

Cristina you are a gem!

What a lot of time you have spent writing me that most useful answer!

I understand what you are saying about adapting the questions and will rephrase our questions accordingly.

One last question: Why does the code work in Muliple choice, but not in CLOZE? After all it is not in a drop-down menu.

The site sent by Jeff Forssell makes it so easy to get the right UNICODE characters. Thank you for passing it on.

Appreciate your help very much

Sincerely

Daphne

In reply to Daphne Gonzalvez

Re: Fractions in Quiz module

by Jeff Forssell -
I have put in a little info about Unicode (including that handy link) in the Moodle Docs Wiki and discovered that some notes I had about numerical CLOZE questions had become inaccessible so I have updated them. There might be some pointers that are of interest there! (and some things that are wrong or could be clearer- but it's a wiki - so wellcome to improve it!)
In reply to Daphne Gonzalvez

Re: Fractions in Quiz module

by Emma MacAulay -

In the Multiple choice. I would like to enter one choice as a fraction (see below):

    1. E = 2PΦNZ
                A

This works in the question area but not in the choice fields.

I am new to HTML tags and have recently found the answer to Superscripts by using the HTML tag

<sup>...</sup>

Which worked a treat. Is there an HTML tag that will help me with fractions?

In reply to Emma MacAulay

Re: Fractions in Quiz module

by John Isner -
Type $$$E=\frac{2P0NZ}{A}$$$ which will render as $$E=\frac{2P0NZ}{A}$$

This will only work if the TeX filter is activated (Site administration -> modules -> filters).
In reply to John Isner

Re: Fractions in Quiz module

by Jeff Forssell -
Step by step I'm learning more about the TeX filter. If you want to have the Phi character you must have:
$$E =\frac {2P \Phi NZ}{A}$$
(I tried first E =\frac {2P\PhiNZ}{A} Note no spaces! Which didn't work.)
If the TEX filter is not on you should be able to "HTML" it with

E = <U>2PΦNZ</U><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; A

(You'll have to try out how many "nonbreaking spaces" you need to get the A in the right place)

Or if you're really ambitious you can use table formatting to get:

E= 2PΦNZ A

By using this:

<table border="0" align="center"><tbody><tr><td width="50em" valign="top" rowspan="2" colspan="1" style="border-style: none; background-image: none; text-align: left; vertical-align: middle;">E= </td><td width="50em" valign="top" style="text-decoration: underline;">2PΦNZ</td></tr><tr> <td width="50em" valign="top" style="border-style: none; background-image: none; text-align: center; vertical-align: top;">A<br /> </td> </tr></tbody></table>

(This expression was put together in this HTML editor (in enlarged state which has more table choices) and then I copied the code. You must take away the linebreaks before pasting into a quiz answer text field.)

Hmmm... When I try it on a quiz MC question I get a ? in stead of Φ in spite of Moodle being able to handle UNICODE. What's wrong?
In reply to Daphne Gonzalvez

Re: Fractions in Quiz module

by Cristina Berisso -

Hello Daphne,

Regarding the CLOZE type question problem you encounter, you may want to read the postings on this forum on the topic: "CLOZE type question not accepting TEX notation." Here I give you the link hope it helps since there is exactly a mention on how to write a fraction in a "CLOZE" type question.

Joseph Rezeau gives in detail what you need to change in the code. It worked absolutely fine for me. 

Have fun!

Cristina

In reply to Cristina Berisso

Re: Fractions in Quiz module

by Daphne Gonzalvez -

Thanks Cristina

I'll give it a go and let you know what happens

Daphne