WeBWorK Main Forum

Fractional exponents display

Fractional exponents display

by Lars Jensen -
Number of replies: 1
Hi Everyone,

In a problem, how should an expression like

$f = Formula("x^(2/3)")

be defined so that it is displayed like $x^{2/3}$ instead of with a decimal exponent, $x^0.66667$

thanks,
Lars.
In reply to Lars Jensen

Re: Fractional exponents display

by Michael Gage -
Context()->flags->set(reduceConstants=>0);
$f = Formula("x^(2/3)");
Context()->texStrings;
BEGIN_TEXT
\( $f\)
END_TEXT
Context()->normalStrings;

The above works.  There might be another way to change the context

for just one Formula.