WeBWorK Main Forum

MathObject formatting PG 2.6/2.7

Re: MathObject formatting PG 2.6/2.7

by Gavin LaRose -
Number of replies: 0
Hi all,

As a follow-up, I've isolated the problem to the rendering of the ijk format of the vector. A stripped down version of the problem that I'm using is appended. In this, both ijk formatted vectors display as in the lower figure above (as an experiment, I also moved the definition of $vijk above the Context()->texStrings call, to no effect); the standard formatted vector is as expected; and the components of the vector all display correctly.

Thoughts welcome. Thanks,
Gavin

DOCUMENT();
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
);
TEXT(beginproblem());
$showPartialCorrectAnswers = 1;

$c1 = non_zero_random(-5,5,1); $c2 = non_zero_random(3,7,1); $c3 = non_zero_random(-3,3,1);
$c1c2 = $c1*$c2;  $twoc1 = 2*$c1; $c2m1 = $c2 - 1;  $nc1c2 = -1*$c1c2;
Context('Vector')->variables->add('t'=>'Real');
@vel = ( Compute("($twoc1)*t+$c2"), Compute("-$c1*e^(-t)"), Compute("-($c1c2)*sin($c2*t)") );
$vel = Vector( @vel );
$acc = $vel->D;

Context()->texStrings;
$vijk = $vel->ijk;
BEGIN_TEXT
The velocity of a particle is given by \( {\bf v}(t) = \{ $vel->ijk \} \). Find
the acceleration \( {\bf a}(t) \): \{ ans_rule(45) \}
$PAR
\(v_1 = $vel[0] \)$BR \(v_2 = $vel[1] \)$BR
\(v_3 = $vel[2] \)$BR \(v = $vel \)$BR
\(v = $vijk\)
END_TEXT
ANS( $acc->cmp() );
ENDDOCUMENT();