# How to divide a line or a curve into n equal pieces and tick it using PSTricks

When we draw \psaxes they initially have ticks and there's an option which lets us to omit them. I'm trying to put some ticks on my \pscurve, I was wondering is there a way to divide a line or a curve into n (e.g., 12) equal pieces and put a tick for them? As we do for the axes.

\documentclass{article}

‎\usepackage{pstricks‎ , ‎pst-plot}‎
‎\usepackage{pst-bezier}‎
‎\usepackage{pst-math}‎

\begin{document}

‎\psset{xunit=0.5cm,yunit=0.5cm}‎‎‎
‎\centering‎
‎\begin{pspicture}(8,8)‎
‎\psaxes[labels=none,ticks=none]{->}(0,0)(8,8)[$x$,0][$y$,0]‎‎
‎\pscurve{-}(1,1)(3,4)(6,6)(8,4)‎‎% want to devide this curve into 6 equal pieces and putting a tick on each
‎\end{pspicture}‎‎

\end{document}


this is what I get While I want to have something like this : • Sample code please! Give the wizards something to work with. – qubyte Feb 9 '12 at 10:09
• I added to code – Prelude Feb 9 '12 at 10:17
• calculating distance along a parametric curve requires calculus, so the answer to your question is going to be dependent on the curve and whether you can differentiate the expressions symbolically or numerically (and is likely to be hard either way:-). – David Carlisle Feb 9 '12 at 10:28
• @DavidCarlisle: we have PostScript and the flattenpath function. The reason why we do not need something to calculate – user2478 Feb 9 '12 at 11:15

## 1 Answer

With the current versions of pstricks.tex and pstricks.pro you can do something like:

\documentclass{article}
\usepackage{pst-plot}

\begin{document}

\psset{unit=0.5cm}
\begin{pspicture}(9,8)
\psaxes[labels=none,ticks=none]{->}(0,0)(8,8)[$x$,0][$y$,0]
\pscurve(1,1)(3,4)(6,6)(8,4)
\pscurve[linestyle=symbol,symbolStep=11.6pt,% must be positive
curveticks,startAngle=60](1,1)(3,4)(6,6)(8,4)
\end{pspicture}
\begin{pspicture}(8,8)
\psaxes[labels=none,ticks=none]{->}(0,0)(8,8)[$x$,0][$y$,0]
\pscurve[linestyle=symbol,symbolStep=-12,% must be negative !
curveticks,startAngle=60](1,1)(3,4)(6,6)(8,4)
\end{pspicture}

\end{document} The left image has the ticks placed with a fixed width and the right one with a calculated width given by the number of ticks. The first tick is placed by the value of startAngle because we cannot calculate the slope for the first point.

For more informations read the file pst-news12.pdf all available in the next few days with the TeXLive update manager or already at http://texnik.dante.de

Instead of plotting a curve by coordinates one can also plot a function:

\documentclass{article}
\usepackage{pst-plot}
\begin{document}

\psset{unit=0.5cm}
\begin{pspicture}(0,-4)(15,5)
\psaxes[labels=none,ticks=none]{->}(0,0)(0,-4)(14.5,4.5)[$x$,0][$y$,0]
\psplot[algebraic,plotstyle=curve,linestyle=symbol,
curveticks,symbolStep=8pt]{0}{14}{ 1.75*(sin(x)+2*cos(x)^2) }
\end{pspicture}

\end{document} • Are those shapes (dot,triangle,etc) all we can have as symbols or is there a way to change the dots ticks ? – Prelude Feb 9 '12 at 10:54
• as I wrote, read the doc: run texdoc pst-news10 – user2478 Feb 9 '12 at 11:13
• I'll upload a solution with tick marks on the curve at afternoon – user2478 Feb 9 '12 at 11:23
• @Negin: I updated my answer. – user2478 Feb 9 '12 at 15:34
• I am interested to know whether it is very hard in TikZ. – kiss my armpit Feb 9 '12 at 15:48