[pstricks] Saving and Reusing x-coordinate alone?

Alan Ristow ristow at ece.gatech.edu
Wed Mar 21 14:08:44 CET 2007


In-Sung Cho wrote:
> Hi,
> 
> Can we extract one coordinate, say the x-coordinate, alone from (x,y)
> or (x,y,z)?
> 
> For example:
> \psIntersectionPoint(-5,-1)(5,5)(-5,3)(!2 sqrt 5){IP}
> 
> I am looking for some way or trick to save the x-coordinate of (IP)
> and reuse it like \psdot(x-coordinate of A, 1) or print its value.

Try something like this:

\pstVerb{/myxcoordinate 2 sqrt def}
\psIntersectionPoint(-5,-1)(5,5)(-5,3)(!myxcoordinate 5}{IP}
\psdot(!myxcoordinate 1)

I haven't tested this particular code, but I regularly use \pstVerb in a 
similar manner with other pstricks commands (mostly \psplot). It might 
need some tweaking, but I suspect you can make it work. You cannot print 
the value using this syntax, though -- for that, you'd have to compute 
the x-coordinate in TeX. If that's important to you, the fp package 
might be helpful.

Alan



More information about the PSTricks mailing list