[system] / trunk / pg / lib / Parser / BOP / multiply.pm Repository:
ViewVC logotype

Diff of /trunk/pg/lib/Parser/BOP/multiply.pm

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

Revision 2695 Revision 2696
63 ($self->{lop}->class eq 'Function' && $self->{rop}->class ne 'Function')); 63 ($self->{lop}->class eq 'Function' && $self->{rop}->class ne 'Function'));
64 return $self; 64 return $self;
65} 65}
66 66
67sub TeX { 67sub TeX {
68 my ($self,$precedence,$showparens,$position) = @_; 68 my ($self,$precedence,$showparens,$position,$outerRight) = @_;
69 my $TeX; my $bop = $self->{def}; 69 my $TeX; my $bop = $self->{def}; my $cdot;
70 my $mult = (defined($bop->{TeX}) ? $bop->{TeX} : $bop->{string}); 70 my $mult = (defined($bop->{TeX}) ? $bop->{TeX} : $bop->{string});
71 $mult = '\cdot ' if ($self->{lop}->class eq 'Number' && $self->{rop}->class eq 'Number'); 71 ($mult,$cdot) = @{$mult} if ref($mult) eq 'ARRAY';
72 $cdot = '\cdot ' unless $cdot;
73
74 my $addparens =
75 defined($precedence) &&
76 ($showparens eq 'all' || $precedence > $bop->{precedence} ||
77 ($precedence == $bop->{precedence} &&
78 ($bop->{associativity} eq 'right' || $showparens eq 'same')));
79 my $outerRight = !$addparens && ($outerRight || $position eq 'right');
80
72 $self->{lop}->TeX($bop->{precedence},$bop->{leftparens},'left'). $mult . 81 my $left = $self->{lop}->TeX($bop->{precedence},$bop->{leftparens},'left',$outerRight);
73 $self->{rop}->TeX($bop->{precedence},$bop->{rightparens},'right'); 82 my $right = $self->{rop}->TeX($bop->{precedence},$bop->{rightparens},'right');
83 $mult = $cdot if $left =~ m/\d$/ && $right =~ m/^\d/;
84 $TeX = $left.$mult.$right;
85
86 $TeX = '\left('.$TeX.'\right)' if $addparens;
87 return $TeX;
74} 88}
75 89
76######################################################################### 90#########################################################################
77 91
781; 921;

Legend:
Removed from v.2695  
changed lines
  Added in v.2696

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9