# What is the PSTricks equivalent for 'control' in Tikz?

\documentclass[tikz,border=5mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
%==================
\begin{tikzpicture}[scale=1, font=\footnotesize, line join=round, line cap=round, >=stealth]
\draw[->] (-0.5,0) -- (4,0) node[below] {$x$};
\draw[->] (0,-2) -- (0,3) node[left] {$y$};
\draw($(0,0)$)node[below left]{$O$};

\draw[blue] (-95:0.8)+(0,-1)..controls +(85:8) and +(-100:5)..(2,1)
..controls +(-70:1) and +(-110:0.5)..(3,2)
..controls +(-80:1) and +(95:0.5)..(3.4,-0.8)node[right]{$y=f'(x)$};

\draw[dashed] (2,0)node[below]{$2$}|-(0,1)node[left]{$1$};
\draw[dashed] (3,0)node[below]{$3$}|-(0,2)node[left]{$2$};
\draw[dashed] (0,-1)node[left]{$-1$};
\end{tikzpicture}
\end{document}


P/s: I need a official way which will be used in the future.

• It is \psbezier*[par]{arrows}(x0,y0)(x1,y1)(x2,y2)(x3,y3). – user121799 May 16 at 1:46

There is no direct way to translate such kind of coordinates, but it can be done on PostScript level with the ! operator! However, it makes no sense to plot a derivation of a function with bezier curves. PSTricks uses cubic splines but can also use other types. For a derivation one should use the optional argument Derive from pstricks-add or plot the derivation of a polynomial stepwise:

\documentclass[pstricks,border=5mm]{standalone}
\usepackage{pst-plot}
\begin{document}

\begin{pspicture*}[showgrid](-1,-2)(4,3)
\psaxes[labels=none]{->}(0,0)(-1,-2)(4,3)
\psplot[algebraic]{-0.1}{2}{3*(x-0.1)*(x-1.2)*(x-1.75)}
\psplot[algebraic]{2}{3}{3*(x-2.4)^2+0.7}
\pscurve(3,1.8)(3.3,0)(3.4,-1)
\end{pspicture*}

\end{document}


However, the plot from TikZ uses the curve procedure from pdf which has another behaviour than the one from PSTricks.

\documentclass[pstricks,border=5mm]{standalone}
\usepackage{pst-plot}
\begin{document}

\begin{pspicture}[showgrid](-1,-2)(4,3)
\psaxes[labels=none]{->}(0,0)(-1,-2)(4,3)
\makeatletter
\psbezier(!0.8 -95 PtoC 1 sub)%
(!2 copy \tx@UserCoor 8 85 PtoC addCoors)%
(!2 copy \tx@UserCoor 5 -100 PtoC addCoors)%
(2,1)%
(!2 copy \tx@UserCoor 1 -70 PtoC addCoors)%
(!2 copy \tx@UserCoor 0.5 -110 PtoC addCoors)%
(3,2)
(!2 copy \tx@UserCoor 1 -80 PtoC addCoors)%
(!2 copy \tx@UserCoor 0.5 95 PtoC addCoors)%
(3.4,-0.8)
\end{pspicture}

\end{document}


• the plot from TikZ uses the curve procedure from pdf which has another behaviour than the one from PSTricks. The reason is "PostScript language different with TikZ language", isn't it? – user173875 May 16 at 11:19
• no, PDF is a subset of PostScript with some more new features. Only with PostScript we can do any additional calculations before using a function, PDF can't. – user187802 May 16 at 11:33
• Since the command control into " some more new features " so PSTricks hasn't it ? – user173875 May 16 at 11:45
• TikZ is a package and PSTricks is a package. The first creates by default PDF code, PSTricks creates by default PS code, which then can be converted into PDF. control is a special TikZ keyword for the \draw macro. PSTricks has a special macro \psbezier which do not need the keyword because the second and third pair of coordinates are by default the control points for a Bezier curve. – user187802 May 16 at 12:11
• the Bezier curve definitions of PostScript and the one of PDF are not the same! – user187802 May 16 at 12:58

These are Bezier curves and they are implemented in pstricks via \psbezier, see p. 20 of the manual:

So far, so good. However, to the best of my knowledge neither automatic parsing of coordinates nor the +(x,y) syntax is implemented in pstricks. That is, there is no straightforward translation of your code to pstricks. Just to show that when quickly estimating the coordinates by hand one obtains a similar plot.

\documentclass[pstricks]{standalone}
\begin{document}
\begin{pspicture}(-1,-2)(4,3)
\psline{->}(-0.5,0)(4,0)
\psline{->}(0,-2)(0,3)
\psbezier[linecolor=blue](-0.05,0.2)(0.3,6.7)(-0.2,-4.7)(2,1)
\end{pspicture}
\end{document}


As you can see, I had no passion to employ \pscalculate to compute the coordinates more precisely nor to add several explicit \rputs, but if you have that passion you will be able to convert your picture to pstricks.

• It doesn't look like the picture of OP. – minhthien_2016 May 16 at 2:33
• @minhthien_2016 Yes, the picture is from the manual. – user121799 May 16 at 2:34