Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-37845

MathJax does not work properly inside Feedback of multiplechoice quiz

    Details

    • 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.
      4. Now, preview your question.
      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:

      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

      .que.multichoice .feedback .rightanswer
      *

      { display:inline }

      and add the code

      .que.multichoice .feedback .rightanswer
      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    13/May/13