When following the documentation for radio buttons from http://webwork.maa.org/wiki/MultipleChoiceRadio1if I replace “Green” with "\( \displaystyle \frac {$a x} {$b y} \) " what gets displayed after that radio button is: [math] ax/by “>ax/by. How do you get simply the fraction ax/by?
Below is the code. Thanks, Mary
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"parserRadioButtons.pl",
);
TEXT(beginproblem());
############################ Setup
Context("Numeric");
Context() -> variables -> add( y => "Real");
$ar = 1;
while ( $ar == 1) {
$a = random(2,10,1);
$b = random(11,20, 1);
($ar, $br) = reduce($a, $b);
}
$radio = RadioButtons(
["Red","Blue","\( \displaystyle \frac {$ar x} {$br y} \)","None of these"],
"Blue", # correct answer
last => ["None of these"], # can be a list
);
############################ Text
Context()->texStrings;
BEGIN_TEXT
My favorite color is \( \displaystyle \frac {$ar x} {$br y} \)$BR $BR
\{ $radio->buttons() \}
END_TEXT
Context()->normalStrings;
############################ Answers
install_problem_grader(~~&std_problem_grader);
$showPartialCorrectAnswers = 0;
ANS( $radio->cmp() );
ENDDOCUMENT();