TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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


    /a 2 def
    /bb 1 def
\rput(!a bb){First Page}


My a silently overrides the PSTricks' definition. I need a way to know this silent substitution. Is there a way to know name clashes in PostScript level between ones used in PSTricks packages and our own definitions?

share|improve this question
up vote 8 down vote accepted

I suppose the correct thing to do is always make your local definitions in a private dictionary to avoid the problem but this postscript addresses the question as asked:

The sequence

 dup where {pop == (already defined) ==} {3 def} ifelse

will define the preceding token to 3 if it is not defined, and leave it untouched and echo a warning if it is defined.

tested with /a defined to be 2 and /b undefined

GS>/a 2 def
GS>/a dup where {pop == (already defined) ==} {3 def} ifelse
(already defined)
GS>a ==
GS>/b dup where {pop == (already defined) ==} {3 def} ifelse
GS> b ==

a gets left as 2 but b is defined to be 3.

share|improve this answer
Note in the other answer Herbert shows what I noted above is the "correct thing to do" :-) – David Carlisle Sep 6 '12 at 13:26

{  userdict begin
    /a 2 def
    /bb 1 def
  end }
\rput(! userdict begin a bb end){First Page}

share|improve this answer
I used this in my project but I accepted David solution because it conforms to the question. – kiss my armpit Sep 6 '12 at 13:32
Is there a method to avoid repeating userdict begin ... end in each points? – kiss my armpit Sep 6 '12 at 13:53

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.