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

Formula questions with LaTeX

Jump to solution

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:

258292_pastedImage_2.png

which yields:

258317_pastedImage_3.png

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.

Any advice is appreciated.

0 Kudos
1 Solution

Accepted Solutions
James
Community Champion

 @danielsblanco ,

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

258391_pastedImage_175.png

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.

258393_pastedImage_177.png

Obviously not what I was hoping for. However, if you save and reload the quiz, then it shows up.

258392_pastedImage_176.png

Now, when I preview the quiz, I get

258394_pastedImage_178.png

That's close. Now I changed the display="block" to display="inline" (which is the default, so I could have removed it completely)

258395_pastedImage_179.png

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.

View solution in original post

2 Replies
James
Community Champion

 @danielsblanco ,

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

258391_pastedImage_175.png

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.

258393_pastedImage_177.png

Obviously not what I was hoping for. However, if you save and reload the quiz, then it shows up.

258392_pastedImage_176.png

Now, when I preview the quiz, I get

258394_pastedImage_178.png

That's close. Now I changed the display="block" to display="inline" (which is the default, so I could have removed it completely)

258395_pastedImage_179.png

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.

View solution in original post

Robbie_Grant
Community Coach
Community Coach

 @danielsblanco ,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.

 

Robbie