From: dpvc v. a. <we...@ma...> - 2005-06-05 23:24:18
|
Log Message: ----------- Better handling of open and close delimiters that are explicitly set. Modified Files: -------------- pg/lib/Value: Matrix.pm Point.pm Revision Data ------------- Index: Matrix.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Matrix.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -Llib/Value/Matrix.pm -Llib/Value/Matrix.pm -u -r1.18 -r1.19 --- lib/Value/Matrix.pm +++ lib/Value/Matrix.pm @@ -361,14 +361,14 @@ sub stringify { my $self = shift; - return $self->TeX(undef,$self->{open},$self->{close}) if $$Value::context->flag('StringifyAsTeX'); - return $self->string(undef,$self->{open},$self->{close}) + return $self->TeX if $$Value::context->flag('StringifyAsTeX'); + return $self->string(undef,$self->{open},$self->{close}); } sub string { my $self = shift; my $equation = shift; my $def = ($equation->{context} || $$Value::context)->lists->get('Matrix'); - my $open = shift || $def->{open}; my $close = shift || $def->{close}; + my $open = shift || $def->{open}; my $close = shift || $def->{close}; my @coords = (); foreach my $x (@{$self->data}) { if (Value::isValue($x)) {push(@coords,$x->string($equation,$open,$close))} @@ -378,12 +378,13 @@ } # -# Use \matrix to lay out matrices +# Use array environment to lay out matrices # sub TeX { my $self = shift; my $equation = shift; my $def = ($equation->{context} || $$Value::context)->lists->get('Matrix'); - my $open = shift || $def->{open}; my $close = shift || $def->{close}; + my $open = shift || $self->{open} || $def->{open}; + my $close = shift || $self->{close} || $def->{close}; $open = '\{' if $open eq '{'; $close = '\}' if $close eq '}'; my $TeX = ''; my @entries = (); my $d; if ($self->isRow) { Index: Point.pm =================================================================== RCS file: /webwork/cvs/system/pg/lib/Value/Point.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -Llib/Value/Point.pm -Llib/Value/Point.pm -u -r1.14 -r1.15 --- lib/Value/Point.pm +++ lib/Value/Point.pm @@ -176,7 +176,7 @@ sub stringify { my $self = shift; - return $self->TeX(undef,$self->{open},$self->{close}) if $$Value::context->flag('StringifyAsTeX'); + return $self->TeX if $$Value::context->flag('StringifyAsTeX'); return $self->string(undef,$self->{open},$self->{close}); } @@ -194,7 +194,8 @@ sub TeX { my $self = shift; my $equation = shift; my $def = ($equation->{context} || $$Value::context)->lists->get('Point'); - my $open = shift || $def->{open}; my $close = shift || $def->{close}; + my $open = shift || $self->{open} || $def->{open}; + my $close = shift || $self->{close} || $def->{close}; my @coords = (); foreach my $x (@{$self->data}) { if (Value::isValue($x)) {push(@coords,$x->TeX($equation))} else {push(@coords,$x)} |