Clipping of Fractions when generating MathML Multiple Choice Interval Notation questions

  • Banned

    Hi, I am creating a randomly generated multiple choice question that generates a random linear inequality and generates a right answer and a series of wrong answers in interval notation. The multiple choice answers are in the format like (−∞, $ansmathml] or ($wrongansml1, ∞) where $ansmathml and $wrongansml are rational numbers generated by algorithms then passed through the mathml command. The algorithm works but my concern is that when $ansmathml or $wrongansml1 are fractions, the top and bottom of the fraction are clipped when the browser draws them, so that while legible, part of the fraction is not visible. If the algebra produces an integer result the mathml looks fine. 

    Is there any way to change the behaviour of the mathml so that the fractions aren't clipped like this?  Or is there a better way to create randomly generated interval notation questions?

  • administrators

    Have you tried the built in Maple MathML generator? If you maple expression is stored in $expr then try this. 


  • Banned

    I changed the code to 

    $ans1=#define algorithm for answer here;

    originally the code in the question was simply ansmathml=mathml($ans1);

    Both codes create a Math ML object. However in the case of both codes when $ans1 is a fraction like say 1/6, the fraction will not completely display in the multiple choice selections as the fraction is cropped at the top and bottom.  (see example below)


  • administrators

    Can you export the question and post it so I can see if I can replicate you issue?

  • Banned

    @jmtrik I've exported and attached the question.

    Edit: I am unsure that the file is attached. I click the file upload tool, select the exported zip but nothing seems to indicate that the zip file is attached. Tried attaching non-zip file same result.

  • administrators

    You should be able to drag a file into the editor window and it should then place a hyperlink to the file in the post. You may need to wait a few seconds if it is a large file. You could also try using or equivalent service and pasting a link here.

  • Banned

    Try: for the exported question.

  • administrators

    @EntilzaV Sorry. I can't get this url to work. Could you try again please?

  • Banned

  • The above URL doesn't work either I'm afraid.

    If (−∞,$ans1] is written in the equation editor, then this renders as a MathML object whose size is determined by what is written. In other words, MathML does not realise $ans1 is actually representing a fraction.

    The typical fix would be along the lines of setting $ansmathml as the multiple choice option, and defining $ansmathml=mathml("(-infinity,1/6]");

    If you copy your algorithm code into a response I may be able to help further.

  • Banned

    Yes, that's what I have defined in the equation editor. (-infinity, $ans1] and other randomly generated combinations of (-infinity, $wrongans), [$ans1, infinity), etc.

    The reason I have to do that, is because if I do as you suggest (and that's what I started with but didn't work) and have something like $ansmathml2=mathml ("(-infinity,$frac]");, Maple T.A. either interprets the square bracket as a round one or  renders the square bracket as a round bracket. It also clips like so  clipping issues part 2.jpg

  • Banned

    Okay, did some more work. I created a new question with the following algorthim:

    $ansmathml1 = mathml("(-infinity,1/6]");
    $ansmathml2 = mathml ("(-infinity, 1/6)");
    $ansmathml3 = mathml ("(1/6, infinity)");
    $ansmathml4 = mathml ("[1/6, infinity)");

    I figured out what caused the clipping, if I don't put the variable through the equation editor and just render it in the multiple choice field as the variable, I get 

    So I still have my issue with the square brackets being turned into round ones. However, the clipping issue has gone away.

    If I tediously edit my multiple choice so that "(-infinity," is put through the equation editor but $ansmathml is not and then back to the equation editor for a second time to get "]" I get the fraction to appear if not perfectly, than without the clipping. See 

    It's not perfect, but at least it is now a lot more legible. 

  • administrators

    You can try using latex instead.

    In the algorithm section write

    $ansmathml1 = "\left(-\infty, \dfrac{1}{6}\right]";
    $ansmathml2 = "\left(-\infty, \dfrac{1}{6}\right)";

    Then in the answer boxes put for example 

    \( $ansmathml1 \)

    Here is the result.

Log in to reply