version 1.3, 2015/06/30 17:42:14
|
version 1.6, 2023/03/13 22:31:22
|
Line 1
|
Line 1
|
# The LearningOnline Network with CAPA - LON-CAPA |
# The LearningOnline Network with CAPA - LON-CAPA |
# Parsed tree node |
# Parsed tree node |
# |
# |
|
# $Id$ |
|
# |
# Copyright (C) 2014 Michigan State University Board of Trustees |
# Copyright (C) 2014 Michigan State University Board of Trustees |
# |
# |
# This program is free software: you can redistribute it and/or modify |
# This program is free software: you can redistribute it and/or modify |
Line 746 sub toTeX {
|
Line 748 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 812 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 851 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") { |