[pstricks] programming style of simple macro

Patrick Drechsler patrick at pdrechsler.de
Tue Oct 23 20:43:53 CEST 2007

Hi Herbert,

thanks for the tutorial! This has cleared up most issues. I do have a
couple of followup questions on your code (see below).

Herbert Voss <Herbert.Voss at fu-berlin.de> writes:


> \makeatletter
> \pst at addfams{pst-new}%
> \define at key[psset]{pst-new}{offset}{\pst at getlength{#1}\PstWall at offset}%
> \define at key[psset]{pst-new}{thickness}{\pst at getlength{#1}\PstWall at thickness}%
> \define at key[psset]{pst-new}{MyWidth}{\pst at getlength{#1}\PstWall at MyWidth}%
> \define at key[psset]{pst-new}{MyAngle}{\pst at getangle{#1}\PstWall at MyAngle}%
> \psset[pst-new]{offset=0pt,thickness=0.5,MyAngle=0,MyWidth=1}%
> \def\PstWall{\pst at object{PstWall}}%read star/options, continue with @i
> \def\PstWall at i(#1)#2{{%
>   \pst at killglue
>   \addbefore at par{linewidth=4pt}% allows overwriting by the user
>   \use at par%				 set options
>   \rput{\PstWall at MyAngle}(#1){%
>     \psset{unit=1pt}%		     local setting

Why is this line not necessary when using objects such as

>     \psframe[linestyle=none,fillstyle=hlines]%
> (\PstWall at offset,-\PstWall at MyWidth)(\PstWall at thickness,\PstWall at MyWidth)
>     \psline(\PstWall at offset,-\PstWall at MyWidth)%
>        (\PstWall at offset pt,\PstWall at MyWidth)%
>     \ifx#2\pst at empty\else

What is the difference between "\pst at empty" and "\empty"?

>       \rput*[C]{90}(!
>         \PstWall at thickness .5 mul \pst at number\pslinewidth add

I figure that "\pst at number" converts a dimension/length to an
integer. Is this correct? What other commands are there for conversion
(i.e. int2length)?


Is something like this covered in detail in the current version of
your book? I only have the first edition, but I saw that the fourth
edition has twice as many pages. In the first edition these subjects
are covered too briefly for me to comprehend the full meaning.

Thanks again for your help,


More information about the PSTricks mailing list