Community

cancel
Showing results for
Show  only  | Search instead for
Did you mean: Community Member

Formula questions with LaTeX

I am looking to create multiple choice quizzes with formula questions AND use LaTeX (basically creating multiple versions of a quiz). I have managed to get the following: which yields: The first line is using LaTeX. The variables are recognized, but since it is an image, the variables are not subbed out by different values.

The second line uses a combination of plain text and LaTeX. This sort of works, but is very limited. I don't see any way to incorporate rational functions.

Both of these don't solve the dilemma of wanting multiple choice.

Tags (3)
1 Solution

Accepted Solutions Community Champion

As you have surmised, you cannot use the variable substitution within a LaTeX expression.

Option 1 - LaTeX

What I have done in cases where I needed something like this was to make multiple questions of the question and bring them into Canvas using Respondus. Then I put them into a question group and randomly pick one of them.

All of that is a lot of work and it's not perfect, but it's the closest I've found so far.

Option 2 - Text Math

If you want to go the second route and use rational functions, you may just have to resort to the imperfect approach of representing it in non LaTeX mode.

f(x) = [ x^[a] + [b]x^[c] - 1 ] / [ x^[d] + [f]x^[g] + [h] ]

Option 3 - Math ML

And now, that I've said this is the best so far, I tried something else before I hit the "Add comment" button that might work.

I pulled up MathType and typed in a function and then switched the Copy/Paste preferences to give me MathML. This is what I created Here is the MathML it gave me

<math display='block'>
<semantics>
<mrow>
<mi>f</mi><mrow><mo>(</mo>
<mi>x</mi>
<mo>)</mo></mrow><mo>=</mo><mfrac>
<mrow>
<mn>3</mn><mi>x</mi><mo>+</mo><mn>2</mn></mrow>
<mrow>
<mn>5</mn><mi>x</mi><mo>&#x2212;</mo><mn>7</mn></mrow>
</mfrac>
</mrow>
</semantics>
</math>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍

On a whim, I changed the 3, 2, 5, and -7 to [a], [b], [c], and [d]. I then asked to find f([f]). Note, don't use [e] in a formula question for a variable, Canvas considers it to be the constant e rather than a variable.

Here's what the code looks like now after the substitutions. I also changed the 2212 to just be a simple -. I don't know enough about MathML to know if that's legit or not, I'm assuming that MathType knows what it's doing, but I still didn't like it.

<math display='block'>
<semantics>
<mrow>
<mi>f</mi><mrow><mo>(</mo>
<mi>x</mi>
<mo>)</mo></mrow><mo>=</mo><mfrac>
<mrow>
<mn>[a]</mn><mi>x</mi><mo>+</mo><mn>[b]</mn></mrow>
<mrow>
<mn>[c]</mn><mi>x</mi><mo>-</mo><mn>[d]</mn></mrow>
</mfrac>
</mrow>
</semantics>
</math>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I then created a formula question, typed in the first part of my question and then switched to the HTML editor. Then I pasted in the MathML code. I filled out the rest of the information, generated some questions, and got this when I saved it. Obviously not what I was hoping for. However, if you save and reload the quiz, then it shows up. Now, when I preview the quiz, I get That's close. Now I changed the display="block" to display="inline" (which is the default, so I could have removed it completely) I don't know enough about MathML to know if there is a \displaystyle type command or a \dfrac that will make the fraction full height.

Before you jump up and down for joy, I hear that support is for MathML is really lacking without plugins or extensions. I did the testing in Chrome on a PC, but according to CanIUse, Chrome doesn't support MathML. Neither does Edge. Firefox and Safari are the ones that do. The Wikipedia article on MathML says similar things. I have no idea if the Canvas apps support MathML or not. Canvas has fallback mechanisms in place, svg, mathml, images, for these things.

So, the one thing that is most promising most likely can't be used unless you have a controlled setting where you can force everyone to use Firefox.

2 Replies Community Champion

As you have surmised, you cannot use the variable substitution within a LaTeX expression.

Option 1 - LaTeX

What I have done in cases where I needed something like this was to make multiple questions of the question and bring them into Canvas using Respondus. Then I put them into a question group and randomly pick one of them.

All of that is a lot of work and it's not perfect, but it's the closest I've found so far.

Option 2 - Text Math

If you want to go the second route and use rational functions, you may just have to resort to the imperfect approach of representing it in non LaTeX mode.

f(x) = [ x^[a] + [b]x^[c] - 1 ] / [ x^[d] + [f]x^[g] + [h] ]

Option 3 - Math ML

And now, that I've said this is the best so far, I tried something else before I hit the "Add comment" button that might work.

I pulled up MathType and typed in a function and then switched the Copy/Paste preferences to give me MathML. This is what I created Here is the MathML it gave me

<math display='block'>
<semantics>
<mrow>
<mi>f</mi><mrow><mo>(</mo>
<mi>x</mi>
<mo>)</mo></mrow><mo>=</mo><mfrac>
<mrow>
<mn>3</mn><mi>x</mi><mo>+</mo><mn>2</mn></mrow>
<mrow>
<mn>5</mn><mi>x</mi><mo>&#x2212;</mo><mn>7</mn></mrow>
</mfrac>
</mrow>
</semantics>
</math>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍

On a whim, I changed the 3, 2, 5, and -7 to [a], [b], [c], and [d]. I then asked to find f([f]). Note, don't use [e] in a formula question for a variable, Canvas considers it to be the constant e rather than a variable.

Here's what the code looks like now after the substitutions. I also changed the 2212 to just be a simple -. I don't know enough about MathML to know if that's legit or not, I'm assuming that MathType knows what it's doing, but I still didn't like it.

<math display='block'>
<semantics>
<mrow>
<mi>f</mi><mrow><mo>(</mo>
<mi>x</mi>
<mo>)</mo></mrow><mo>=</mo><mfrac>
<mrow>
<mn>[a]</mn><mi>x</mi><mo>+</mo><mn>[b]</mn></mrow>
<mrow>
<mn>[c]</mn><mi>x</mi><mo>-</mo><mn>[d]</mn></mrow>
</mfrac>
</mrow>
</semantics>
</math>
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I then created a formula question, typed in the first part of my question and then switched to the HTML editor. Then I pasted in the MathML code. I filled out the rest of the information, generated some questions, and got this when I saved it. Obviously not what I was hoping for. However, if you save and reload the quiz, then it shows up. Now, when I preview the quiz, I get That's close. Now I changed the display="block" to display="inline" (which is the default, so I could have removed it completely) I don't know enough about MathML to know if there is a \displaystyle type command or a \dfrac that will make the fraction full height.

Before you jump up and down for joy, I hear that support is for MathML is really lacking without plugins or extensions. I did the testing in Chrome on a PC, but according to CanIUse, Chrome doesn't support MathML. Neither does Edge. Firefox and Safari are the ones that do. The Wikipedia article on MathML says similar things. I have no idea if the Canvas apps support MathML or not. Canvas has fallback mechanisms in place, svg, mathml, images, for these things.

So, the one thing that is most promising most likely can't be used unless you have a controlled setting where you can force everyone to use Firefox.  Community Coach

Robbie  