Calculated MC with Fractions - Help Please

Calculated MC with Fractions - Help Please

by Eric Smith -
Number of replies: 1

I'm trying to write some simple calculated MC questions, but can't get the syntax for the answers down. Let's say my question looks like:

What is $\frac{a}{b} + \frac{x}{y}$ ?

One of my answer choices might be:

{=$\frac{{{a}+{x}}}{{{b}+{y}}}$}

Or one of the hundred subtle varients I've seemingly tried. My typical kick-back from the quiz engine is: 

Illegal formula syntax starting with '$\frac{{':$\frac{{1+1

And then I'm just lost. I've been through the math and TeX documentation and I guess since none of the examples I found used any TeX I'm a little lost. Any help would be greatly appreciated! Thanks

Btw, I am writing double $ in all of my TeX, just not here to keep the TeX filter from changing it.

Average of ratings: -
In reply to Eric Smith

Re: Calculated MC with Fractions - Help Please

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Eric,

I'm not very good at this, but I will take a stab at it. You are trying to use Tex notation in one place, where it is okay, and in another place, where it is not. In other words, you can use Tex notation to show pretty math formulas in the question, but, in the calculated answers you have to use the notation used for the calculated question type (also for calculated multichoice type). Check this doc page: http://docs.moodle.org/24/en/Calculated_question_type#Page_2._Choose_dataset_properties

Instead of your answer: {=$\frac{{{a}+{x}}}{{{b}+{y}}}$}

It should be something like {a+x}/{b+y} to get a fraction answer or {={a+x}/{b+y}} will give a decimal point answer.

Hope this helps,

AL