[system] / trunk / pg / macros / PGmorematrixmacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGmorematrixmacros.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1236 Revision 1237
536 $rh_ans->{ans_label} =~ /ArRaY(\d+)\[\d+,\d+,\d+\]/; 536 $rh_ans->{ans_label} =~ /ArRaY(\d+)\[\d+,\d+,\d+\]/;
537 my $ans_num = $1; 537 my $ans_num = $1;
538 my @keys = grep /ArRaY$ans_num/, keys(%{$main::inputs_ref}); 538 my @keys = grep /ArRaY$ans_num/, keys(%{$main::inputs_ref});
539 my $key; 539 my $key;
540 my @array = (); 540 my @array = ();
541 #my @latex = ();
541 my ($i,$j,$k) = (0,0,0); 542 my ($i,$j,$k) = (0,0,0);
542 543
543 #the keys aren't in order, so their info has to be put into the array before doing anything with it 544 #the keys aren't in order, so their info has to be put into the array before doing anything with it
544 foreach $key (@keys){ 545 foreach $key (@keys){
545 $key =~ /ArRaY\d+\[(\d+),(\d+),(\d+)\]/; 546 $key =~ /ArRaY\d+\[(\d+),(\d+),(\d+)\]/;
571 $parser -> tostring(); 572 $parser -> tostring();
572 $parser -> normalize(); 573 $parser -> normalize();
573 $entry = $parser -> tostring(); 574 $entry = $parser -> tostring();
574 $rh_ans->{preview_text_string} .= $entry.","; 575 $rh_ans->{preview_text_string} .= $entry.",";
575 $rh_ans->{preview_latex_string} .= $parser -> tolatex().","; 576 $rh_ans->{preview_latex_string} .= $parser -> tolatex().",";
577 #$latex[$i][$j][$k] = "\\{".$parser -> tolatex()."\\}";
578
576 } else { ## error in parsing 579 } else { ## error in parsing
577 $rh_ans->{'student_ans'} = 'syntax error:'.$display_ans. $parser->{htmlerror}, 580 $rh_ans->{'student_ans'} = 'syntax error:'.$display_ans. $parser->{htmlerror},
578 $rh_ans->{'ans_message'} = $display_ans.$parser -> {error_msg}, 581 $rh_ans->{'ans_message'} = $display_ans.$parser -> {error_msg},
579 $rh_ans->{'preview_text_string'} = '', 582 $rh_ans->{'preview_text_string'} = '',
580 $rh_ans->{'preview_latex_string'} = '', 583 $rh_ans->{'preview_latex_string'} = '',
609 } 612 }
610 chop($rh_ans->{preview_text_string}); 613 chop($rh_ans->{preview_text_string});
611 chop($rh_ans->{preview_latex_string}); 614 chop($rh_ans->{preview_latex_string});
612 chop($display_ans); 615 chop($display_ans);
613 616
614 $rh_ans->{student_ans} = $display_ans; 617 #for( $i = 0 ; $i < scalar( @latex ); $i++ ){
618 # $latex[$i] = display_matrix($latex[$i]);
619 #}
620 #$rh_ans->{preview_latex_string} = mbox(\@latex);
621 my @temp = ();
622 for( $i = 0 ; $i < scalar( @array ); $i++ ){
623 push @temp , display_matrix($array[$i], 'left'=>'.', 'right'=>'.');
624 push @temp , "," unless $i == scalar(@array) - 1;
625 }
626 $rh_ans->{student_ans} = mbox(\@temp);
615 $rh_ans->{ra_student_ans} = \@array; 627 $rh_ans->{ra_student_ans} = \@array;
616 628
617 $rh_ans; 629 $rh_ans;
618 630
619} 631}

Legend:
Removed from v.1236  
changed lines
  Added in v.1237

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9