[pstricks] programming style of simple macro

Patrick Drechsler patrick at pdrechsler.de
Thu Oct 25 18:16:50 CEST 2007


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

> Patrick Drechsler schrieb:
>> On a side note: Understanding the difference between "\edef" and
>> "\def" will take up a lot of time, which is why I will postpone that
>> task...
>
> \def is the correct one, because \edef can make things weired,
> e.g. when using an expandable macro in the argument.
>
>>>> Why is this line not necessary when using objects such as
>>>> open/closed/special/alt?
>>> you are on TeX level, the reason why you have to tell TeX, that
>>> we have all lengths as pt. When writing a macro on low level,
>>> then you can use these lengths directly.
>> 
>> Understood. Is there a reason *not* to use a macro
>> open/closed/special/alt to avoid this problem? In other words: Would I
>> not be on the save side always using one of these macros?
>
> In general: so-called hih level macros use already defined PSTricks
> macros and no PostScript code.
> so-called low-level macros will have commands like \addto at pscode{...}.
> In such a case you have to initialize this PostScript part and to
> insert linewidth/fillstyle/fillcolor/... on PS-level. This all
> is done by the open/closed/special/alt macros.
>
> Open: checks for arrows/filling/double lines/shadows
> Closed: checks not for arrows but for filling/double lines/shadows
> Special: no check for arrows/filling/double lines/shadows
> AltOpen: special arrows/linetype setting (more internally)
>
>>> \pst at number converts every length with a unit (a dimen) into
>>> an integer (strips the unit), the value then refers to pt.
>> 
>> OK. Before asking if there is something like "\pst at ConvertNumberToDim"
>
> this is alreday done by \pst at getlength{...}. The argument can have
> a unit or not, then it takes the current one. pstricks-add also
> has some more macros for reading lengths or values.
>
>> I am trying to write a package. Are there things I should be aware of
>> when using pst-xkey/xkeyval? Are there any tutorials on the usage of
>> xkeyval other than "texdoc xkeyval"?
>
> for PSTricks it should be ok, when looking at another package or
> reading the section in the book. I never read the documentation
> of xkeyval ... :-)

Thanks again for explaining these details in such length! I should be
set for now.

Cheers,

Patrick 
-- 
Either this man is dead or my watch has stopped.
			-- Groucho Marx




More information about the PSTricks mailing list