[system] / trunk / pg / macros / PGbasicmacros.pl Repository:
ViewVC logotype

Diff of /trunk/pg/macros/PGbasicmacros.pl

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

Revision 1462 Revision 1758
1425 1425
1426 ## remove leading and trailing spaces so that HTML mode will 1426 ## remove leading and trailing spaces so that HTML mode will
1427 ## not include unwanted spaces as per Davide Cervone. 1427 ## not include unwanted spaces as per Davide Cervone.
1428 $in =~ s/^\s+//; 1428 $in =~ s/^\s+//;
1429 $in =~ s/\s+$//; 1429 $in =~ s/\s+$//;
1430 ## If it ends with a backslash, there should be another space
1431 ## at the end
1432 if($in =~ /\\$/) { $in .= ' ';}
1430 1433
1431 # some modes want the delimiters, some don't 1434 # some modes want the delimiters, some don't
1432 my $in_delim = $mode eq "inline" 1435 my $in_delim = $mode eq "inline"
1433 ? "\\($in\\)" 1436 ? "\\($in\\)"
1434 : "\\[$in\\]"; 1437 : "\\[$in\\]";
1483 $string = $evaluated_string; 1486 $string = $evaluated_string;
1484 $string = ev_substring($string,"\\(","\\)",\&math_ev3); 1487 $string = ev_substring($string,"\\(","\\)",\&math_ev3);
1485 $string = ev_substring($string,"\\[","\\]",\&display_math_ev3); 1488 $string = ev_substring($string,"\\[","\\]",\&display_math_ev3);
1486 $string; 1489 $string;
1487} 1490}
1491
1492sub EV4{
1493 if ($displayMode eq "HTML_dpng") {
1494 my $string = join(" ",@_);
1495 my ($evaluated_string,$PG_eval_errors,$PG_full_errors) = PG_restricted_eval("<<END_OF_EVALUATION_STRING\n$string\nEND_OF_EVALUATION_STRING\n");
1496 if ($PG_eval_errors) {
1497 my @errorLines = split("\n",$PG_eval_errors);
1498 $string =~ s/</&lt;/g; $string =~ s/>/&gt;/g;
1499 $evaluated_string = "<PRE>$PAR % ERROR in $0:EV3, PGbasicmacros.pl:".
1500 "$PAR % There is an error occuring in the following code:$BR ".
1501 "$string $BR % $BR % $errorLines[0]\n % $errorLines[1]$BR ".
1502 "% $BR % $BR </PRE> ";
1503 }
1504 $string = $evaluated_string;
1505 $string = $envir{'imagegen'}->add($string);
1506 $string;
1507 } else {
1508 EV3(@_);
1509 }
1510}
1511
1488 1512
1489=head2 Formatting macros 1513=head2 Formatting macros
1490 1514
1491 beginproblem() # generates text listing number and the point value of 1515 beginproblem() # generates text listing number and the point value of
1492 # the problem. It will also print the file name containing 1516 # the problem. It will also print the file name containing
1795 my $imageURL = alias(shift @image_list); 1819 my $imageURL = alias(shift @image_list);
1796 my $out=""; 1820 my $out="";
1797 1821
1798 if ($displayMode eq 'TeX') { 1822 if ($displayMode eq 'TeX') {
1799 my $imagePath = $imageURL; # in TeX mode, alias gives us a path, not a URL 1823 my $imagePath = $imageURL; # in TeX mode, alias gives us a path, not a URL
1800 if ($envir->{texDisposition} eq "pdf") { 1824 if (defined $envir->{texDisposition} and $envir->{texDisposition} eq "pdf") {
1801 # We're going to create PDF files with our TeX (using pdflatex), so 1825 # We're going to create PDF files with our TeX (using pdflatex), so
1802 # alias should have given us the path to a PNG image. What we need 1826 # alias should have given us the path to a PNG image. What we need
1803 # to do is find out the dimmensions of this image, since pdflatex 1827 # to do is find out the dimmensions of this image, since pdflatex
1804 # is too dumb to live. 1828 # is too dumb to live.
1805 1829

Legend:
Removed from v.1462  
changed lines
  Added in v.1758

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9