[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [school-discuss] how to turn addpsx.pl into a subtraction worksheet generator



Jake Maul wrote:
Greetings,
First off, the script I'm referring to can be found here:
http://www.seul.org/edu/packages/addpsx.pl
It generates a 1-page postscript file containing random addition problems. I was easily able to modify it to output multiplication problems:

$t=$a+$b;
ps_digits($a);
ps_digits("+ ".$b);
print "S\n";
# ps_digits($t); # don't print answer
ps_digits(""); # skip a line instead

Just change the "+ " to "x ". However, the same trick does not work with subtraction: substituting in "- " causes errors. Ghostscript viewing reports "undefined in d-", and an actual printout says "ERROR: undefined. OFFENDING COMMAND: d-. STACK: -108".

I've tried various things, such as backslashes before the -, and separating the "- " out into a separate print line (which I thought would work but generate funky output...didn't work, same error). Any ideas?

Jake,

Send me the complete file as you've modified it and I'll put it on the SEUL/edu server as multpsx.pl. I'm no PostScript hacker, but here's a guess: change the "+ " to " - " (a leading space). Maybe that will break the concatenation of "d" and "-" that seems to be being misinterpreted. The error you're seing isn't a Perl error, I'm pretty sure, but one coming from the PostScript interpreter in GhostScript.

--
If this helped you please take the time to rate the value
of this post; just click on the Affero link below.

http://svcs.affero.net/rm.php?r=drloss

Doug Loss Courage is resistance to
Data Network Coordinator fear, mastery of fear --
Bloomsburg University not absence of fear.
dloss@bloomu.edu Mark Twain