WeBWorK Problems

latex newcommand

Re: latex newcommand

by Michael Gage -
Number of replies: 0
You probably won't be able to do this the way you planned. Probably what you want is to use the Matrix MathObjects (see below).

However if absolutely necessary one can add tex commands to the files webwork2/conf/snippets/hardcopyPreamble.tex which is loaded before printing a hardcopy and to webwork2/lib/WeBWorK/Constants.pm which is loaded before each equation is typeset. In order to maintain compatibility of p[roblems over a period of time one should be pretty cautious about doing this.

For the math objects make sure to load the macro file "Parser.pl"
and try something like this snippet:

TEXT(beginproblem());

($a,$b,$c,$d) = (23, 25, 45,8);
$ma = Matrix([$a, $b], [$c, $d]);

Context()->texStrings;
BEGIN_TEXT

\( $ma \)

END_TEXT
Context()->normalStrings;