[pstricks] pstVerb

Arnaud Schmittbuhl aschmittbuhl at libertysurf.fr
Sat Apr 21 21:12:27 CEST 2007


Le Sat, 21 Apr 2007 20:36:26 +0200,
"Poul Riis" <Poul.Riis at skolekom.dk> a écrit :

> I'm afraid that I have asked this question before and I'm sorry that
> I've forgotten the answer.
> Is it true that you cannot use pstVerb more than once per page without
> knowing a trick?
> If yes, what is the trick?

Here is your question (27/12/2006) and the Herbert answer

--------

Poul Riis schrieb:
> If I put unit=1mm in the example below there are no problems - all
> figures being on page 1.
>
> However, if I put unit=3mm I can see the first few figures on page 1
> but ghostview denies to show page 2 and comes with a long error
> message. What is wrong?
>
> I would prefer to have just one figure on each page (I'm preparing an
> animation with swifttools) but also when I put a \newpage command
> after each figure ghostview shows page 1 only.
>     
\pstVerb definitions are only valid for one page. Use \pstheader to get
it for all pages (see code). You shouldn't use the % character inside
PS-code
without a space before it, otherwise it causes an error. It worked
as long you have definietions like
/foo bar def%
/baz xxx def%

but

/foo bar def%
foo

is wrong, it is like /foo bar deffoo

Herbert


\documentclass[12pt,a4paper]{article}

\usepackage[svgnames,x11names]{xcolor}
\usepackage{pstricks-add}
\usepackage{multido}

\topmargin=-2cm% using package geometry is a better choice!
\textwidth=17cm
\textheight=25.5cm
\hoffset=-1cm
\parindent=0cm

\begin{filecontents}{pst.pro}
/mk 1.0 def
/ms 2.0 def
/gg 9.82 def
/vv 30 def
/rr 1 def
/mn vv sin dup mul mk mul 5 mul ms 7 mul add mk 2 mul add def
/FF vv sin ms mk add mul mk mul gg mul 2 mul mn div def
/NN vv cos mk 2 mul ms 7 mul add mul mk mul gg mul mn div def
/akx vv sin vv cos mul ms mul gg mul 5 mul mn div def
/aky vv sin dup mul ms mk add mul gg mul 5 mul mn div def
/asx vv sin vv cos mul mk mul gg mul 5 mul mn div neg def
/omegadot vv sin ms mk add mul gg mul 5 mul rr div mn div def
/Ftk mk gg mul def
/rx vv cos rr mul def
/ry vv sin rr mul neg def
/xs0 15 neg def
/ys0 15 vv sin mul vv cos div def
/xk0 xs0 ry sub def
/yk0 ys0 rx add def
\end{filecontents}


\begin{document}
\pstheader{pst.pro}
\pagestyle{empty}
\psset{unit=3mm}
\multido{\n=0+1}{15}{%
\pstVerb{/tt \n\space 5 div def
/dxs tt dup mul asx mul 2 div def
/dxk tt dup mul akx mul 2 div def
/dyk tt dup mul aky mul 2 div def
/dphi tt dup mul omegadot mul 2 div 3.141592 div 180 mul def
/dkrydsx dphi cos rx mul dphi sin ry mul add def
/dkrydsy dphi sin rx mul neg dphi cos ry mul add def
}
\begin{pspicture}(-22.0,-1)(0,11)
\begin{psclip}{\psframe[linecolor=white](-22.0,-1)(0,11)}
\psline[linecolor=Wheat1,linewidth=0.35](-22.0,-0.2)(0,-0.2)
\SpecialCoor
\pscircle*[linecolor=Seashell3,linewidth=1pt](!xk0 dxk add yk0 dyk
sub){1} \pscircle[linecolor=Yellow2,linewidth=1pt](!xk0 dxk add yk0 dyk
sub){1} \psline[linecolor=Green2,linewidth=1pt](!xk0 dxk add dkrydsy
add yk0 dyk sub dkrydsx sub)(!xk0 dxk add dkrydsy sub yk0 dyk sub
dkrydsx add) \psline[linecolor=Green2,linewidth=1pt](!xk0 dxk add
dkrydsx sub yk0 dyk sub dkrydsy sub)(!xk0 dxk add dkrydsx add yk0 dyk
sub dkrydsy add) \NormalCoor
\end{psclip}
\end{pspicture}
\\%%%%%%%%%%%%%%%%%%%%% Here I woul like to put a \newpage command....
}
\end{document}


-- 
Arnaud Schmittbuhl




More information about the PSTricks mailing list