[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



hello,

define subtraction in larrydef : 

/Larrydict 21 dict def
Larrydict begin
/R {currentpoint stroke moveto
  dup stringwidth pop neg 0 rmoveto show } def
/L {exch dup F exch moveto exch R -$vskip add} bind def
/S {$vskip2 add newpath dup F -$hlsize add exch moveto
                   dup F exch lineto stroke -$vskip3 add} bind def
/LF {dup F -$dwidth add exch moveto} bind def
/CR {-$vskip add} bind def
/A {gsave show grestore -$dwidth 0 rmoveto} bind def
/d0 {(0)A} bind def
/d1 {(1)A} bind def
/d2 {(2)A} bind def
/d3 {(3)A} bind def
/d4 {(4)A} bind def
/d5 {(5)A} bind def
/d6 {(6)A} bind def
/d7 {(7)A} bind def
/d8 {(8)A} bind def
/d9 {(9)A} bind def
/dx {(x)A} bind def
/d+ {(+)A} bind def
/d- {(-)A} bind def 
/dA {( )A} bind def
end

On Monday 13 January 2003 07:49 pm, 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?
>
> Thanks,
> Jake Maul
> Paradise Valley Unified School Dist.
> Phoenix, AZ

-- 
(http://www.etc-edu.com ) Not just an afterthought ...