WeBWorK Problems

Asterisk appears in Compute( "$a x " )->reduce; HOW TO GET RID OF IT?

Re: Asterisk appears in Compute( "$a x " )->reduce; HOW TO GET RID OF IT?

by Alex Jordan -
Number of replies: 0
I believe that BEGIN_TEXT and END_TEXT are just easier-to-read replacements for TEXT(EV3(<<'EOT')); and EOT. You should also be able to put Context()->texStrings and Context()->normalStrings before and after these commands.

To explain a little what is happening here, suppose $f=Formula("x/3"). Then $f is a complex hash of information, including how to represent $f as a string for say other math objects, as well as how to represent it as a string to be processed with tex.

By default, Context()->normalStrings is in place, and if you had $g=Formula("$f+1");, then $f is replaced with x/3, and you have something equivalent to $g=Formula("x/3+1");. But for display to students, you want $f to come out as \frac{x}{3}. Setting Context()->texStrings makes this happen.

Lastly you go back to Context()->normalStrings, because if you now used $g=Formula("$f+1");, you'd get an error from $g=Formula("\frac{x}{3}+1").

I've used this example with division to reveal a big difference between the two modes. But in general, "normal" strings and "tex" strings are just different.