MathML and fractions


  • administrators

    The are a few ways you can generate typeset maths. Below are a number of options that you can try when generating expressions. They behave slightly differently to each other but I include them here for discussion.

    $a1=maple("x^(5/2)");
    
    #temporarily assign to variable inside maple call
    $d1=maple("a1:=$a1:printf(MathML[ExportPresentation](a1))");
    
    #whole calculation done in maple call
    $d2=maple("a1:=x^(5/2):printf(MathML[ExportPresentation](a1))");
    
    # using codegen
    $a3=maple("x^(5/2)");
    $d3=maple("codegen[MathML]($a1)");
    
    #using just Export
    $a4=maple("x^(5/2)");
    $d4=maple("printf(MathML[Export]($a1))");
    
    # if you prefer the 5/2 form
    $a5=maple("x^(5/2)");
    $d5=maple("printf(MathML[ExportPresentation]($a1))");
    

    Here is the output they generate. Notice that $d1 to $d4 give the same result, but $d5 is different. Under the hood the first 4 are generating fractions using the MathML <mfrac> whereas $d5 is using <mrow>.