Diff for /loncom/homework/math_parser/ENode.pm between versions 1.3 and 1.5

version 1.3, 2015/06/30 17:42:14 version 1.5, 2017/01/27 20:24:26
Line 746  sub toTeX { Line 746  sub toTeX {
                     }                      }
                 }                  }
                 when ("!") {                  when ("!") {
                     return($c0->toTeX()." !");                      my $s = $c0->toTeX();
                       if ($c0->type == OPERATOR) {
                           $s = "(".$s.")";
                       }
                       $s .= " !";
                       return $s;
                 }                  }
                 when ("%") {                  when ("%") {
                     return($c0->toTeX()." \\% ".$c1->toTeX());                      return($c0->toTeX()." \\% ".$c1->toTeX());
Line 805  sub toTeX { Line 810  sub toTeX {
                 when ("sqrt") {   return "\\sqrt{".$c1->toTeX()."}"; }                  when ("sqrt") {   return "\\sqrt{".$c1->toTeX()."}"; }
                 when ("abs") {    return "|".$c1->toTeX()."|"; }                  when ("abs") {    return "|".$c1->toTeX()."|"; }
                 when ("exp") {    return "\\mathrm{e}^{".$c1->toTeX()."}"; }                  when ("exp") {    return "\\mathrm{e}^{".$c1->toTeX()."}"; }
                   when ("factorial") {
                       my $s = $c1->toTeX();
                       if ($c1->type == OPERATOR) {
                           $s = "(".$s.")";
                       }
                       $s .= " !";
                       return $s;
                   }
                 when ("diff") {                  when ("diff") {
                     if (scalar(@children) == 3) {                      if (scalar(@children) == 3) {
                         return "\\frac{d}{d".$c2->toTeX()."} ".$c1->toTeX();                          return "\\frac{d}{d".$c2->toTeX()."} ".$c1->toTeX();
Line 836  sub toTeX { Line 849  sub toTeX {
                         return "\\lim_{".$c2->toTeX()." \\to ".$c3->toTeX().                          return "\\lim_{".$c2->toTeX()." \\to ".$c3->toTeX().
                         "}".$c1->toTeX();                          "}".$c1->toTeX();
                     } else {                      } else {
                         return "\\lim_{".$c2->toTeX()." \\to ".$c3->toTeX().                          my $s = "\\lim_{".$c2->toTeX()." \\to ".$c3->toTeX();
                         (($c4->value eq "plus") ? "+" : "-").                          if ($c4->value eq "plus") {
                         "}".$c1->toTeX();                              $s .= "+";
                           } elsif ($c4->value eq "minus") {
                               $s .= "-";
                           }
                           $s .= "}".$c1->toTeX();
                           return $s;
                     }                      }
                 }                  }
                 when ("binomial") {                  when ("binomial") {

Removed from v.1.3  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>