Using Equation Editor for Formula Quizzes is not working in Classic Quizzes

Jump to solution
hamiltonmath
Community Member

As a math teacher, I have been making a lot of formula quizzes and recently decided to add some fractional components and formula quizzes does not like it at all.

For instance, while [x]/2 =5 works just fine, if I go into the equation editor and create the fraction with [x] as the numerator and 2 as the denominator = 5, there are no options for me to change x (and yes, I understand mathematically, I wouldn't want to change x as x is unknown, not variable here, but I digress....). However, if I edit the LaTex myself (for which I believe it is \frac{[x]}{2}=5, then it gives me the option to change x; HOWEVER, when my students click on the quiz question, it literally does NOT replace the x with the value of x, it stays as an "x" in brackets!

 

Any help would be lovely!!

 

Thank you. 

Labels (1)
0 Likes
1 Solution
James
Community Champion

@hamiltonmath 

Don't use the equation editor to create the image, but enter the LaTeX directly into the text of the question, surrounded by the LaTeX delimiters. Those are \ ( and \ ) but without the space after the \. The space I put in is to keep the Community software from recognizing it as LaTeX and formatting it (and hiding the delimiters).

For example, this question will give the type of output you're looking for.

Solve \(\frac{x}{[a]}=[b]\).

You could use \dfrac if you want a full sized fraction.

The thing with manually putting in LaTeX rather than using the equation editor is that it will not show in the text of the question until you're previewing the quiz.

A much more difficult (in my opinion) way to get what you want requires the use of MathML. This requires you editing the HTML of the page to insert the MathML code, but it will show up as soon as you update the question.

<p>Solve <math xmlns="http://www.w3.org/1998/Math/MathML"><mfrac><mi>x</mi><mn>[a]</mn></mfrac><mo>=</mo><mn>[b]</mn></math>.</p>

 

Here is the visual difference between the two.

While editing the question the LaTeX shows.

Quiz edit modeQuiz edit mode

While previewing (or taking) the quiz, they look the same.

Preview modePreview mode

Historically, there had been problems with using MathML with certain browsers. I think most of those have been worked out, but I haven't checked recently.

There are several benefits to the LaTeX approach that make it my go-to method.

  • It's easier. You already know LaTeX. If not, you can use the equation editor to create the image you want, show the LaTeX, and copy it from there. You just need to cancel out and then wrap it in the \ ( and \ ).
  • The \ ( and \ ) approach invokes MathJax the same as using the equation editor. That means that whatever benefits and browser checking Canvas does to make sure the equation objects display properly is used.
  • Canvas will convert the LaTeX to MathML for you. That's how I got the MathML code to put in there. I went into Chrome's developer tools, looked at the elements page and copied it. That was after I had already created it in LaTeX.

There are sites that will convert LaTeX to MathML for you. I'm not endorsing it, but the first one Google came up with was temml.org. They added a bunch of extra stuff to the code so it's not as simple as what Canvas gave me. This is because it interpreted the [ and ] used to denote a variable as math operators. That would completely break what you're trying to do.

That means that you should put a number in the place of your variables when you create it.

\frac{x}{7}=2

This generates (when you turn off Display Mode and switch the output to Flat MML):

<math><mrow><mfrac><mi>x</mi><mn>7</mn></mfrac><mo>=</mo></mrow><mrow><mn>2</mn></mrow></math>

 

You might be tempted to put the variables in there.

\frac{x}{a}=b

Unfortunately, that tells the converter to math that they are identifiers <mi> instead of numbers <mn>. The identifiers are rendered in italics while the numbers are not.

<math><mrow><mfrac><mi>x</mi><mi>a</mi></mfrac><mo>=</mo></mrow><mrow><mi>b</mi></mrow></math>

 

You may also have noticed the lack of namespace in the code generated from the temml.org website. The namespace on the math element is required for XML documents but not for HTML5, so it should work just fine without it.

All things considered (especially since I already manually type LaTeX for almost all of my assignments), I recommend the LaTeX enclosed in the \ ( and \ ) delimiters rather than MathML.

View solution in original post