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

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

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

Revision 2695 Revision 2696
48 48
49# 49#
50# Put exponent in braces for TeX 50# Put exponent in braces for TeX
51# 51#
52sub TeX { 52sub TeX {
53 my ($self,$precedence,$showparens,$position) = @_; 53 my ($self,$precedence,$showparens,$position,$outerRight) = @_;
54 my $TeX; my $bop = $self->{def}; 54 my $TeX; my $bop = $self->{def};
55 my $addparens =
56 defined($precedence) &&
57 ($showparens eq 'all' || $precedence > $bop->{precedence} ||
58 ($precedence == $bop->{precedence} &&
59 ($bop->{associativity} eq 'right' || $showparens eq 'same')));
60 my $outerRight = !$addparens && ($outerRight || $position eq 'right');
61
55 my $symbol = (defined($bop->{TeX}) ? $bop->{TeX} : $bop->{string}); 62 my $symbol = (defined($bop->{TeX}) ? $bop->{TeX} : $bop->{string});
63 if ($self->{lop}->class eq 'Function' && $self->{rop}->class eq 'Number' &&
64 $self->{rop}{value} > 0 && int($self->{rop}{value}) == $self->{rop}{value}) {
65 $TeX = $self->{lop}->TeX($precedence,$showparens,$position,$outerRight,
66 $symbol.'{'.$self->{rop}->TeX.'}');
67 $addparens = 0;
68 } else {
56 $self->{lop}->TeX($bop->{precedence},$bop->{leftparens},'left'). 69 $TeX = $self->{lop}->TeX($bop->{precedence},$bop->{leftparens},'left',$outerRight).
57 $symbol.'{'.$self->{rop}->TeX.'}'; 70 $symbol.'{'.$self->{rop}->TeX.'}';
71 }
72
73 $TeX = '\left('.$TeX.'\right)' if $addparens;
74 return $TeX;
58} 75}
59 76
60######################################################################### 77#########################################################################
61 78
621; 791;

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

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9