version 1.65, 2005/04/07 06:56:27
|
version 1.68, 2005/08/16 16:29:53
|
Line 165 sub jsMath_converted {
|
Line 165 sub jsMath_converted {
|
my $tag='span'; |
my $tag='span'; |
if (&displaystyle($texstring)) { $tag='div'; } |
if (&displaystyle($texstring)) { $tag='div'; } |
&clean_out_math_mode($texstring); |
&clean_out_math_mode($texstring); |
return '<'.$tag.' class="math">'.$$texstring.'</'.$tag.'>'; |
return &jsMath_header(). |
|
'<'.$tag.' class="math">'.$$texstring.'</'.$tag.'>'; |
|
} |
|
|
|
{ |
|
my $jsMath_sent_header; |
|
sub jsMath_reset { |
|
$jsMath_sent_header=0; |
|
} |
|
sub jsMath_header { |
|
return '' if $jsMath_sent_header; |
|
$jsMath_sent_header=1; |
|
return |
|
'<script type="text/javascript"> |
|
function NoFontMessage () {} |
|
</script>'."\n". |
|
'<script src="/adm/jsMath/jsMath.js"></script>'."\n"; |
|
} |
|
sub jsMath_process { |
|
return '' if !$jsMath_sent_header; |
|
return '<script type="text/javascript">jsMath.Process()</script>'; |
|
} |
} |
} |
|
|
sub mimetex_converted { |
sub mimetex_converted { |
Line 185 sub mimetex_converted {
|
Line 206 sub mimetex_converted {
|
} |
} |
|
|
sub converted { |
sub converted { |
if ($env{'environment.texengine'} eq 'tth') { |
my ($string,$mode)=@_; |
return &tth_converted; |
if ($mode eq '') { $mode=$env{'environment.texengine'}; } |
} elsif ($env{'environment.texengine'} eq 'jsMath') { |
if ($mode =~ /tth/i) { |
return &jsMath_converted; |
return &tth_converted($string); |
} elsif ($env{'environment.texengine'} eq 'mimetex') { |
} elsif ($mode =~ /jsmath/i) { |
return &mimetex_converted; |
return &jsMath_converted($string); |
|
} elsif ($mode =~ /mimetex/i) { |
|
return &mimetex_converted($string); |
} |
} |
return &tth_converted; |
return &tth_converted($string); |
} |
} |
|
|
# ====================================================================== Footer |
# ====================================================================== Footer |
Line 323 sub postprocess_algebra {
|
Line 346 sub postprocess_algebra {
|
# moodle had these and I don't know why, ignoring them for now |
# moodle had these and I don't know why, ignoring them for now |
# $string =~s/\\fun/ /g; |
# $string =~s/\\fun/ /g; |
|
|
# sqrt(3,4) -> \sqrt\let{3,4\right}, which is annoying |
|
$string =~s/\\left\{/\{/g; |
|
$string =~s/\\right\}/\}/g; |
|
|
|
# remove the extra () in the denominator of a \frac |
# remove the extra () in the denominator of a \frac |
$string =~s/\\frac{(.+?)}{\\left\((.+?)\\right\)}/\\frac{$1}{$2}/gs; |
$string =~s/\\frac{(.+?)}{\\left\((.+?)\\right\)}/\\frac{$1}{$2}/gs; |
|
|