# How do we explain the behavior of \rput, \psGetNodeCenter and saveNodeCoors?

## Introduction

I am writing a tutorial on a short introduction to PSTricks for newbies. I got obstacles to explain how a node A (for example), \rput, (!\psGetNodeCenter{A} A.x A.y) and (!N-A.x N-A.y) work by design.

I have read the pst-node documentation as shown below.

And the following is taken from page 35-36:

The manual says:

• The transformation matrix will be reset by \psGetNodeCenter.
• (!N-A.x N-A.y) is not affected by \rput.

Even though I read it many times, I still get confused. The statements are too short.

## Problem

Please consider the following figure for the remaining discussion.

• Case 1

A node A is defined outside \rput and a dot is translated by \rput.

• with (!\psGetNodeCenter{A} A.x A.y)

\pnode(2,2){A}
\rput(1,1){\psdots(!\psGetNodeCenter{A} A.x A.y)}

• with (!N-A.x N-A.y)

\pnode(2,2){A}
\rput(1,1){\psdots(!N-A.x N-A.y)}


The results are different. \rput only affects (!N-A.x N-A.y).

• Case 2

A node A is defined inside \rput and a dot is translated by \rput.

• with (!\psGetNodeCenter{A} A.x A.y)

\rput(1,1){\pnode(2,2){A}\psdots(!\psGetNodeCenter{A} A.x A.y)}

• with (!N-A.x N-A.y)

\rput(1,1){\pnode(2,2){A}\psdots(!N-A.x N-A.y)}


The results are identical. \rput affects both.

• Case 3

A node A is defined inside \rput and a dot is defined outside \rput.

• with (!\psGetNodeCenter{A} A.x A.y)

 \rput(1,1){\pnode(2,2){A}}
\psdots(!\psGetNodeCenter{A} A.x A.y)

• with (!N-A.x N-A.y)

 \rput(1,1){\pnode(2,2){A}}
\psdots(!N-A.x N-A.y)


The results are different. \rput only affects (!\psGetNodeCenter{A} A.x A.y).

The MWE is given as follows.

\documentclass[margin=12pt]{standalone}
\usepackage{pst-node}
\psset{saveNodeCoors,linecolor=red}
\everypsbox{\color{blue}}
\begin{document}

\begin{psmatrix}
\begin{pspicture}[showgrid=bottom](3,3)
\rput(1,1){Case 1-A}
\pnode(2,2){A}
\rput(1,1){\psdots(!\psGetNodeCenter{A} A.x A.y)}
\end{pspicture}
&
\begin{pspicture}[showgrid=bottom](3,3)
\rput(1,1){Case 1-B}
\pnode(2,2){A}
\rput(1,1){\psdots(!N-A.x N-A.y)}
\end{pspicture}
\\
% case 2
\begin{pspicture}[showgrid=bottom](3,3)
\rput(1,1){Case 2-A}
\rput(1,1){\pnode(2,2){A}\psdots(!\psGetNodeCenter{A} A.x A.y)}
\end{pspicture}
&
\begin{pspicture}[showgrid=bottom](3,3)
\rput(1,1){Case 2-B}
\rput(1,1){\pnode(2,2){A}\psdots(!N-A.x N-A.y)}
\end{pspicture}
\\
% case 3
\begin{pspicture}[showgrid=bottom](3,3)
\rput(1,1){Case 3-A}
\rput(1,1){\pnode(2,2){A}}
\psdots(!\psGetNodeCenter{A} A.x A.y)
\end{pspicture}
&
\begin{pspicture}[showgrid=bottom](3,3)
\rput(1,1){Case 3-B}
\rput(1,1){\pnode(2,2){A}}
\psdots(!N-A.x N-A.y)
\end{pspicture}
\end{psmatrix}
\end{document}


## Question

How do I have to explain their behaviors to the newbies as the statements in the documentation seem to be unclear?

Note: As (!\psGetNodeCenter{A} A.x A.y) is identical to (A), (A) will not be discussed here.

If you are a teacher, how do you explain it to your students?

-
although i cannot comment on pstricks being a newbie to pstricks. I am very happy to hear that your are writing short intro to pstricks. It would be very interesting. all the best. –  texenthusiast Mar 17 at 6:17
@Herbert, where are you? :-) –  Daniel Mar 20 at 20:05