# What transformation do I have to apply to a node before passing it to \uput as a direction angle?

Consider the following code

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-node}
\usepackage{pgfmath}% don't forget this line!
\psset{saveNodeCoors}
\degrees[13]
\begin{document}
\makeatletter
\begin{pspicture}(-4,-4)(4,4)
\foreach \i [count=\j from 0] in {A,2,3,4,5,6,7,8,9,T,J,Q,K}
{
\pnodes(!3 \j\space neg \pst@angleunit 90 add PtoC){X\i}
\qdisk(X\i){2pt}
\uput[!N-X\i.y N-X\i.x atan 1 \pst@angleunit div](X\i){\i}
%\uput[(X\i)](X\i){\i}
%\uput[!\psGetNodeCenter{X\i} X\i.y X\i.x atan 1 \pst@angleunit div](X\i){\i}
}
\end{pspicture}
\makeatother
\end{document}


with the following output.

But if I use either

\uput[(X\i)](X\i){\i}
\uput[!\psGetNodeCenter{X\i} X\i.y X\i.x atan 1 \pst@angleunit div](X\i){\i}


I got the following incorrect output.

According to Herbert's response several decades ago (I don't know exactly where in this site), the pairs (N-<node>.x and N-<node>.y) and (<node>.x and <node>.y) have different transformation matrices.

The question is what transformation matrix do I have to apply to X\i node before passing it to \uput as the direction angle such that I get the same correct result?

## Update

When the center of the circle is not at the origin, unfortunately \uput[(NODE)](>NODE){contents} no longer works.

\documentclass[pstricks,border=20pt]{standalone}
\usepackage{pst-node,pst-plot}
\pstVerb{/XX 3 def /YY 4 def}

\degrees[12]

\makeatletter
\def\object#1{%
\begin{pspicture}[saveNodeCoors,showgrid](0,1)(6,7)
\pnode(!XX YY){P}
\pscircle(!XX YY){2}
\curvepnodes[plotpoints=13]{0}{12}{2 t \pst@angleunit PtoC YY add exch XX add exch}{R}
\multido{\i=0+1}{\Rnodecount}
{%
\pstVerb
{
/ALPHA {\i\space} def
%/ALPHA {N-R\i.y N-P.y sub N-R\i.x N-P.x sub atan 1 \pst@angleunit div} def
%/ALPHA {\psGetNodeCenter{R\i}\psGetNodeCenter{P} R\i.y P.y sub R\i.x P.x sub atan 1 \pst@angleunit div} def % IT CANNOT BE USED!
%/BETA {ALPHA 90 1 \pst@angleunit div sub} def
/BETA {\i\space 90 1 \pst@angleunit div sub} def
}%
\ifcase#1
\psset{linecolor=red}
\uput[\i]{!BETA}(R\i){$R_{\i}$}
\or
\psset{linecolor=green}
\uput[!ALPHA]{!BETA}(R\i){$R_{\i}$}
\or
\psset{linecolor=blue}
\uput[(R\i)]{!BETA}(>R\i){$R_{\i}$}
\fi
\psline(!XX YY)(R\i)
}
\end{pspicture}}
\makeatother

\begin{document}
\foreach \x in {0,...,2}{\object{\x}}
\end{document}


case 0

case 1

case 2

• I cannot sleep without knowing the solution of this legacy problem. – kiss my armpit Jan 19 '14 at 4:19
• How can you award a 500 point bounty while having only 67 points? – Ingo Jan 22 '14 at 17:26
• @Ingo: Because I still have about 10000 points but nobody knows. – kiss my armpit Jan 23 '14 at 0:15

The desired behavior is achieved with the prefix > for the position node, i.e. using \uput[(X\x)](>X\x){\x}:

\documentclass[pstricks,margin=12pt]{standalone}
\usepackage{pst-node}
\usepackage{pgfmath}
\degrees[13]
\begin{document}
\makeatletter
\begin{pspicture}(-4,-4)(4,4)
\foreach \x [count=\xi from 0] in {A,2,3,4,5,6,7,8,9,T,J,Q,K}
{
\pnodes(!3 \xi\space neg \pst@angleunit 90 add PtoC){X\x}
\qdisk(X\x){2pt}
\uput[(X\x)](>X\x){\x}
}
\end{pspicture}
\makeatother
\end{document}


This is equivalent to the third version with

\uput[!\psGetNodeCenter{X\x} X\x.y X\x.x Atan 1 \pst@angleunit div](>X\x){\x}


Seems like this syntax was introduced exactly for this kind of \uput behavior, see texdoc pst-news10.

• How about the third version? – kiss my armpit Mar 3 '14 at 23:25
• See my edit. As you said in the question: \uput[(X\x)] is equivalent to \uput[!\psGetnodeCenter{X\x}.... – Christoph Mar 3 '14 at 23:31
• Please kindly revisit my question update, apparently >Node syntax does not work for center that is not the origin. – kiss my armpit Aug 1 '14 at 22:32
\documentclass[pstricks,margin=12pt]{standalone}
\usepackage{pst-node}
\degrees[13]
\begin{document}

\begin{pspicture}(-4,-4)(4,4)
\psforeach{\x}{A,2,3,4,5,6,7,8,9,T,J,Q,K}{%
\pnode(3;\the\psLoopIndex){X\x}
\qdisk(X\x){2pt}
\nput[labelsep=12pt]{(X\x)}{X\x}{\red\x}
\pcline[linestyle=none](0,0)(X\x)\ncput[npos=0.7,nrot=:R]{\x}
\nput[labelsep=-15pt,rot=\the\psLoopIndex]{\the\psLoopIndex}{X\x}{\green\x}
\uput{20pt}[\the\psLoopIndex](X\x){\blue\x}
\psline[linestyle=dotted](3;\the\psLoopIndex)
}

\end{pspicture}
\end{document}


• Sorry, I think your code is only for rotations about the origin. Could you make it more general in which the center of rotation is not at the origin (0,0)? – kiss my armpit Aug 2 '14 at 8:14
• There are two rotating angles: \nput[rot=<origin>]{<rotate around node>}{<nodename>}{<text>} – user2478 Aug 2 '14 at 9:13