Sunscript and superscripts in quiz answers

Sunscript and superscripts in quiz answers

per Michelle Armstrong,
Number of replies: 14

Hi All

I was told to repost this question in the Quiz area so here it is.

I have been trying to enter subscripts and superscripts in quiz answers and have run into difficulty.  If I write an answer such as H<sub>2</sub>0 and then decode and verify the question it shows up as though it is H2O with the 2 as a subscript.  When I then preview the question the answer shows up as H<sub>2</sub>O.  Any ideas??  As I have done a fair bit of searching and haven't been able to find a solution.  I am using Moodle 1.9 and this is occuring in multiple choice and embedded answer questions

Average of ratings: -
In reply to Michelle Armstrong

Re: Sunscript and superscripts in quiz answers

per Joseph Rézeau,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers Avatar Translators

This discussion may help: Scientific notation in quiz answers.

Joseph

In reply to Joseph Rézeau

Re: Sunscript and superscripts in quiz answers

per Jean-Michel Védrine,

Hello,

If you are using Moodle 2.0/2.1/2.2 and are able to do some php programming, maybe you can have a look at Tim Hunt's supsub editor. It works quite well with pmatch question type. You can find it here

From the README :

----------------------------

Superscript/subscript editor

This is a very cut-down configuration of TinyMCE that just lets users
edit one line of input with superscripts and subscripts, for use in
Moodle.

This editor was created by Tim Hunt of the Open University
http://www.open.ac.uk/.

This should be compatible with Moodle 2.0+.

-------------------------------

I really don't know what amount of work would be needed to modify the shortanswer question to use it but it should no be more than changing a few lines. Of course the limitation is that it would be used for ALL short answer questions of the Moodle site (because contrary to pmatch shortanswer has no option to turn it on/off).

In reply to Michelle Armstrong

Re: Subscript and superscripts in quiz answers

per Ian Hunt,

I'm using Moodle 2.0 and have not had a problem entering the answers in the html editor for chemical structures of the same type you cite.

In reply to Ian Hunt

Re: Subscript and superscripts in quiz answers

per Joseph Rézeau,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers Avatar Translators

It would be clearer for all if the OP and Ian provided concrete examples of the problem (or non-problem) in the form of screenshots, etc.

Joseph

In reply to Joseph Rézeau

Re: Subscript and superscripts in quiz answers

per Jean-Michel Védrine,

Joseph is right, I have assumed that questions were shortanswer ones but maybe this is not the case. Problem is a lot different for MC or cloze questions !!

Also don't forget when you ask for help in the quiz forum to tell us what version of Moodle you are using.

In reply to Jean-Michel Védrine

Re: Subscript and superscripts in quiz answers

per Joseph Rézeau,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers Avatar Translators

Michelle said she is using moodle 1.9, but we want the exact complete version: moodle 1.9.x

Joseph

In reply to Joseph Rézeau

Re: Subscript and superscripts in quiz answers

per Ian Hunt,

It's not clear to me what particular screenshot would be useful ! Hope this helps.... it's from a simple multiple choice question.

 

Attachment moodle_subscripts.png
In reply to Ian Hunt

Re: Subscript and superscripts in quiz answers

per Joseph Rézeau,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers Avatar Translators

@Ian, that screenshot if from the Matching question type... in Moodle 2. The original poster's version is moodle 1.9, and she mentioned "multiple choice and embedded answer questions", not matching. Let's wait for more info from the original poster.

Joseph

In reply to Joseph Rézeau

Re: Subscript and superscripts in quiz answers

per Ian Hunt,

Sorry, my mistake on the specific qu type. I knew the original post was 1.9, but I thought it might help if it was known that is was fine in 2.0

FYI : I have examples of simple MC in 2.0 with sub or superscripts in the answers that work. It looks like I created them simply by typing the html code into the answer text box.

In reply to Joseph Rézeau

Re: Subscript and superscripts in quiz answers

per Michelle Armstrong,

Hi Guys

My version is 9.1.6 and I have attached screenshots of what is happening along the way.  Could I please not have another person tell me to use the html code as I am and it's not working, thats the problem triste

The first part is what I am typing in, the second is what is showing up when I verify and decode the question and the last one is what I get when I preview the question.

PS I know that this H20 isnt the correct answer sorire

Attachment Issue.jpg
In reply to Michelle Armstrong

Re: Subscript and superscripts in quiz answers

per Jean-Michel Védrine,

Hello Michelle,

With a screen image it's a lot clearer !

The problem is that you are creating your multichoice question inside a cloze (multianswer) question where options are rendered as a dropdown menu and in html it is not possible to have a subscript or a superscript inside a dropdown menu choice (I think this is in fact possible with some javascript but certainly not with plain html code).

In Moodle 2, I know it is possible to render the multichoice question inside a cloze question with choices as checkboxes or radio buttons (see MULTICHOICE_V and MULTICHOICE_H) but I don't remember if it's possible in Moodle 1.9. This would solve your problem as sup and sub tags are allowed in checkboxes and radio buttons labels.

Can someone still using Moodle 1.9 tell if this is possible in that version ?

Average of ratings:Useful (1)
In reply to Jean-Michel Védrine

Re: Subscript and superscripts in quiz answers

per Joseph Rézeau,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers Avatar Translators

Jean-Michel "In Moodle 2, I know it is possible to render the multichoice question inside a cloze question with choices as checkboxes or radio buttons (see MULTICHOICE_V and MULTICHOICE_H) but I don't remember if it's possible in Moodle 1.9. This would solve your problem as sup and sub tags are allowed in checkboxes and radio buttons labels. Can someone still using Moodle 1.9 tell if this is possible in that version ?"

Well, it is kind of possible in moodle 1.9 but the final display is pretty buggy and has not and will not be fixed.

Joseph

In reply to Michelle Armstrong

Re: Subscript and superscripts in quiz answers

per Joseph Rézeau,
Avatar Core developers Avatar Particularly helpful Moodlers Avatar Plugin developers Avatar Testers Avatar Translators

Hi Michelle, if you had attached that screenshot to your original post it would have saved us a lot of time. It makes it clear that your problem is with MULTICHOICE sub-questions located within CLOZE questions in Moodle 1.9.6.

As Jean-Michel says, you cannot use <sub> or <sup> nor indeed any HTML tags within drop-down lists. There is however a simple solution: use unicode characters for your subscripts. See this Wikipedia article.

Here is what your question text might look like:

What is the formula for Amonia: {1:MULTICHOICE:H₂O~C₆H₁₂O₆~=NH₃}

I have attached a proof of concept screenshot (from Moodle 1.9.15, the current version of moodle 1.9).

Joseph

Attachment 20-12-2011 09-36-24.jpg
Average of ratings:Useful (2)
In reply to Joseph Rézeau

Re: Subscript and superscripts in quiz answers

per Jeff Forssell,

The Language teaching "White Knight" Joseph has been helping folks so long here that he knows the tricks of "others" trades. (With the possible exception of spelling ammonia sorire ).

I put this now in the docs:

for MULTICHOICE, which is shown with a dropdown, you cannot have any HTML formatting. If you need subscript or superscripts you can use ISO (Unicode)characters like this: {1:MULTICHOICE:H₂O~C₆H₁₂O₆~=NH₃} (see more about ISO sub/superscripts here: wikipedia)

Only after posting , I noticed I was in the 2.0 part of Docs. I think and hope this is equally true there. (And I haven't put it in 1.9)