[pstricks] Where to place definitions in raw postscript

Jacques L'helgoualc'h lhh+nospam at free.fr
Tue Feb 8 12:02:38 CET 2005


Christoph Bersch a écrit, mardi 8 février 2005, à 10:44 :
> Hi!

Hi!

> [...] 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:
> [...]
> Isn't it possible to use postscript definitions with \psline or
> are there some stupid errors I am making?

\psline computes points from right to left:

\documentclass{article}
\usepackage{pst-node,pst-plot}
\begin{document}
\begin{pspicture}(2,2)
\SpecialCoor
\psgrid
\psline[showpoints=true,linecolor=green]{->}%
(! testvar testvar)
(!%
  /testvar 2.0 def
  testvar 0)
(! testvar testvar)
(!%
  /testvar 1.0 def
  0 testvar)
\end{pspicture}
\end{document}

-- 
Jacques L'helgoualc'h




More information about the PSTricks mailing list