[pstricks] Nodes and \rput

Herbert Voss Herbert.Voss at FU-Berlin.DE
Sun Mar 29 09:18:07 CEST 2009


Michael Sharpe schrieb:
> \rput doesn't seem to translate positions involving nodes. For example,
> 
> \begin{pspicture}(6,6)
> \pnode(1,1){P}
> \rput(2,3){\psline(1,1)}% makes line from (2,3) to (3,4)
> \rput(2,3){\psline(P)}% makes line from (2,3) to (1,1)
> \end{pspicture}

Michael,
http://tug.org/PSTricks/main.cgi?file=pstricks.bug&verb=1
see bug no 4. It cannot be resolved, because

> Is this something that can be changed by evaluating the expression in  
> another way? It doesn't seem to help to replace \psline(P) by  
> \psline(! \psGetNodeCenter{P} P.x P.y).

the argument of \rput works relative to the \rput coordinates,
but nodes are always handled with absolute coordinates.
However, we have PostScript and can provide a workaround :-)

\listfiles
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{pstricks-add}
\makeatletter
\def\rputLine{\pst at object{rputLine}}
\def\rputLine at i(#1,#2)(#3){%
  \begin at SpecialObj
  \psline[linecolor=blue](#1,#2)(!\psGetNodeCenter{P} P.x #1 add P.y #2
add )
  \end at SpecialObj}
\makeatletter

\begin{document}

\begin{pspicture}[showgrid=true](6,6)
\pnode(1,1){P}
\rput(2,3){\psline[linecolor=red](1,1)}
\rputLine[linecolor=blue](2,2)(P)
\end{pspicture}

\end{document}


hope, it helps

Herbert


More information about the PSTricks mailing list