WeBWorK Problems

How to get WebWork to simplify its own answers

Re: How to get WebWork to simplify its own answers

by Jaimos Skriletz -
Number of replies: 1
When having students enter in variables, I find that using underscores isn't always the best so I both modify the TeX output and use alias, that way students can just type 'x1' vs having to making it an underscore for simplicity, but the TeX output will show the underscore. I have reduced this to two variables, but you can modify as needed.

Context('Numeric')->variables->are(
x1 => [ 'Real', TeX => 'x_1 ' ],
x2 => [ 'Real', TeX => 'x_2 ' ],
x_1 => [ 'Real', alias => 'x1' ],
x_2 => [ 'Real', alias => 'x2' ],
);

Of course if you want x_1 and x_2 to be the main variables, you can use x1 => ['Real', alias => 'x_1'] if you would prefer. I just do the other way as I find students have an easier time entering in x1 and not use underscores. This way the output looks like I want it to, students can enter in the answers without underscores, but if they do use underscores it still works.
In reply to Jaimos Skriletz

Re: How to get WebWork to simplify its own answers

by Davide Cervone -

Note that you don't need to set the TeX for x1, as the MathObject parser will output x1 as x_{1} in TeX automatically. Any trailing digits are typeset as a subscript in a variable name.