[pstricks] Including Postscript calculations in documents

Jay Bloodworth jbloodworth at sc.rr.com
Sun Jul 29 16:34:08 CEST 2001


I am trying to write some macros to draw and label various parts of
geometric figures given information about the figures side lengths and
angles.  For example, TriangleSSS{3}{4}{5} would draw a 3-4-5 right
triangle.

Drawing the figures has not been a problem; using \SpecialCoor I can
insert the postscript that does the appropriate algebra right in the
coordinate specifiers.  The problem is that I need to use some of these
calculated values as labels.

I know that there is no way for postscript to pass a value back to tex.
So how do I get at these calculations.  I know that in theory I can do
them in tex, but I don't think I have the patience to write tex code to
do fixed point trig.  My other thought was that since I've got my
calculated value sitting right there on the top of the stack, I can just
do a show to paint it using raw postscript.  This works, but the output
does not follow the current pstricks paramaters and tex-generated output
doesn't flow around it.  I guess what I asking is given a value on the
top of the stack, can someone give me postscript code to display the
value using current parameters and in proper relation to the tex-based
material around it.

E.G.

Hi, I am \pscustom{\code{13 2 mul <pscode>}} years old

should display

Hi, I am 26 years old

in the current font, color, etc.  It is not imperative that spacing be
perfect (with kerning, etc.), just reasonable.

Any help would be appreciated.

Jay




More information about the PSTricks mailing list