[pstricks] \pstVerb scope
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Thu Jan 17 11:29:51 CET 2008
Michelle Baert schrieb:
> My pst-erd project is well progressing.
>
> I renamed things (tell me if there could be a conflict):
>
> --
> % ------- Crow's Foot Arrowheads names
> % on - zero or more: ring and crow's foot
> % in - one or more: dash and crow's foot
> % oi - zero or one : ring and dash
> % ii - exactly one : dash and dash
> \edef\pst at arrowtable{\pst at arrowtable,no-on,ni-in,io-oi,ii-ii}
>
> \psset at crowarrowsize{2pt 5}
> \psset at crowarrowlength{10}
> \psset at crowarrowinset{.4}
for _new_ packages you should use the pst-xkey syntax, e.g.:
\define at key[psset]{pst-erd}{crowarrowsize}{%
\pst at expandafter\pst at getdimnum{#1} 0 {} {}\@nil
\edef\psk at crowarrowsize{\pst at number\pst at dimg \pst at tempg}}
\psset{crowarrowsize=2pt 5}
\define at key[psset]{pst-erd}{crowarrowlength}{\pst at checknum{#1}\psk at arrowlength}
\psset{crowarrowlength=10}
> When I use \pstVerb to include this ps code defining subroutines,
> it works fine on first document page it is used, but then I get
> ghostscript /undefined error.
> Debugging the ps file produced by latex, it looks like all definitions I
> made in \pstVerb block where cleared when starting a new page (maybe at
> @endspecial ?). What's wrong ?
>
> I could avoid this problem when replacing the \pstVerb block with
> \pstheader{pst-erd.pro}. Is it the right way to do it ?
yes, that makes always sense, when you have some
real PostScript procedures.
> Looking at section 8 of pst-code.pdf, and page 2 of "Inside PSTricks",
> I'd think the most portable way would be to use \ps at def, but:
>
> When defined with ps at def{routine}, ps code is, on my system, replicated
> in ps output for each invocation of tx at routine . I'd prefer
> to have a tx at routine ps procedure defined, but I don't know how to do
> this, without modifying pstricks distribution itself.
your pst-erd.pro:
/tx at erdDict 10 dict def % reserves space for 10 definitions
tx at erdDict begin
/PSfunc { ... } def
/Another ... def
end
and then in your TeX file
....
\addto at pscode{
...
tx at erdDict begin PSfunc ... Another ... end
...
}
Herbert
More information about the PSTricks
mailing list