PREP 2014 Question Authoring - Archived

Reduced fractions in problem text and in student answers

Re: Reduced fractions in problem text and in student answers

by Davide Cervone -
Number of replies: 0
Note that the Fraction context can help with (1) as well, as fractions are reduced automatically when they are created (by a professor). For example, if you enter
    loadMacros("contextFraction.pl");
    Context("Fraction");
    $r = Compute("4/6");
in the Interactive PG lab, you will get 2/3 as the output, not 4/6. There are flags that control the reduction of fractions, and other output features, like whether to show mixed numbers or improper fractions.

For student answers, the reduction is turned off automatically, so when you use studentMustReduceFractions => 1, their fractions aren't reduced by default.

See the documentation for the Fraction context for details.

So in terms of (1), you can just create a Fraction object and include it in your BEGIN_TEX/END_TEXT a you would any other MathObject, and it will format the reduced fraction automatically.