Please consider \pstVerb{/#2 \csname#2\endcsname\space def}
in the following code snippet.
\newcommand\const[3][3]{%
\edef\next{round(#3}%
\expandafter\FPeval\csname#2\expandafter\endcsname
\expandafter{\next:#1)}%
\pstVerb{/#2 \csname#2\endcsname\space def}%
}
Its purpose is to define a constant for expressions written in RPN notation.
My complete code below
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\usepackage[nomessages]{fp}
\newcommand\const[3][3]{%
\edef\next{round(#3}%
\expandafter\FPeval\csname#2\expandafter\endcsname
\expandafter{\next:#1)}%
\pstVerb{/#2 \csname#2\endcsname\space def}%
}
\const{Vox}{2}
\const{Xo}{1}
\const{Voy}{4}
\const{Yo}{10}
\const{G}{10}
\def\X(#1){Xo+Vox*#1}
\def\Y(#1){Yo+Voy*#1-0.5*G*#1^2}
\const{Tp}{Voy/G}
\const{Toffset}{0.5}
\const{Tf}{2*Tp+Toffset}
\const{Xp}{\X(Tp)}
\const{Yp}{\Y(Tp)}
\const{Xf}{\X(Tf)}
\const{Yf}{\Y(Tf)}
\usepackage{fourier}
\begin{document}
\begin{pspicture}(0,\Yp)(\Xf,\Yf)
\psframe*[linecolor=lightgray](0,\Yf)(\Xo,\Yo)
\psparametricplot[algebraic,linecolor=red,linestyle=dashed]{0}{\Tf}{\X(t)|\Y(t)}
\rput[B]{45}(\Xp,\Yp){\bomb}
\end{pspicture}
\end{document}
use \psparametricplot[algebraic,linecolor=red,linestyle=dashed]{0}{\Tf}{\X(t)|\Y(t)}
with algebraic
option. As you can see there is no expressions written in RPN notation.
However, if I disable \pstVerb{/#2 \csname#2\endcsname\space def}
(by commenting it with %
), the compilation successes in latex
and dvips
phases but fails in ps2pdf
phase with
Error: /undefined in Xo
... <other errors go here but omitted for brevity> ....
I am using algebraic
option but why must I specify some constants that are only needed for expressions written in RPN?