[pstricks] Where to place definitions in raw postscript

Christoph Bersch usenet at bersch.net
Tue Feb 8 10:44:52 CET 2005


Hi!

What is the best (right) place to put definitions and calculations in
raw postscript (both in 'normal' documents and in own packages)?
As I'm writing my first package for PSTricks I experienced some problems
with this.
The following code does _not_ work. I get errors when viewing the
ps-file with gv

%--------------------------------------
\documentclass{article}
\usepackage{pst-node,pst-plot}
\begin{document}
\begin{pspicture}(5,5)
\SpecialCoor
\psline(!%
        /testvar 1.5 def
        0 testvar)%
       (! testvar testvar)
\end{pspicture}
\end{document}
%---------------------------------------

The error is:

Error: /undefined in testvar
Operand stack:
   --nostringval--
[...]

But the following code works:
%---------------------------------------
\documentclass{article}
\usepackage{pst-node,pst-plot}
\begin{document}
\begin{pspicture}(5,5)
\SpecialCoor
\pnode(!%
      /testvar 1.5 def
      0 testvar){nodeA}
\pnode(! testvar testvar){nodeB}
\psline(nodeA)(nodeB)
\end{pspicture}
\end{document}
%---------------------------------------

So what is the problem with the first document in contrast to the
second? Isn't it possible to use postscript definitions with \psline or
are there some stupid errors I am making?

Thanks for help
Christoph




More information about the PSTricks mailing list