 # MathJax not working on Cloze questions under some circumstances

XMLWordPrintable

#### Details

• Bug
• Status: Closed
• Major
• Resolution: Fixed
• 2.7.2, 2.7.7, 2.8.5
• MOODLE_27_STABLE, MOODLE_28_STABLE
• MOODLE_27_STABLE, MOODLE_28_STABLE
• MDL-47712-master
• Hide
1. Run unit tests
2. Create a new quiz, adding a single Cloze question with the following HTML content:

 
• The audio band frequency range is: {1:MULTICHOICE:~%0%20Hz-2kHz~%0%2kHz-20kHz~%0%2Hz-20kHz~%100%20Hz-20kHz} .
• The capacitor's AC impedance is: $$Z_C(j\omega )=$$ {1:MULTICHOICE:~%0%$$j/(2\pi fC)$$~%100%$$-j/(2\pi fC)$$~%0%$$j2\pi fC$$~%0%$$-j2\pi fC$$} .


(do not change the above in any way).

3. Preview the question
1. Confirm that the equation is correctly rendered (at least in Firefox, other browsers may not display TeX in drop downs)
Show
Run unit tests Create a new quiz, adding a single Cloze question with the following HTML content: <ul><li>The <b>audio band frequency range </b>is: {1:MULTICHOICE:~%0%20Hz-2kHz~%0%2kHz-20kHz~%0%2Hz-20kHz~%100%20Hz-20kHz} .</li><li>The<b> capacitor's AC impedance</b> is: $$Z_C(j\omega )=$$ {1:MULTICHOICE:~%0%$$j/(2\pi fC)$$~%100%$$-j/(2\pi fC)$$~%0%$$j2\pi fC$$~%0%$$-j2\pi fC$$} .</li></ul> (do not change the above in any way). Preview the question Confirm that the equation is correctly rendered (at least in Firefox, other browsers may not display TeX in drop downs)
• FRONTEND Sprint 16, Team B Sprint 1, Team Beards Sprint 2
• Large

#### Description

MathJax will not render math if this math is inside an itemized list of a cloze question, and there's no math outside the list.

Please see attached image. I've created a quiz with 4 questions containing basically the same text:

• 1st one is a description question, with text containing embedded math
• 2nd one is the malfunctioning cloze question. It has only an itemized list with 2 items, and the second one has an equation. The equation is not rendered.
• 3rd question is the same as above, but with a text-only paragraph before the list. Same behaviour, even changing the itemized list into a enumerated one.
• 4th question: Same as 2nd, but embedding an equation into the first paragraph's text. Now the two equations are correctly rendered.

My system:
Test Quiz Filter settings are as follows:
TeX notation OFF (1st place)
MathJax ON (2nd place)

The question text of the malfunctioning cloze question is (in HTML format):

<ul><li>The <b>audio band frequency range </b>is:

{1:MULTICHOICE:~%0%20Hz-2kHz~%0%2kHz-20kHz~%0%2Hz-20kHz~%100%20Hz-20kHz}

.</li><li>The<b> capacitor's AC impedance</b> is: ( Z_C(j\omega )= )

{1:MULTICHOICE:~%0%$$j/(2\pi fC)$$~%100%$$-j/(2\pi fC)$$~%0%$$j2\pi fC$$~%0%$$-j2\pi fC$$}

.</li></ul>

#### People Daniel Thies Orestes Mas Tim Hunt David Monllaó Frédéric Massart
David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo, Safat Shahin, Tim Hunt, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Kevin Percy, Laurent David, Mathew May, Mihail Geshoski, Raquel Ortega, Sabina Abellan, Sander Bangma, Sara Arjona (@sarjona), Shamim Rezaie