| … | |
… | |
| 45 | $SOLUTION, |
45 | $SOLUTION, |
| 46 | $HINT, |
46 | $HINT, |
| 47 | $US, |
47 | $US, |
| 48 | $SPACE, |
48 | $SPACE, |
| 49 | $BBOLD, |
49 | $BBOLD, |
| 50 | $EBOLD, |
50 | $EBOLD, |
| 51 | $BITALIC, |
51 | $BITALIC, |
| 52 | $EITALIC, |
52 | $EITALIC, |
| 53 | $BCENTER, |
53 | $BCENTER, |
| 54 | $ECENTER, |
54 | $ECENTER, |
| 55 | $HR, |
55 | $HR, |
| … | |
… | |
| 85 | $main::SOLUTION = SOLUTION_HEADING(); |
85 | $main::SOLUTION = SOLUTION_HEADING(); |
| 86 | $main::HINT = HINT_HEADING(); |
86 | $main::HINT = HINT_HEADING(); |
| 87 | $main::US = US(); |
87 | $main::US = US(); |
| 88 | $main::SPACE = SPACE(); |
88 | $main::SPACE = SPACE(); |
| 89 | $main::BBOLD = BBOLD(); |
89 | $main::BBOLD = BBOLD(); |
| 90 | $main::EBOLD = EBOLD(); |
90 | $main::EBOLD = EBOLD(); |
| 91 | $main::BITALIC = BITALIC(); |
91 | $main::BITALIC = BITALIC(); |
| 92 | $main::EITALIC = EITALIC(); |
92 | $main::EITALIC = EITALIC(); |
| 93 | $main::BCENTER = BCENTER(); |
93 | $main::BCENTER = BCENTER(); |
| 94 | $main::ECENTER = ECENTER(); |
94 | $main::ECENTER = ECENTER(); |
| 95 | $main::HR = HR(); |
95 | $main::HR = HR(); |
| … | |
… | |
| 101 | $main::PERCENT = PERCENT(); |
101 | $main::PERCENT = PERCENT(); |
| 102 | $main::CARET = CARET(); |
102 | $main::CARET = CARET(); |
| 103 | $main::PI = PI(); |
103 | $main::PI = PI(); |
| 104 | $main::E = E(); |
104 | $main::E = E(); |
| 105 | @main::ALPHABET = ('A'..'ZZ'); |
105 | @main::ALPHABET = ('A'..'ZZ'); |
| 106 | |
106 | |
| 107 | $PAR = PAR(); |
107 | $PAR = PAR(); |
| 108 | $BR = BR(); |
108 | $BR = BR(); |
| 109 | $LQ = LQ(); |
109 | $LQ = LQ(); |
| 110 | $RQ = RQ(); |
110 | $RQ = RQ(); |
| 111 | $BM = BM(); |
111 | $BM = BM(); |
| … | |
… | |
| 134 | $PERCENT = PERCENT(); |
134 | $PERCENT = PERCENT(); |
| 135 | $CARET = CARET(); |
135 | $CARET = CARET(); |
| 136 | $PI = PI(); |
136 | $PI = PI(); |
| 137 | $E = E(); |
137 | $E = E(); |
| 138 | @ALPHABET = ('A'..'ZZ'); |
138 | @ALPHABET = ('A'..'ZZ'); |
| 139 | |
139 | |
| 140 | |
140 | |
| 141 | |
141 | |
| 142 | } |
142 | } |
| 143 | |
143 | |
| 144 | =head2 Answer blank macros: |
144 | =head2 Answer blank macros: |
| 145 | |
145 | |
| … | |
… | |
| 650 | my @list = @_; |
650 | my @list = @_; |
| 651 | $name = RECORD_ANS_NAME($name); # record answer name |
651 | $name = RECORD_ANS_NAME($name); # record answer name |
| 652 | my $answer_value = ''; |
652 | my $answer_value = ''; |
| 653 | $answer_value = ${$main::inputs_ref}{$name} if defined(${$main::inputs_ref}{$name}); |
653 | $answer_value = ${$main::inputs_ref}{$name} if defined(${$main::inputs_ref}{$name}); |
| 654 | my $out = ""; |
654 | my $out = ""; |
| 655 | if ($displayMode eq "HTML" or $displayMode eq "HTML_tth" or |
655 | if ($displayMode eq 'HTML' or $displayMode eq 'HTML_tth' or |
| 656 | $displayMode eq "HTML_dpng") { |
656 | $displayMode eq 'HTML_dpng' or $displayMode eq 'HTML_img') { |
| 657 | $out = qq!<SELECT NAME = "$name" SIZE=1> \n!; |
657 | $out = qq!<SELECT NAME = "$name" SIZE=1> \n!; |
| 658 | my $i; |
658 | my $i; |
| 659 | foreach ($i=0; $i< @list; $i=$i+2) { |
659 | foreach ($i=0; $i< @list; $i=$i+2) { |
| 660 | my $select_flag = ($list[$i] eq $answer_value) ? "SELECTED" : ""; |
660 | my $select_flag = ($list[$i] eq $answer_value) ? "SELECTED" : ""; |
| 661 | $out .= qq!<OPTION $select_flag VALUE ="$list[$i]" > $list[$i+1] </OPTION>\n!; |
661 | $out .= qq!<OPTION $select_flag VALUE ="$list[$i]" > $list[$i+1] </OPTION>\n!; |
| … | |
… | |
| 733 | sub hint { |
733 | sub hint { |
| 734 | my @in = @_; |
734 | my @in = @_; |
| 735 | my $out = ''; |
735 | my $out = ''; |
| 736 | |
736 | |
| 737 | $main::hintExists =1; |
737 | $main::hintExists =1; |
| 738 | $main::numOfAttempts = 0 unless defined($main::numOfAttempts); |
738 | $main::numOfAttempts = 0 unless defined($main::numOfAttempts); |
| 739 | |
739 | |
| 740 | if ($main::displayMode eq 'TeX') { |
740 | if ($main::displayMode eq 'TeX') { |
| 741 | $out = ''; # do nothing since hints are not available for download |
741 | $out = ''; # do nothing since hints are not available for download |
| 742 | } elsif (($envir{'displayHintsQ'}) and ($main::numOfAttempts >= $main::showHint)) |
742 | } elsif (($envir{'displayHintsQ'}) and ($main::numOfAttempts >= $main::showHint)) |
| 743 | |
743 | |
| 744 | ## the second test above prevents a hint being shown if a doctored form is submitted |
744 | ## the second test above prevents a hint being shown if a doctored form is submitted |
| 745 | |
745 | |
| 746 | {$out = join(' ',@in);} # show hint |
746 | {$out = join(' ',@in);} # show hint |
| 747 | |
747 | |
| 748 | $out ; |
748 | $out ; |
| 749 | } |
749 | } |
| 750 | |
750 | |
| 751 | |
751 | |
| 752 | sub HINT { |
752 | sub HINT { |
| … | |
… | |
| 863 | return $options{HTML} |
863 | return $options{HTML} |
| 864 | if defined( $options{HTML} ); |
864 | if defined( $options{HTML} ); |
| 865 | die " ERROR in using MODES: 'HTML' option not defined for HTML_tth"; |
865 | die " ERROR in using MODES: 'HTML' option not defined for HTML_tth"; |
| 866 | |
866 | |
| 867 | } |
867 | } |
| 868 | |
868 | |
|
|
869 | if ($displayMode eq "HTML_img") { |
|
|
870 | return $options{HTML_dpng} if defined $options{HTML_dpng}; |
|
|
871 | return $options{HTML_tth} if defined $options{HTML_tth}; |
|
|
872 | return $options{HTML} if defined $options{HTML}; |
|
|
873 | die " ERROR in using MODES: 'HTML' option not defined for HTML_img"; |
|
|
874 | } |
|
|
875 | |
| 869 | if ($displayMode eq "HTML_dpng") { |
876 | if ($displayMode eq "HTML_dpng") { |
| 870 | return $options{HTML_tth} |
877 | return $options{HTML_tth} |
| 871 | if defined( $options{HTML_tth} ); |
878 | if defined( $options{HTML_tth} ); |
| 872 | return $options{HTML} |
879 | return $options{HTML} |
| 873 | if defined( $options{HTML} ); |
880 | if defined( $options{HTML} ); |
| … | |
… | |
| 875 | |
882 | |
| 876 | } |
883 | } |
| 877 | |
884 | |
| 878 | # trap undefined errors |
885 | # trap undefined errors |
| 879 | die "ERROR in defining MODES: Can't find |$displayMode| among |
886 | die "ERROR in defining MODES: Can't find |$displayMode| among |
| 880 | available options:" . join(" ", keys(%options) ) |
887 | available options:" . join(" ", keys(%options) ) |
| 881 | . " file " . __FILE__ ." line " . __LINE__."\n\n"; |
888 | . " file " . __FILE__ ." line " . __LINE__."\n\n"; |
| 882 | |
889 | |
| 883 | } |
890 | } |
| 884 | |
891 | |
| 885 | |
892 | |
| … | |
… | |
| 911 | $BBOLD BBOLD() begin bold typeface |
918 | $BBOLD BBOLD() begin bold typeface |
| 912 | $EBOLD EBOLD() end bold typeface |
919 | $EBOLD EBOLD() end bold typeface |
| 913 | $BITALIC BITALIC() begin italic typeface |
920 | $BITALIC BITALIC() begin italic typeface |
| 914 | $EITALIC EITALIC() end italic typeface |
921 | $EITALIC EITALIC() end italic typeface |
| 915 | $BCENTER BCENTER() begin centered environment |
922 | $BCENTER BCENTER() begin centered environment |
| 916 | $ECENTER ECENTER() end centered environment |
923 | $ECENTER ECENTER() end centered environment |
| 917 | $HR HR() horizontal rule |
924 | $HR HR() horizontal rule |
| 918 | $LBRACE LBRACE() left brace |
925 | $LBRACE LBRACE() left brace |
| 919 | $LB LB () left brace |
926 | $LB LB () left brace |
| 920 | $RBRACE RBRACE() right brace |
927 | $RBRACE RBRACE() right brace |
| 921 | $RB RB () right brace |
928 | $RB RB () right brace |
| … | |
… | |
| 1181 | $in; |
1188 | $in; |
| 1182 | } |
1189 | } |
| 1183 | |
1190 | |
| 1184 | sub math_ev3 { |
1191 | sub math_ev3 { |
| 1185 | my $in = shift; |
1192 | my $in = shift; |
|
|
1193 | $in = FEQ($in); |
|
|
1194 | $in =~ s/%/\\%/g; |
| 1186 | return general_math_ev3($in, "inline"); |
1195 | return general_math_ev3($in, "inline"); |
| 1187 | } |
1196 | } |
| 1188 | |
1197 | |
| 1189 | sub display_math_ev3 { |
1198 | sub display_math_ev3 { |
| 1190 | my $in = shift; |
1199 | my $in = shift; |
| 1191 | return general_math_ev3($in, "display"); |
1200 | return general_math_ev3($in, "display"); |
| 1192 | } |
1201 | } |
| 1193 | |
|
|
| 1194 | |
1202 | |
| 1195 | sub general_math_ev3 { |
1203 | sub general_math_ev3 { |
| 1196 | my $in = shift; |
1204 | my $in = shift; |
| 1197 | my $mode = shift || "inline"; |
1205 | my $mode = shift || "inline"; |
| 1198 | |
1206 | |
| … | |
… | |
| 1216 | } else { # Maybe we don't have to do anything! |
1224 | } else { # Maybe we don't have to do anything! |
| 1217 | $out = $in_delim; |
1225 | $out = $in_delim; |
| 1218 | } |
1226 | } |
| 1219 | return $out; |
1227 | return $out; |
| 1220 | } |
1228 | } |
| 1221 | |
1229 | # sub general_math_ev3 { |
|
|
1230 | # my $in = shift; |
|
|
1231 | # my $mode = shift || "inline"; |
|
|
1232 | # |
|
|
1233 | # $in = FEQ($in); |
|
|
1234 | # $in =~ s/%/\\%/g; |
|
|
1235 | # my $in_delim; |
|
|
1236 | # |
|
|
1237 | # if($mode eq "inline") { |
|
|
1238 | # $in_delim = "\\($in\\)"; |
|
|
1239 | # } else { # assuming displayed math |
|
|
1240 | # $in_delim = "\\[$in\\]"; |
|
|
1241 | # } |
|
|
1242 | # |
|
|
1243 | # my $out; |
|
|
1244 | # if ($displayMode eq "HTML_tth") { |
|
|
1245 | # $in = "\\($in\\)" if $mode eq "inline"; |
|
|
1246 | # $in = "\\[$in\\]" if $mode eq "display"; |
|
|
1247 | # $out = tth($in); |
|
|
1248 | # } elsif ($displayMode eq "HTML_img") { |
|
|
1249 | # $out = math2img($in, $mode); |
|
|
1250 | # } else { |
|
|
1251 | # $out = "\\($in\\)" if $mode eq "inline"; |
|
|
1252 | # $out = "\\[$in\\]" if $mode eq "display"; |
|
|
1253 | # } |
|
|
1254 | # return $out; |
|
|
1255 | # } |
| 1222 | |
1256 | |
| 1223 | sub EV2 { |
1257 | sub EV2 { |
| 1224 | my $string = join(" ",@_); |
1258 | my $string = join(" ",@_); |
| 1225 | # evaluate code inside of \{ \} (no nesting allowed) |
1259 | # evaluate code inside of \{ \} (no nesting allowed) |
| 1226 | $string = ev_substring($string,"\\{","\\}",\&old_safe_ev); |
1260 | $string = ev_substring($string,"\\{","\\}",\&old_safe_ev); |
| … | |
… | |
| 1400 | my @out = keys %temp; # sort is causing trouble with Safe.?? |
1434 | my @out = keys %temp; # sort is causing trouble with Safe.?? |
| 1401 | @out; |
1435 | @out; |
| 1402 | } |
1436 | } |
| 1403 | |
1437 | |
| 1404 | sub lex_sort { |
1438 | sub lex_sort { |
| 1405 | PGsort sub {$_[0] cmp $_[1]}, @_; |
1439 | PGsort sub {$_[0] cmp $_[1]}, @_; |
| 1406 | } |
1440 | } |
| 1407 | sub num_sort { |
1441 | sub num_sort { |
| 1408 | PGsort sub {$_[0] <=> $_[1]}, @_; |
1442 | PGsort sub {$_[0] <=> $_[1]}, @_; |
| 1409 | } |
1443 | } |
| 1410 | |
1444 | |
| … | |
… | |
| 1444 | $out .= "\n\\par\\smallskip\\begin{center}\\begin{tabular}{" . "|c" x $number . "|} \\hline\n"; |
1478 | $out .= "\n\\par\\smallskip\\begin{center}\\begin{tabular}{" . "|c" x $number . "|} \\hline\n"; |
| 1445 | } |
1479 | } |
| 1446 | elsif ($displayMode eq 'Latex2HTML') { |
1480 | elsif ($displayMode eq 'Latex2HTML') { |
| 1447 | $out .= "\n\\begin{rawhtml} <TABLE , BORDER=1>\n\\end{rawhtml}"; |
1481 | $out .= "\n\\begin{rawhtml} <TABLE , BORDER=1>\n\\end{rawhtml}"; |
| 1448 | } |
1482 | } |
| 1449 | elsif ($displayMode eq 'HTML' || $displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng') { |
1483 | elsif ($displayMode eq 'HTML' || $displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng' || $displayMode eq 'HTML_img') { |
| 1450 | $out .= "<TABLE BORDER=1>\n" |
1484 | $out .= "<TABLE BORDER=1>\n" |
| 1451 | } |
1485 | } |
| 1452 | else { |
1486 | else { |
| 1453 | $out = "Error: PGchoicemacros: begintable: Unknown displayMode: $displayMode.\n"; |
1487 | $out = "Error: PGchoicemacros: begintable: Unknown displayMode: $displayMode.\n"; |
| 1454 | } |
1488 | } |
| 1455 | $out; |
1489 | $out; |
| 1456 | } |
1490 | } |
| 1457 | |
1491 | |
| … | |
… | |
| 1461 | $out .= "\n\\end {tabular}\\end{center}\\par\\smallskip\n"; |
1495 | $out .= "\n\\end {tabular}\\end{center}\\par\\smallskip\n"; |
| 1462 | } |
1496 | } |
| 1463 | elsif ($displayMode eq 'Latex2HTML') { |
1497 | elsif ($displayMode eq 'Latex2HTML') { |
| 1464 | $out .= "\n\\begin{rawhtml} </TABLE >\n\\end{rawhtml}"; |
1498 | $out .= "\n\\begin{rawhtml} </TABLE >\n\\end{rawhtml}"; |
| 1465 | } |
1499 | } |
| 1466 | elsif ($displayMode eq 'HTML' || $displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng') { |
1500 | elsif ($displayMode eq 'HTML' || $displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng' ||$displayMode eq 'HTML_img') { |
| 1467 | $out .= "</TABLE>\n"; |
1501 | $out .= "</TABLE>\n"; |
| 1468 | } |
1502 | } |
| 1469 | else { |
1503 | else { |
| 1470 | $out = "Error: PGchoicemacros: endtable: Unknown displayMode: $displayMode.\n"; |
1504 | $out = "Error: PGchoicemacros: endtable: Unknown displayMode: $displayMode.\n"; |
| 1471 | } |
1505 | } |
| … | |
… | |
| 1489 | while (@elements) { |
1523 | while (@elements) { |
| 1490 | $out .= " \n\\begin{rawhtml}\n<TD> \n\\end{rawhtml}\n" . shift(@elements) . " \n\\begin{rawhtml}\n</TD> \n\\end{rawhtml}\n"; |
1524 | $out .= " \n\\begin{rawhtml}\n<TD> \n\\end{rawhtml}\n" . shift(@elements) . " \n\\begin{rawhtml}\n</TD> \n\\end{rawhtml}\n"; |
| 1491 | } |
1525 | } |
| 1492 | $out .= " \n\\begin{rawhtml}\n</TR> \n\\end{rawhtml}\n"; |
1526 | $out .= " \n\\begin{rawhtml}\n</TR> \n\\end{rawhtml}\n"; |
| 1493 | } |
1527 | } |
| 1494 | elsif ($main::displayMode eq 'HTML' || $main::displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng') { |
1528 | elsif ($main::displayMode eq 'HTML' || $main::displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng'||$displayMode eq 'HTML_img') { |
| 1495 | $out .= "<TR>\n"; |
1529 | $out .= "<TR>\n"; |
| 1496 | while (@elements) { |
1530 | while (@elements) { |
| 1497 | $out .= "<TD>" . shift(@elements) . "</TD>"; |
1531 | $out .= "<TD>" . shift(@elements) . "</TD>"; |
| 1498 | } |
1532 | } |
| 1499 | $out .= "\n</TR>\n"; |
1533 | $out .= "\n</TR>\n"; |
| … | |
… | |
| 1517 | =cut |
1551 | =cut |
| 1518 | |
1552 | |
| 1519 | # More advanced macros |
1553 | # More advanced macros |
| 1520 | sub image { |
1554 | sub image { |
| 1521 | my $image_ref = shift; |
1555 | my $image_ref = shift; |
| 1522 | my @opt = @_; |
1556 | my @opt = @_; |
| 1523 | unless (scalar(@opt) % 2 == 0 ) { |
1557 | unless (scalar(@opt) % 2 == 0 ) { |
| 1524 | warn "ERROR in image macro. A list of macros must be inclosed in square brackets."; |
1558 | warn "ERROR in image macro. A list of macros must be inclosed in square brackets."; |
| 1525 | } |
1559 | } |
| 1526 | my %in_options = @opt; |
1560 | my %in_options = @opt; |
| 1527 | my %known_options = ( width => 100, |
1561 | my %known_options = ( |
| 1528 | height => 100, |
1562 | width => 100, |
| 1529 | tex_size => 800 |
1563 | height => 100, |
| 1530 | ); |
1564 | tex_size => 800, |
|
|
1565 | ); |
| 1531 | # # handle options |
1566 | # handle options |
| 1532 | my %out_options = %known_options; |
1567 | my %out_options = %known_options; |
| 1533 | foreach my $opt_name (keys %in_options) { |
1568 | foreach my $opt_name (keys %in_options) { |
| 1534 | if ( exists( $known_options{$opt_name} ) ) { |
1569 | if ( exists( $known_options{$opt_name} ) ) { |
| 1535 | $out_options{$opt_name} = $in_options{$opt_name} if exists( $in_options{$opt_name} ) ; |
1570 | $out_options{$opt_name} = $in_options{$opt_name} if exists( $in_options{$opt_name} ) ; |
| 1536 | } else { |
1571 | } else { |
| 1537 | die "Option $opt_name not defined for image. " . |
1572 | die "Option $opt_name not defined for image. " . |
| 1538 | "Default options are:<BR> ", display_options2(%known_options); |
1573 | "Default options are:<BR> ", display_options2(%known_options); |
| 1539 | |
|
|
| 1540 | } |
1574 | } |
|
|
1575 | } |
|
|
1576 | my $width = $out_options{width}; |
|
|
1577 | my $height = $out_options{height}; |
|
|
1578 | my $tex_size = $out_options{tex_size}; |
|
|
1579 | my $width_ratio = $tex_size*(.001); |
|
|
1580 | my @image_list = (); |
|
|
1581 | |
|
|
1582 | if (ref($image_ref) =~ /ARRAY/ ) { |
|
|
1583 | @image_list = @{$image_ref}; |
|
|
1584 | } else { |
|
|
1585 | push(@image_list,$image_ref); |
| 1541 | } |
1586 | } |
| 1542 | my $width = $out_options{width}; |
1587 | |
| 1543 | my $height = $out_options{height}; |
|
|
| 1544 | my $tex_size = $out_options{tex_size}; |
|
|
| 1545 | my $width_ratio = $tex_size*(.001); |
|
|
| 1546 | my @image_list = (); |
|
|
| 1547 | |
|
|
| 1548 | if (ref($image_ref) =~ /ARRAY/ ) { |
|
|
| 1549 | @image_list = @{$image_ref}; |
|
|
| 1550 | } else { |
|
|
| 1551 | push(@image_list,$image_ref); |
|
|
| 1552 | } |
|
|
| 1553 | my @output_list = (); |
1588 | my @output_list = (); |
| 1554 | while(@image_list) { |
1589 | while(@image_list) { |
| 1555 | |
1590 | #warn "image_list[0]: $image_list[0]\n"; |
| 1556 | my $imageURL = alias(shift @image_list); |
1591 | my $imageURL = alias(shift @image_list); |
| 1557 | my $out=""; |
1592 | my $out=""; |
| 1558 | |
1593 | |
| 1559 | |
1594 | |
| 1560 | if ($main::displayMode eq 'TeX') { |
1595 | if ($main::displayMode eq 'TeX') { |
|
|
1596 | my $imagePath = $imageURL; # in TeX mode, alias gives us a path, not a URL |
|
|
1597 | if ($envir{texDisposition} eq "pdf") { |
|
|
1598 | # We're going to create PDF files with our TeX (using pdflatex), so |
|
|
1599 | # alias should have given us the path to a PNG image. What we need |
|
|
1600 | # to do is find out the dimmensions of this image, since pdflatex |
|
|
1601 | # is too dumb to live. |
|
|
1602 | |
|
|
1603 | #my ($height, $width) = getImageDimmensions($imagePath); |
|
|
1604 | ##warn "&image: $imagePath $height $width\n"; |
|
|
1605 | #unless ($height and $width) { |
|
|
1606 | # warn "Couldn't get the dimmensions of image $imagePath.\n" |
|
|
1607 | #} |
|
|
1608 | #$out = "\\includegraphics[bb=0 0 $height $width,width=$width_ratio\\linewidth]{$imagePath}\n"; |
| 1561 | $out = qq!\\includegraphics[width=$width_ratio\\linewidth]{$imageURL}\n ! |
1609 | $out = "\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}\n"; |
|
|
1610 | } else { |
|
|
1611 | # Since we're not creating PDF files, alias should have given us the |
|
|
1612 | # path to an EPS file. latex can get its dimmensions no problem! |
|
|
1613 | |
|
|
1614 | $out = "\\includegraphics[width=$width_ratio\\linewidth]{$imagePath}\n"; |
| 1562 | } |
1615 | } |
| 1563 | elsif ($main::displayMode eq 'Latex2HTML') { |
1616 | } elsif ($main::displayMode eq 'Latex2HTML') { |
| 1564 | $out = qq!\\begin{rawhtml}\n<A HREF= "$imageURL" TARGET="ZOOM"><IMG SRC="$imageURL" WIDTH="$width" HEIGHT="$height"></A>\n |
1617 | $out = qq!\\begin{rawhtml}\n<A HREF= "$imageURL" TARGET="ZOOM"><IMG SRC="$imageURL" WIDTH="$width" HEIGHT="$height"></A>\n |
| 1565 | \\end{rawhtml}\n ! |
1618 | \\end{rawhtml}\n ! |
| 1566 | } |
|
|
| 1567 | elsif ($main::displayMode eq 'HTML' || $main::displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng') { |
1619 | } elsif ($main::displayMode eq 'HTML' || $main::displayMode eq 'HTML_tth' || $displayMode eq 'HTML_dpng' || $displayMode eq 'HTML_img') { |
|
|
1620 | |
| 1568 | $out = qq!<A HREF= "$imageURL" TARGET="ZOOM"><IMG SRC="$imageURL" WIDTH="$width" HEIGHT="$height"></A> |
1621 | $out = qq!<A HREF= "$imageURL" TARGET="ZOOM"><IMG SRC="$imageURL" WIDTH="$width" HEIGHT="$height"></A> |
| 1569 | ! |
1622 | ! |
| 1570 | } |
|
|
| 1571 | else { |
1623 | } else { |
| 1572 | $out = "Error: PGchoicemacros: image: Unknown displayMode: $main::displayMode.\n"; |
1624 | $out = "Error: PGchoicemacros: image: Unknown displayMode: $main::displayMode.\n"; |
| 1573 | } |
1625 | } |
| 1574 | push(@output_list, $out); |
1626 | push(@output_list, $out); |
| 1575 | } |
1627 | } |
| 1576 | wantarray ? @output_list : $output_list[0] ; |
1628 | return wantarray ? @output_list : $output_list[0]; |
| 1577 | } |
1629 | } |
| 1578 | |
|
|
| 1579 | # This is legacy code. |
1630 | # This is legacy code. |
| 1580 | sub images { |
1631 | sub images { |
| 1581 | my @in = @_; |
1632 | my @in = @_; |
| 1582 | my @outlist = (); |
1633 | my @outlist = (); |
| 1583 | while (@in) { |
1634 | while (@in) { |
| … | |
… | |
| 1591 | my ($out) = @_; |
1642 | my ($out) = @_; |
| 1592 | $out = " $out \n" if $main::displayMode eq 'TeX'; |
1643 | $out = " $out \n" if $main::displayMode eq 'TeX'; |
| 1593 | $out = " $out " if $main::displayMode eq 'HTML'; |
1644 | $out = " $out " if $main::displayMode eq 'HTML'; |
| 1594 | $out = " $out " if $main::displayMode eq 'HTML_tth'; |
1645 | $out = " $out " if $main::displayMode eq 'HTML_tth'; |
| 1595 | $out = " $out " if $main::displayMode eq 'HTML_dpng'; |
1646 | $out = " $out " if $main::displayMode eq 'HTML_dpng'; |
|
|
1647 | $out = " $out " if $main::displayMode eq 'HTML_img'; |
| 1596 | $out = " $out " if $main::displayMode eq 'Latex2HTML'; |
1648 | $out = " $out " if $main::displayMode eq 'Latex2HTML'; |
| 1597 | $out; |
1649 | $out; |
| 1598 | } |
1650 | } |
| 1599 | |
1651 | |
| 1600 | sub captions { |
1652 | sub captions { |
| … | |
… | |
| 1646 | $out .= "\n\\begin{rawhtml} <TH>\n\\end{rawhtml}\n".&caption( shift(@captions) ) |
1698 | $out .= "\n\\begin{rawhtml} <TH>\n\\end{rawhtml}\n".&caption( shift(@captions) ) |
| 1647 | . "\n\\begin{rawhtml} </TH>\n\\end{rawhtml}\n" ; |
1699 | . "\n\\begin{rawhtml} </TH>\n\\end{rawhtml}\n" ; |
| 1648 | } |
1700 | } |
| 1649 | |
1701 | |
| 1650 | $out .= "\n\\begin{rawhtml} </TR> </TABLE >\n\\end{rawhtml}"; |
1702 | $out .= "\n\\begin{rawhtml} </TR> </TABLE >\n\\end{rawhtml}"; |
| 1651 | } elsif ($main::displayMode eq 'HTML' || $main::displayMode eq 'HTML_tth' || $main::displayMode eq 'HTML_dpng'){ |
1703 | } elsif ($main::displayMode eq 'HTML' || $main::displayMode eq 'HTML_tth' || $main::displayMode eq 'HTML_dpng'|| $main::displayMode eq 'HTML_img'){ |
| 1652 | $out .= "<P>\n <TABLE BORDER=2 CELLPADDING=3 CELLSPACING=2 ><TR ALIGN=CENTER VALIGN=MIDDLE>\n"; |
1704 | $out .= "<P>\n <TABLE BORDER=2 CELLPADDING=3 CELLSPACING=2 ><TR ALIGN=CENTER VALIGN=MIDDLE>\n"; |
| 1653 | while (@images) { |
1705 | while (@images) { |
| 1654 | $out .= " \n<TD>". &image( shift(@images),%options ) ."</TD>"; |
1706 | $out .= " \n<TD>". &image( shift(@images),%options ) ."</TD>"; |
| 1655 | } |
1707 | } |
| 1656 | $out .= "</TR>\n<TR>"; |
1708 | $out .= "</TR>\n<TR>"; |