| 1 | ################################################################################ |
1 | ################################################################################ |
| 2 | # WeBWorK Online Homework Delivery System |
2 | # WeBWorK Online Homework Delivery System |
| 3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
3 | # Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ |
| 4 | # $CVSHeader: webwork2/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.173 2005/07/05 18:20:24 sh002i Exp $ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/Problem.pm,v 1.174 2005/07/05 18:56:07 sh002i Exp $ |
| 5 | # |
5 | # |
| 6 | # This program is free software; you can redistribute it and/or modify it under |
6 | # This program is free software; you can redistribute it and/or modify it under |
| 7 | # the terms of either: (a) the GNU General Public License as published by the |
7 | # the terms of either: (a) the GNU General Public License as published by the |
| 8 | # Free Software Foundation; either version 2, or (at your option) any later |
8 | # Free Software Foundation; either version 2, or (at your option) any later |
| 9 | # version, or (b) the "Artistic License" which comes with this package. |
9 | # version, or (b) the "Artistic License" which comes with this package. |
| … | |
… | |
| 317 | } |
317 | } |
| 318 | } |
318 | } |
| 319 | |
319 | |
| 320 | # construct TTH command line |
320 | # construct TTH command line |
| 321 | my $tthCommand = $ce->{externalPrograms}->{tth} |
321 | my $tthCommand = $ce->{externalPrograms}->{tth} |
| 322 | . " -L -f5 -r 2> /dev/null <<END_OF_INPUT; echo > /dev/null\n" |
322 | . " -L -f5 -u -r 2> /dev/null <<END_OF_INPUT; echo > /dev/null\n" |
| 323 | . $tthPreamble . "\\(" . $tex . "\\)\n" |
323 | . $tthPreamble . "\\[" . $tex . "\\]\n" |
| 324 | . "END_OF_INPUT\n"; |
324 | . "END_OF_INPUT\n"; |
| 325 | |
325 | |
| 326 | # call tth |
326 | # call tth |
| 327 | my $result = `$tthCommand`; |
327 | my $result = `$tthCommand`; |
| 328 | if ($?) { |
328 | if ($?) { |
| 329 | return "<b>[tth failed: $? $@]</b>"; |
329 | return "<b>[tth failed: $? $@]</b>"; |
| 330 | } else { |
330 | } else { |
|
|
331 | # avoid border problems in tables and remove unneeded initial <br> |
|
|
332 | $result =~ s/(<table [^>]*)>/$1 CLASS="ArrayLayout">/gi; |
|
|
333 | $result =~ s!\s*<br clear="all" />!!; |
| 331 | return $result; |
334 | return $result; |
| 332 | } |
335 | } |
| 333 | |
336 | |
| 334 | } elsif ($displayMode eq "images") { |
337 | } elsif ($displayMode eq "images") { |
| 335 | $imgGen->add($tex); |
338 | $imgGen->add($tex); |