version 1.310, 2004/03/12 17:26:29
|
version 1.313, 2004/03/23 00:47:48
|
Line 401 sub latex_special_symbols {
|
Line 401 sub latex_special_symbols {
|
my ($string,$where)=@_; |
my ($string,$where)=@_; |
if ($where eq 'header') { |
if ($where eq 'header') { |
$string =~ s/(\\|_|\^)/ /g; |
$string =~ s/(\\|_|\^)/ /g; |
$string =~ s/(\$|%|\#|&|\{|\})/\\$1/g; |
$string =~ s/(\$|%|\{|\})/\\$1/g; |
$string =~ s/_/ /g; |
$string =~ s/_/ /g; |
} else { |
$string=&Apache::lonprintout::character_chart($string); |
$string=~s/([^\\])\%/$1\\\%/g; |
# any & or # leftover should be safe to just escape |
$string=~s/([^\\])(\$|_)/$1\\$2/g; |
|
$string=~s/\$\$/\$\\\$/g; |
|
$string=~s/([^\\])\&/$1\\\&/g; |
$string=~s/([^\\])\&/$1\\\&/g; |
$string=~s/([^\\])\#/$1\\\#/g; |
$string=~s/([^\\])\#/$1\\\#/g; |
|
} else { |
|
$string=~s/\\/\\ensuremath{\\backslash}/g; |
|
$string=~s/([^\\]|^)\%/$1\\\%/g; |
|
$string=~s/([^\\]|^)(\$|_)/$1\\$2/g; |
|
$string=~s/\$\$/\$\\\$/g; |
$string=~s/\#\#/\#\\\#/g; |
$string=~s/\#\#/\#\\\#/g; |
$string=~s/([^\\])(\~|\^)/$1\\$2\\strut /g; |
$string=~s/([^\\]|^)(\~|\^)/$1\\$2\\strut /g; |
$string=~s/(>|<)/\\ensuremath\{$1\}/g; #more or less |
$string=~s/(>|<)/\\ensuremath\{$1\}/g; #more or less |
|
$string=&Apache::lonprintout::character_chart($string); |
|
# any & or # leftover should be safe to just escape |
|
$string=~s/([^\\]|^)\&/$1\\\&/g; |
|
$string=~s/([^\\]|^)\#/$1\\\#/g; |
#single { or } How to escape? |
#single { or } How to escape? |
} |
} |
return $string; |
return $string; |
Line 506 sub inner_xmlparse {
|
Line 513 sub inner_xmlparse {
|
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
if (($token->[0] eq 'T') || ($token->[0] eq 'C') || ($token->[0] eq 'D') ) { |
#Style file definitions should be correct |
#Style file definitions should be correct |
if ($target eq 'tex' && ($Apache::lonxml::usestyle)) { |
if ($target eq 'tex' && ($Apache::lonxml::usestyle)) { |
$result=&latex_special_symbols(&Apache::lonprintout::character_chart($result)); |
$result=&latex_special_symbols($result); |
} |
} |
} |
} |
|
|
Line 746 sub init_safespace {
|
Line 753 sub init_safespace {
|
$safehole->wrap(\&Math::Random::random_get_seed,$safeeval,'&random_get_seed'); |
$safehole->wrap(\&Math::Random::random_get_seed,$safeeval,'&random_get_seed'); |
$safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); |
$safehole->wrap(\&Math::Random::random_set_seed,$safeeval,'&random_set_seed'); |
$safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); |
$safehole->wrap(\&Apache::lonxml::error,$safeeval,'&LONCAPA_INTERNAL_ERROR'); |
|
$safehole->wrap(\&Apache::lonxml::debug,$safeeval,'&LONCAPA_INTERNAL_DEBUG'); |
|
|
#need to inspect this class of ops |
#need to inspect this class of ops |
# $safeeval->deny(":base_orig"); |
# $safeeval->deny(":base_orig"); |