# MathJax does not work properly inside Feedback of multiplechoice quiz

XMLWordPrintable

#### Details

• Type: Bug
• Status: Closed
• Priority: Minor
• Resolution: Fixed
• Affects Version/s: 2.3.3, 2.4.3
• Fix Version/s:
• Component/s:
• Labels:
• Testing Instructions:
Hide
1. Create a multiple choice, multiple-response question as follows.
2. Some of the choices should be one line of text. Others should be multiple paragraphs. Feel free to throw some images into the mix too, or other complexities like that.
3. Similarly, give some choices some specific feeback that is one or multi-line. For other choices, leave the feedback blank.
5. Ensure that all the display options are turned on. Restart the question of necessary.
6. Make sure the layout of the choices is OK.
7. Select all choices and "Submit and finish"
8. Make sure all the feedback is displayed OK. The feedback should start on the same line as the choice, but it may wrap / have paragraph breaks.
Show
Create a multiple choice, multiple-response question as follows. Some of the choices should be one line of text. Others should be multiple paragraphs. Feel free to throw some images into the mix too, or other complexities like that. Similarly, give some choices some specific feeback that is one or multi-line. For other choices, leave the feedback blank. Now, preview your question. Ensure that all the display options are turned on. Restart the question of necessary. Make sure the layout of the choices is OK. Select all choices and "Submit and finish" Make sure all the feedback is displayed OK. The feedback should start on the same line as the choice, but it may wrap / have paragraph breaks.
• Difficulty:
Easy
• Affected Branches:
MOODLE_23_STABLE, MOODLE_24_STABLE
• Fixed Branches:
MOODLE_23_STABLE, MOODLE_24_STABLE
• Pull from Repository:
• Pull Master Branch:
• Pull Master Diff URL:

#### Description

When students get Feedback from a multiple choice answer in the quiz module, all math notation is messed up. I use MathJax, and there seems to be a problem with javascript inside the feedback (see https://tracker.moodle.org/browse/MDL-35343). In within HEAD I have:

<script type="text/x-mathjax-config"> MathJax.Hub.Config({
MMLorHTML:

{ prefer: "HTML" }

,
tex2jax:

{ displayMath: [['$$', '$$'], ['\$', '\$'], ['@d', '@d']], inlineMath: [['$', '$' ], ['\$$', '\$$']], processEscapes: true }

,
});
</script>
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML"></script>

It seems that the javascript escapes at some point in the feedback and then writes out the code instead. I am using Firefox, but the problem is also present in Chromium. I have no windows & IE. Moodle 2.3.3+ build 20121123.

It is the same problem as described in this thread: https://moodle.org/mod/forum/discuss.php?d=214198&parent=933794

I have realized, that it has something to do with the css classes feedback and rightanswer. If I change "feedback" or "rightanswer" to something else in the source code, the math will show up right...

UPDATE: If I in "question/type/multichoice/styles.css" remove/comment out the code

*

{ display:inline }

script

{ display:none }

then it works fine. - But of course then the right answer will start one line under 'Correct answer:' - but that is a minor issue for me.

#### Attachments

1. MDL-37845-before-patch.png
401 kB
2. MDL-37845-with-patch.png
399 kB

#### People

• Assignee:
Tim Hunt
Reporter:
Gunnar Restorff
Integrator:
Damyon Wiese
Tester:
Damyon Wiese
Participants:
Component watchers:
Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Bas Brands