[pstricks] Newbie question on how to create an own object

Herbert Voss LaTeX at zedat.fu-berlin.de
Sat Dec 2 20:14:24 CET 2006


Seweryn Kokot schrieb:

> I'm very impressed with the quality of graphics and vast possibilities of
> pstricks. I'm wondering if I could create a library of specific objects which I
> use frequently. For example I would like to type command e.g. \psmyobject(x,y)
> instead of a group of lines, triangles and cicrles which constitue the object
> and (x,y) points to the upper corner of the triangle.
> 
> How to start with it?

it is called a high level object and the different packages
create a lot of it, eg \psGaus from package pst-func;

\define at key[psset]{pst-func}{sigma}{\def\psk at sigma{#1 }}
\define at key[psset]{pst-func}{mue}{\def\psk at mue{#1 }}
\psset[pst-func]{sigma=0.5,mue=0}
%
\def\psGauss{\@ifnextchar[{\psGauss at i}{\psGauss at i[]}}
\def\psGauss at i[#1]#2#3{{%
     \pst at killglue%
     \psset{plotpoints=200}%
     \psset{#1}%
     \psplot{#2}{#3}{%
         Euler x \psk at mue sub dup mul 2 div \psk at sigma dup mul div neg exp
         1.0 \psk at sigma div TwoPi sqrt div mul%
     }%
}\ignorespaces}


Herbert



More information about the PSTricks mailing list