[pstricks] pstVerb

Poul Riis Poul.Riis at skolekom.dk
Sun Apr 22 18:02:48 CEST 2007


Oh, thank you!

But this time I cannot find out how to solve my problem.
The example below works (even if it is a bit messy). However, if I
uncomment the \newpage command in line 29 ghostview gives an error
message. Well, the \newpage might be silly here but I simply cannot find
out when it works and when it doesn't. I would like to understand what
happens (if it's not just a stupid error such as a missing { but latex
doesn't complain).

Yours,
Poul Riis


\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}%
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage[svgnames,dvipsnames,x11names]{xcolor}
\usepackage{pst-node,pst-eucl}
\usepackage{pstricks-add}
\usepackage{pst-func}
\usepackage{geometry}
\usepackage{graphicx}
\usepackage[hang,small,it]{caption2}
\usepackage{multido}


\newcommand{\plotgraphwithoneparameter}[8]{%
\pstVerb{/#3 #4 def /f {dup dup mul neg 1 add exch #4 add dup mul mul}
def}%
\psset{linecolor=#8}%
\psplot[plotpoints=100]{#1}{#2}{x f}%
\pnode(!#5 #5 f){Q}%
\rput[tr](!#5 #6 add #5 f #7
add){\rnode{P}{\color{#8}\psframebox[linecolor=#8]{$\beta=#4$}}}%{\psframebox{C=\C}}
\ncarc[nodesep=1pt,linecolor=#8]{->}{P}{Q}%
}

\pagestyle{plain}

\begin{document}
One figure with several curves...
%\newpage
\begin{figure}[!ht]
\psset{unit=2cm}
\begin{center}
\begin{pspicture}(-1.1,-0.25)(1.1,1.1)
\psaxes[axesstyle=axes,tickwidth=0.2pt,subtickwidth=0.1pt,labels=none,xticksize=0
1, yticksize=-1
1,subticks=5,xsubticksize=1,ysubticksize=1]{->}(0,0)(-1.0,0.0)(1.2,1.2)
\psaxes[axesstyle=axes,labels=all,xticksize=0 0,yticksize=0
0]{->}(0,0)(-1.0,0.0)(1.2,1.2)
\plotgraphwithoneparameter{-1}{1}{beta}{0.1}{0.8}{0.8}{0.5}{red}%
\plotgraphwithoneparameter{-1}{1}{beta}{0.2}{0.6}{0.4}{0.7}{green}%
\plotgraphwithoneparameter{-1}{1}{beta}{0.3}{0.3}{-0.4}{0.5}{blue}
\end{pspicture}
\end{center}
\caption{....}
\end{figure}
One of the curves in more detail below:\\
\begin{figure}[!ht]
\psset{unit=6cm}
\begin{center}
\begin{pspicture}(-1.1,-0.25)(1.1,0.45)
\psaxes[axesstyle=axes,tickwidth=0.2pt,subtickwidth=0.1pt,labels=none,xticksize=0
0.4, yticksize=-1
1,subticks=5,xsubticksize=1,ysubticksize=1]{->}(0,0)(-1.0,0.0)(1.1,0.45)
\psaxes[axesstyle=axes,Dx=0.5,Dy=0.2,labels=all,xticksize=0 0,yticksize=0
0]{->}(0,0)(-1.0,0.0)(1.1,0.45)
\psplot[linecolor=Red2,plotpoints=100]{-1}{1}{x dup mul neg 1 add x 0.1
add dup mul mul}
\pstVerb{/beta 0.1 def /xplus beta dup mul 8 add sqrt beta sub 4 div def
/xminus beta dup mul 8 add sqrt neg beta sub 4 div def /ff{dup dup mul neg
1 add exch beta add dup mul mul} def /alphap xplus ff def /alpham xminus
ff def}%
\psset{linecolor=Orange}
\color{Orange}
\psline(!xplus 0)(!xplus alphap)(!0 alphap)
\uput{1mm}[180](!0 alphap){$\alpha_+$}
\uput{1mm}[270](!xplus 0){$x_+$}
\psline(!xminus 0)(!xminus alpham)(!0 alpham)
\uput{1mm}[0](!0 alpham){$\alpha_-$}
\uput{1mm}[270](!xminus 0){$x_-$}
\uput{1mm}[270](!beta neg 0){$-\beta$}
\color{black}
\uput{2mm}[90](!1.1 0){$x$}
\uput{2mm}[0](!0 0.425){$f(x)$}
\end{pspicture}
\end{center}
\caption{....}
\end{figure}

\end{document}

-------------- next part --------------


###########################################
Denne meddelelse med evt. vedlagte filer er scannet af SkoleKoms F-Secure virusscanner.

For yderligere information,
http://forside.skolekom.dk/indhold/punkt1/viruspolitik


More information about the PSTricks mailing list