TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The following MWE is the simplified version of the real scenario. I want to simplify (!\psGetNodeCenter{A}\psGetNodeCenter{B} A.x B.x add A.y B.y add) to (!A B AddNode). Is it possible?

    % convert nodes A B to a new node C where C.x=A.x+B.x and C.y=A.y+B.y
    /AddNode {} bind def

    \pnode(!\psGetNodeCenter{A}\psGetNodeCenter{B} A.x B.x add A.y B.y add){C}
    %\pnode(!A B AddNode){C}
share|improve this question
up vote 4 down vote accepted

In general the answer is no. The (! ) construction introduces literal postscript, and in your suggested syntax A is inserted on to the stack unquoted, so you risk this already being defined as e.g. a variable with another value or a function trying to operate on something.

pst-node.tex, used by pstricks for defining and maniulating nodes, stores node names in the dictionary tx@NodeDict, with e.g. node A stored in /N@A. If you are prepared to work hard you could write postscript code that would take the string (A) and extract the coordinates via GetCenter, enabling to have syntax like (!(A) (B) AddNode). However, it is unclear to me when this could win over just defining a LaTeX command

  #1.x #2.x add #1.y #2.y add){#3}}

and simply using


The pst-node code does all its interfacing to postscript in this sort of way, using tex to build the names N@A etc. before postscript ever sees them.

share|improve this answer
In general: nodes are saved on PS side the reason why it is possible! – Herbert Aug 12 '12 at 15:25
Indeed, as I say they are stored in the PS side in tx@NodeDict as /N@A etc. The problem is the requested syntax, without quoting of the tex version of the node names. – Andrew Swann Aug 14 '12 at 9:36
\pnode(! /A /B AddNode){C} would be easy to realize – Herbert Aug 14 '12 at 9:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.