From 3ca859b7c25a23c6fa253978191197782df3d799 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 12 Jun 2010 00:11:41 +0000 Subject: pstricks-add 3.40 (11jun10) git-svn-id: svn://tug.org/texlive/trunk@18900 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/pstricks-add/Changes | 9 +- .../doc/generic/pstricks-add/pstricks-add-doc.pdf | Bin 1674528 -> 1757547 bytes .../doc/generic/pstricks-add/pstricks-add-doc.tex | 373 ++++++++++++++++++++- .../texmf-dist/dvips/pstricks-add/pstricks-add.pro | 3 +- .../source/generic/pstricks-add/Makefile | 1 - .../tex/generic/pstricks-add/pstricks-add.tex | 158 ++++++++- .../tex/latex/pstricks-add/pstricks-add.sty | 2 +- Master/tlpkg/libexec/ctan2tds | 1 + 8 files changed, 517 insertions(+), 30 deletions(-) diff --git a/Master/texmf-dist/doc/generic/pstricks-add/Changes b/Master/texmf-dist/doc/generic/pstricks-add/Changes index 5d2e60bd6e1..ed170bb49aa 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/Changes +++ b/Master/texmf-dist/doc/generic/pstricks-add/Changes @@ -1,4 +1,4 @@ -%% $Id: Changes 259 2010-01-17 09:51:50Z herbert $ +%% $Id: Changes 345 2010-06-10 16:07:44Z herbert $ %% pstricks-add.pro ----------- 0.23 2009-12-20 - add RGBtoGRAY and WavelengthToGRAY @@ -39,6 +39,7 @@ pstricks-add.sty ----------- (hv) pstricks-add.tex ----------- (Dominik Rodriguez/hv) + v 3.40 2010-03-12 - add macros for ticks on curves (ms) v 3.39 2010-03-12 - fixed bug with algebraic option in \psplotTangent v 3.38 2009-12-13 - moved \Pst@algebraic into the base pstricks.tex - add SAveFinalState for plots @@ -250,9 +251,3 @@ pstricks-add.tex ----------- (Dominik Rodriguez/hv) v 2.17 2004-10-14 new multiple arrows -pst-fp.tex ----------- (hv) - v 0.05 2010-01-17 add \pst@Int - add \pst@int - v 0.04 2009-11-24 add \pstFPadd - v 0.03 2009-11-14 add \pstFPmul - v 0.02 2009-04-02 initial version diff --git a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf index f1ae117aca7..2934d0dd2f2 100644 Binary files a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf and b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.pdf differ diff --git a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex index 40c4a4df325..9b2809aba56 100644 --- a/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex +++ b/Master/texmf-dist/doc/generic/pstricks-add/pstricks-add-doc.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add-doc.tex 298 2010-03-13 08:46:53Z herbert $ +%% $Id: pstricks-add-doc.tex 345 2010-06-10 16:07:44Z herbert $ \documentclass[11pt,english,BCOR10mm,DIV12,bibliography=totoc,parskip=false,smallheadings headexclude,footexclude,oneside]{pst-doc} \listfiles @@ -47,15 +47,10 @@ \end{pspicture}} \begin{document} -\title{\texttt{pstricks-add}\\additionals Macros for \texttt{pstricks}% -%\thanks{% -% This document was written with \texttt{Kile: 1.7 (Qt: 3.1.1; KDE: 3.3;} -% \url{http://sourceforge.net/projects/kile/}) and the PDF output -% was build with VTeX/Free (\url{http://www.micropress-inc.com/linux})} -\\ +\title{\texttt{pstricks-add}\\additionals Macros for \texttt{pstricks}\\ \small v.\pstricksaddFV} -\docauthor{Herbert Vo\ss} -\author{Dominique Rodriguez\\Herbert Vo\ss} +%\docauthor{Herbert Vo\ss} +\author{Dominique Rodriguez\\Michael Sharpe\\Herbert Vo\ss} \date{\today} \maketitle @@ -1729,7 +1724,7 @@ Impossible to draw, but let's try! \clearpage -\subsection{A really complecated function} +\subsection{A really complicated function} Just appreciate the difference between the normal behavior and the plotting with the \Lkeyword{varStep} option. The function is: @@ -1783,7 +1778,7 @@ Just appreciate the difference between the normal behavior and the plotting with \clearpage -\subsection{Using \nxLcs{parametricplot}} +\subsection{Using \nxLcs{psparametricplot}} \begin{BDef} \Lcs{parametricplot}\OptArgs\Largb{t0}\Largb{t1}\OptArg{PS commands}\Largb{x(t) y(t)} @@ -3266,7 +3261,7 @@ matrix data, which is saved as /dotmatrix [...] in the file \LFile{pstricks-add- \end{LTXexample} \egroup - +\clearpage %-------------------------------------------------------------------------------------- \section{Dashed Lines} %-------------------------------------------------------------------------------------- @@ -4034,11 +4029,363 @@ taken into account by the scaling value. +\section{Ticks and other marks along a curve} +\subsection{Quick overview} + +The macros described below allow you to place tick and other marks along an arbitrary +parametric curve with placement rules similar to those used by \Lcs{psaxes} in +the \LPack{pst-plot} package. You have to define a metric function along the curve to +govern tick placement. That function can be a specified function of {\tt x,y} which +should increase along the curve, or it can be an function whose increment is a specified +positive function of {\tt x, y, dx, dy, ds} where the last term is the arc-length element +that you could specify alternately as {\tt dx dup mul dy dup mul add sqrt}. +% start new material +In addition, a new command \Lcs{Put} is proposed, expanding as necessary to \Lcs{rput} or \Lcs{uput}. Its syntax is + +\begin{BDef} +\LcsStar{Put}\OptArgs\Largb{}\Largr{}\Largb{} +\end{BDef} +where the optional {\tt *} blanks the background, the optional \OptArgs\ may be used to specify a +rotation (eg, \Lkeyword{rot}=45), and \Lkeyword{ref} takes one of two forms: (a) a {\tt refpt} +such as {tt Bl}, in which case \Lcs{rput} is called; (b) a polar form of offset (eg, +\verb|7pt;30|, or \verb|;(P)| in which \Ldim{pslabelsep} is substituted for the radius), +in which case \Lcs{uput} is called. + + +\subsection{Details} +Suppose you have drawn a parametric curve using \Lcs{psparametricplot}, and you wish to +indicate some points on the curve using tick-marks like those on the axes. This is a +two-step process, the first of which serves to define at the PostScript level a +number of data arrays containing information about the curve. Those arrays are used +in the second step to compute tick positions and draw the ticks. The first step is +to run the macro \Lcs{pscurvepoints}. For example, + +\begin{verbatim} +\pscurvepoints[plotpoints=20]{0}{6}{t t t mul 12 div}{Pt}% +\end{verbatim} +makes a virtual (ie, data only---nothing is rendered) polyline with 20 vertices approximating +the curve $x(t)=t, y(t)=t^2/12$, $0\le t\le 6$. The last argument {\tt Pt} is the root name +given to the data arrays. PostScript arrays will be created with the following names: {\tt Pt.X, Pt.Y} +for the coordinates of the vertices, {\tt PtDelta.X, PtDelta.Y} for the increments between the +vertices (using, eg, {\tt PtDelta.X[2]=Pt.X[2]-Pt.X[1]}) and {\tt PtNormal.X, PtNormal.Y} for +a vector normal to {\tt PtDelta.X, PtDelta.Y} in the visual, not mathematical, sense. +(Both senses are the same if the scales on the axes are identical.) The {\tt Normal} is +always constructed so as to point ``upward'' (ie, to your left) as you traverse the curve +in the positive direction. The PostScript variable {\tt unitratio} provides the ratio of +the unit on the y axis to that on x axis, and {\tt unitratiosq} is its square. All of +these PostScript objects are stored in the main {\tt pstricks} dictionary \Lps{tx@Dict} +which should be automatically made available when using many {\tt pstricks} macros. +If {\tt gs} returns you an error message like +\begin{verbatim} +Error: /undefined in Pt.X +\end{verbatim} +then you may need to enclose the offending PostScript code within a block of the form +\begin{verbatim} +tx@Dict begin ... end +\end{verbatim} +so that the dictionary is made available. + +With this preparation, the main tick-making macro may be run. For example, +\begin{verbatim} +\pspolylineticks{Pt}{ dx dy add 3 div }{1}{2}% +\end{verbatim} +looks for data arrays made using \Lcs{pscurvepoints} with the root name {\tt Pt}. The next argument, +{\tt dx dy add 3 div}, specifies the (PostScript) function of increments that should be used to +construct the metric. If the keyword \verb|metricInitValue| is defined, eg, with +\Lcs{psset}\Largb{\Lkeyword{metricInitValue}=2.5}, it is used as the initial value of the metric, +otherwise it is defined to be 0. In the previous example, the increment function is always +positive, and care should be taken to guarantee this is so or the results will not be meaningful. +(If we wanted to use arc-length, the function would have been {\tt ds}, assuming equal scales on +the axes.) The last two arguments determine the index of the first tick and the number of ticks. +Tick numbering begins with index 0, so the example says to drop the first tick and draw the +next 2 ticks. In this example, where all keywords take their default values, ticks are +potentially located at values on the curve where the metric takes a positive integer value. +In the arc-length example, the tick with index 0 is at the beginning of the curve, and subsequent +ticks are at unit distance, measured along the curve. At each index where a tick is drawn, a +\Lcs{pnode} is created: In this example, you create nodes {\tt PtTick1, PtTick2} on the curve +where the ticks are located. This is handy for placing labels using, eg, \Lcs{Put}. In +addition, PostScript data arrays (in this example, {\tt PtTickN.X, PtTickN.Y} of the normals +at these nodes are stored in the dictionary {\tt TDict}. More importantly, the tangent and +normal vectors at {\tt PtTick0} etc are constructed as nodes with names {\tt PtTangent0, PtNormal0} +etc. See the last example below for typical usage. + +The shape of the ticks is governed by the keywords \Lkeyword{ticksize} (default value {\tt -4pt 4pt}) + and \Lkeyword{tickwidth} (default value \verb|.5\linewidth|.) With the default settings, ticks + are drawn perpendicular the the curve extending {\tt 4pt} to each side. The line +\begin{verbatim} +\pspolylineticks[ticksize=-6pt 6pt]{Pt}{ dx dy add 3 div }{1}{2}% +\end{verbatim} +would draw longer ticks than the default. + +Placement of the ticks is governed by the keywords \Lkeyword{Ds} and \Lkeyword{Os}, whose meaning for the +curve is similar to (but not the same as) the meanings of \Lkeyword{Dx} and \Lkeyword{Ox} with respect to the x axis. +That is, if {\tt Ds=2} and {\tt Os=0}, ticks will be drawn where the metric takes +values 0, 2, 4 and so on. More generally, ticks are placed where the metric takes +value {\tt Os, Os+Ds, Os+2*Ds,...}, as long as those positions are on the curve. If \Lkeyword{Os} +has an empty value as a result, say, of \verb|\psset{Os=}|, then \Lkeyword{Os} is set internally +to the initial metric value. If \Lkeyword{Ds} has an empty value, it is set internally to the +final metric value less the initial metric value, divided by 10. + +To draw major and minor ticks requires two passes---one to draw the minor ticks and then one to draw the major ticks. + +Note that a ticks may be placed at arbitrary metric values on the curve by running the macro once for each point, like: +\begin{verbatim} +\pspolylineticks[ticksize=-6pt 6pt,Os=1.3]{Pt}{ dx dy add 3 div }{0}{1}% +\pspolylineticks[ticksize=-6pt 6pt,Os=2.4]{Pt}{ dx dy add 3 div }{0}{1}% +\end{verbatim} + +You may also dispense entirely with the tick and use the macro to generate a node sequence +that can be used to place other graphic objects. For example: +\begin{verbatim} +\pspolylineticks[ticksize=0pt 0pt]{Pt}{ dx dy add 3 div }{0}{3}% +%This defines nodes PtTick0..PtTick2 +\multido{\iA=0+1}{3}{\psdot(PtTick\iA)} +\end{verbatim} + + +There is another way to define a metric function without using increments. If the keywork \Lkeyword{metricFunction} is set to \true, +then the function you present as an argument to \Lcs{pspolylineticks} must be a function of +$x$ and $y$ only, and must be designed to increase along the curve. It is useful only in +those cases where, in essence, the increment function can be explicitly integrated. +For example, in the elliptical motion of planets and comets around the sun, it is not hard +to integrate the area function explicitly, and this provides a convenient metric, being proportional to time elapsed. + +There is some useful information left in the log by these macros. +They report the starting and ending values of the metric function, +the the range of indices for the Tick related arrays. + +\subsection{Examples} +The examples in this section make use of very recent (as of May, 2010) versions +of \LPack{pstricks} and related packages. +%If the {\tt pst-grapha} package is not available on CTAN, download it from +%\begin{verbatim} +%http://math.ucsd.edu/~msharpe/pst-grapha.dmg +%\end{verbatim} + +The first couple of examples are constructed entirely by hand, and have no interest +other than to illustrate what is going on under the surface in the simplest case. + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4) +\psline[showpoints=true](1,2)(4,0)(9,3)% +\uput[180](1,2){$s=0$}% +\uput[-90](4,0){$s=1$}% +\uput[0](9,3){$s=2$}% +\makeatletter% need to use macro names containing @ +\pstVerb{tx@Dict begin %the pstricks dictionary +% declare arrays of length 3 (indices 0,1,2) to hold points, +% differences and normals +/unitratiosq 1 def % yunit=xunit +/P.X [ 1 4 9 ] def %array of x coords +/P.Y [ 2 0 3 ] def %array of y coords +/PDelta.X [ 0 3 5 ] def % 3=4-1, 5=9-4, 0 never used +/PDelta.Y [ 0 -2 3 ] def % -2=0-2, 3=3-0, 0 never used +% normal to (3,-2) is (2,3), normal to (5,3) is (-3,5) +/PNormal.X [ 2 2 -3 ] def % index 0 =index 1 +/PNormal.Y [ 3 3 5 ] def % index 0 = index 1 +end } +\def\Ppointcount{2} +\makeatother +% make ticks using metric function with values 0,1,2 +\pspolylineticks[Os=.5,Ds=1]{P}{1}{0}{2} +% ticks at s=0.5,1.5 (increment function =1) +\uput[-135](PTick0){$s=0.5$}% +\uput[-45](PTick1){$s=1.5$}% +\end{pspicture} +\end{LTXexample} + +\clearpage +Now the same data, but with arc-length as metric. We change the last few lines: + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4) +\psline[showpoints=true](1,2)(4,0)(9,3)% +%\uput[180](1,2){$s=0$}% +%\uput[-90](4,0){$s=1$}% +%\uput[0](9,3){$s=2$}% +\makeatletter% need to use macro names containing @ +\pstVerb{tx@Dict begin %the pstricks dictionary +% declare arrays of length 3 (indices 0,1,2) to hold points, +% differences and normals +/unitratiosq 1 def % yunit=xunit +/P.X [ 1 4 9 ] def %array of x coords +/P.Y [ 2 0 3 ] def %array of y coords +/PDelta.X [ 0 3 5 ] def % 3=4-1, 5=9-4, 0 never used +/PDelta.Y [ 0 -2 3 ] def % -2=0-2, 3=3-0, 0 never used +% normal to (3,-2) is (2,3), normal to (5,3) is (-3,5) +/PNormal.X [ 2 2 -3 ] def % index 0 =index 1 +/PNormal.Y [ 3 3 5 ] def % index 0 = index 1 +end } +\def\Ppointcount{2} +\makeatother +% make ticks using metric function arc-length +\pspolylineticks[Os=1,Ds=1]{P}{ ds }{0}{9} +% ticks at s=1,2... (increment function = distance) +\uput[-135](PTick0){$s=1$}% +\uput[-135](PTick1){$s=2$}% +\end{pspicture} +\end{LTXexample} + +\clearpage +Once again the same data, but with metric equal to the x coordinate. Change the last few lines to: + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4) +\psline[showpoints=true](1,2)(4,0)(9,3)% +%\uput[180](1,2){$s=0$}% +%\uput[-90](4,0){$s=1$}% +%\uput[0](9,3){$s=2$}% +\makeatletter% need to use macro names containing @ +\pstVerb{tx@Dict begin %the pstricks dictionary +% declare arrays of length 3 (indices 0,1,2) to hold points, +% differences and normals +/unitratiosq 1 def % yunit=xunit +/P.X [ 1 4 9 ] def %array of x coords +/P.Y [ 2 0 3 ] def %array of y coords +/PDelta.X [ 0 3 5 ] def % 3=4-1, 5=9-4, 0 never used +/PDelta.Y [ 0 -2 3 ] def % -2=0-2, 3=3-0, 0 never used +% normal to (3,-2) is (2,3), normal to (5,3) is (-3,5) +/PNormal.X [ 2 2 -3 ] def % index 0 =index 1 +/PNormal.Y [ 3 3 5 ] def % index 0 = index 1 +end } +\def\Ppointcount{2} +\makeatother +% make ticks using metric function arc-length +\pspolylineticks[metricFunction,Os=1,Ds=2]{P}{ x }{0}{5} +% ticks at x=1,3,... , start at tick index 0, draw 5 ticks +% the tick at s=1 has index 0 +% ticks at s=1,2... (increment function = distance) +\uput[-135](PTick0){$s=1$}% +\uput[-135](PTick1){$s=3$}% +\end{pspicture} +\end{LTXexample} + +\clearpage +The next example is a smooth path where subticks are drawn first, followed by major ticks. +The metric is arc-length with initial value $s=1$. +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4) +%\parametricplot[algebraic]{0}{9}{(t^2)/9 | 4*Ex(-t)*(1+t+(t^{2})/2+(t^{3})/6)} +\psparametricplot[algebraic]{0}{9}{t^2/9 | sin(t)+1}% +\pscurvepoints{0}{9}{(t^2)/9 | sin(t)+1}{P}% +% make ticks using arc-length metric +\pspolylineticks[metricInitValue=1,ticksize=-2pt 2pt,Os=1,Ds=.2]{P}{ ds }{1}{56}% +\pspolylineticks[metricInitValue=1,Os=1,Ds=2]{P}{ ds }{0}{6}% +\multido{\iA=1+1,\iB=3+2}{5}{\Put{6pt;(PNormal\iA)}(PTick\iA){\tiny \iB}} +%\nodexn{(PTick\iA)+(10pt;{(PNormal\iA)})}{Q}\rput(Q){\tiny \iB}}% +%\multido{\iA=1+1,\iB=3+2}{5}{\uput{6pt}[{(PNormal\iA)}](PTick\iA){\iB}}% +% ticks at x=1,3,... , start at tick index 0, draw 5 ticks +% the tick at s=1 has index 0 +% ticks at s=1,2... (increment function = distance) +\end{pspicture} +\end{LTXexample} + +\clearpage +Suppose for the next example that we have an ellipse $x^2/a^2+y^2/b^2=1$ ($a>b$) with +eccentricity $\epsilon=(1-b^2/a^2)^{1/2}$. With planetary motion in mind, a natural metric +for the ellipse is the area swept out by the radial line from the focus $(\epsilon a,0)$ +starting from $(a,0)$ around to an arbitrary location $(x,y)$, where $y>0$, as this quantity +is proportional to the time elapsed since perihelion. A routine calculation gives the following formula: +\[A=\frac{ab}{2}\arccos\bigg(\frac{x}{a}\bigg)-\frac{\epsilon a y}{2}.\] +Remembering that PostScript's {\tt acos} gives its result in degrees, not radians, we have the +following, drawn for the case $a=4$, $b=3$. + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-4.5,-.5)(4.5,3.5) +\pstVerb{ /smajor 4 def /sminor 3 def % define semimajor, semiminor +/ecc 1 sminor smajor div dup mul sub sqrt def % compute eccentricity +/ab smajor sminor mul 2 div def %first coeff +/ea smajor ecc mul 2 div def }% second coeff +\psparametricplot[algebraic]{0}{3.142}{smajor*cos(t) | sminor*sin(t)}% +\pscurvepoints{0}{3.142}{smajor*cos(t) | sminor*sin(t)}{P}% +\pspolylineticks[metricFunction,Ds=2,ticksize=-1.5pt 0]{P}{ ab x smajor div acos % +180 div PI mul mul ea y mul sub }{1}{9}% +\pnode(! ecc smajor mul 0){S}% focus +\psline[linecolor=lightgray](S)(!smajor 0)% +\multido{\i=1+1}{9}{\psline[linecolor=lightgray](S)(PTick\i)} +\psdot(S) +\end{pspicture} +\end{LTXexample} + +\clearpage +The next examples works without visible ticks, using the macros to construct nodes at which other objects will be placed. + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4) +\psparametricplot[algebraic]{0}{9}{t| 3*Ex(-t)*(1+t+t^2/2+t^3/6)} +\pscurvepoints{0}{9}{t| 3*Ex(-t)*(1+t+t^2/2+t^3/6)}{P}% +\pspolylineticks[Os=1,Ds=1,ticksize=0 0]{P}{ ds }{0}{9}% +\multido{\i=0+1}{9}{\psdot[dotscale=1.5,dotstyle=o](PTick\i)}% +% ticks at s=1,2,... , start at tick index 0, set 9 ticks +% the tick at s=1 has index 0 +% ticks at s=1,2... (increment function = distance) +%\traceon +\multido{\i=0+3}{3}{\Put[rot=(PTangent\i)]{7pt;(PNormal\i)}(PTick\i){PTick\i}}% +%\traceoff +%\uput[-135](PTick1){$s=3$}% +\end{pspicture} +\end{LTXexample} + +\clearpage +This variant also has no visible ticks, but makes a color gradient along the curve based on arc-length from the start. + + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4) +\psparametricplot[plotpoints=200,linecolor=white]{0}{360}{ t cos 1 add 4 mul t 1 add 20 div ln 2 div 1 add } +\pscurvepoints[plotpoints=200]{0}{360}{ t cos 1 add 4 mul t 1 add 20 div ln 2 div 1 add }{P}% +\pspolylineticks[Os=0,Ds=.2,ticksize=0 0]{P}{ ds }{0}{90}% +\definecolorseries{ctest}{hsb}{last}{green}{violet} +\resetcolorseries[88]{ctest}% +\multido{\iA=0+1,\iB=1+1}{87}{\psline[linewidth=2pt,linecolor=ctest!![\iB](PTick\iA)(PTick\iB)}% +%\multido{\i=0+1}{9}{\psdot[dotscale=1.5,dotstyle=o](PTick\i)}% +% ticks at s=1,2,... , start at tick index 0, set 9 ticks +% the tick at s=1 has index 0 +% ticks at s=1,2... (increment function = distance) +%\uput[-135](PTick1){$s=3$}% +\end{pspicture} +\end{LTXexample} + +\clearpage +Here is a another variant of this technique which allows arrows to be placed at locations +on the curve where the metric takes particular values. + +\begin{LTXexample}[pos=t] +\begin{pspicture}(-1,-1)(10,4.5) +\psparametricplot[plotpoints=100]{0}{360}{t cos 1 add 5 mul t sin 1 add 2 mul} +\pscurvepoints[plotpoints=100]{0}{360}{t cos 1 add 5 mul t sin 1 add 2 mul}{P}% +\pspolylineticks[Os=0,Ds=2.3,ticksize=0 0]{P}% +{ ds }{0}{10}% distance +\multido{\i=0+1}{10}{\psrline[arrows=->,arrowscale=1.5](PTick\i)(2pt;{(PTangent\i)})}% +\end{pspicture} +\end{LTXexample} + +\section{Troubleshooting} +If you get PostScript errors when you process your file, the most likely culprit is the +function you specified to define the metric. There are some things to look out for: +\begin{itemize} +\item If \Lkeyword{metricFunction}, the function you specify in PostScript code must +involve only {\tt x} and {\tt y}, and must leave exactly one real value on the stack as a result of +substituting specific values for {\tt x} and {\tt y}. The function must be strictly increasing on the curve. +\item If \Lkeyword{metricFunction}=\false (the default), the function you specify in PostScript +code must involve only the variables {\tt x}, {\tt y}, {\tt dx}, {\tt dy}, {\tt ds} (where {\tt ds} +is defined to be the arc-length element {\tt dx dup mul dy dup mul add sqrt}, and must leave exactly +one strictly positive real value on the stack when specific values are substituted for those variables. +The constant function {\tt 1} gives equal weight to each segment in the curve, so in effect it gives +you the original parametrization, up to a constant factor. +\item If the function you specify in \Lcs{parametricplot} and \Lcs{pscurvepoints} is \Lkeyword{algebraic}, +make sure you follow precisely the syntax it understands. In complex cases, PostScript may be the safer solution. +\item It is unwise to use a different resolution for \Lcs{psparametricplot} and \Lcs{pscurvepoints}. +The default value of \Lkeyword{plotpoints}=50 is marginal except for modest curve segments, and 200 should +suffice for most smooth curves. +\end{itemize} + + %-------------------------------------------------------------------------------------- \section{Transparent colors} %-------------------------------------------------------------------------------------- -Transparency is now part of the main \texttt{pstricks} package. +Transparency is now part of the main \LPack{pstricks} package. But pay attention, the names and syntax have changed and you need to run \Lprog{ps2pdf} with the option \Loption{-dCompatibilityLevel}=1.4. diff --git a/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro b/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro index 25eb33517a9..288af2eab11 100644 --- a/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro +++ b/Master/texmf-dist/dvips/pstricks-add/pstricks-add.pro @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.pro 247 2010-01-04 22:45:42Z herbert $ +%% $Id: pstricks-add.pro 328 2010-05-24 15:56:43Z herbert $ % PostScript prologue for pstricks-add.tex. % Version 0.23, 2009/12/17 % @@ -189,4 +189,3 @@ realtime srand % set random generator end % % END pstricks-add.pro - diff --git a/Master/texmf-dist/source/generic/pstricks-add/Makefile b/Master/texmf-dist/source/generic/pstricks-add/Makefile index 9bfc6c54295..bb21287cbd4 100644 --- a/Master/texmf-dist/source/generic/pstricks-add/Makefile +++ b/Master/texmf-dist/source/generic/pstricks-add/Makefile @@ -57,7 +57,6 @@ tds: # cp -u Changes $(TDS)/tex/generic/$(PACKAGE)/ cp -u $(PACKAGE).tex $(TDS)/tex/generic/$(PACKAGE)/ - cp -u pst-fp.tex $(TDS)/tex/generic/$(PACKAGE)/ # cp -u Changes $(TDS)/dvips/$(PACKAGE)/ cp -u $(PACKAGE).pro $(TDS)/dvips/$(PACKAGE)/ diff --git a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex index 7fd67ab5812..aff34a73d99 100644 --- a/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex +++ b/Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.tex 288 2010-02-11 15:43:29Z herbert $ +%% $Id: pstricks-add.tex 345 2010-06-10 16:07:44Z herbert $ %% %% %% This is file `pstricks-add.tex', @@ -9,6 +9,7 @@ %% %% Dominique Rodriguez %% Herbert Voss +%% Michael Sharpe %% %% This program can be redistributed and/or modified under the terms %% of the LaTeX Project Public License Distributed from CTAN archives @@ -30,8 +31,8 @@ \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi \ifx\PSTmathLoaded\endinput\else \input pst-math \fi % -\def\fileversion{3.39} -\def\filedate{2010/03/12} +\def\fileversion{3.40} +\def\filedate{2010/06/05} \message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)} % \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax @@ -174,6 +175,7 @@ /radius1 \psk@braceWidthOuter def /radius2 \psk@braceWidthInner def /Alpha \pst@tempA \pst@tempB 3 -1 roll sub 3 1 roll exch sub atan def + gsave STV CP T /ps@rot \psk@rot\space def grestore /Length \pst@tempA \pst@tempB Pyth2 def /Left { Length \psk@bracePos\space mul } bind def /Right { Length Left sub } bind def @@ -752,6 +754,150 @@ /VPutPos { { VPutLines } HPutCurve } def }> % +\def\parseRP#1;#2;#3\@nil{%check whether arg of refpt contains ; +\def\arg@A{#1}\def\arg@B{#2}% +%\ifx\arg@B\@empty\let\uflag\@empty\else\edef\uflag{1}\fi% +}% +\def\Put{\pst@object{Put}}% +\def\Put@i{\@ifnextchar({\Put@ii{}}{\Put@ii}}% +\def\Put@ii#1(#2)#3{{% +\pst@killglue% +\use@par% +\expandafter\parseRP#1;;\@nil%sets \arg@A, \arg@B +\ifx\arg@B\@empty% use \rput + \edef\arg@A{\if@star*\fi% + \ifx\arg@A\@empty\else[\arg@A]\fi% + }% + \edef\pst@tempA{\noexpand\rput\arg@A(#2){\noexpand#3}}\pst@tempA% +\else% use \uput + \edef\arg@A{\if@star*\fi% + \ifx\arg@A\@empty\else{\arg@A}\fi% + \ifx\arg@B\@empty[0]\else[\arg@B]\fi% + }% + \edef\pst@tempA{\noexpand\uput\arg@A(#2){\noexpand#3}}\pst@tempA% +\fi}\ignorespaces}% +% Modify pst@rot so that a rotation may be specified with a node or ps code +% +\define@key[psset]{pstricks-add}{Os}[0]{\def\PST@Os{#1}} +\psset{Os=0}% +\define@key[psset]{pstricks-add}{Ds}[1]{\def\PST@Ds{#1}} +\psset{Ds=1}% +\define@key[psset]{pstricks-add}{metricInitValue}[0]{\def\PST@metricInitValue{#1}} +\psset{metricInitValue=0}% +\define@boolkey[psset]{pstricks-add}[PST@]{metricFunction}[true]{}%use \ifPST@metricFunction +\psset{metricFunction=false}% +\def\pscurvepoints{\pst@object{pscurvepoints}}% +\def\pscurvepoints@i#1#2#3#4{{%optional [plotpoints=xx] +% #1=tmin,#2=tmax,#3=function (of t),#4=array root name, + \pst@killglue% + \use@par% + \edef\my@tempA{#3}% x(t) y(t) expanded + \expandafter\testAlg\my@tempA|\@nil% + \pst@Verb{ % so we can use definitions from tx@Dict + /unitratio \pst@number\psyunit \pst@number\psxunit div def + /unitratiosq unitratio dup mul def + /t0 #1 def + /t1 #2 def + t1 t0 sub \psk@plotpoints\space div /dt exch def }% + \pst@cntc=\psk@plotpoints\relax%\psk@plotpoints=plotpoints-1 + \pst@cntb=\pst@cntc\relax%\psk@plotpoints=plotpoints-1 + \advance\pst@cntc by \@ne\relax%=plotpoints + \ifx\my@tempD\@empty\pst@Verb{ /Func (#3) cvx def }% + \else\pst@Verb{ /Func (#3 ) AlgParser cvx def }% + \fi% + \pst@Verb{ + /#4.X \the\pst@cntc\space array def + /#4.Y \the\pst@cntc\space array def % + /#4Delta.X \the\pst@cntc\space array def % + /#4Delta.Y \the\pst@cntc\space array def % + /#4Normal.X \the\pst@cntc\space array def % + /#4Normal.Y \the\pst@cntc\space array def % + /t #1 def Func 2 copy /priory ED /priorx ED #4.Y 0 3 -1 roll put #4.X 0 3 -1 roll put % + 1 1 \the\pst@cntb\space { dup /j ED dt mul #1 add /t ED Func %x y on stack + 2 copy priory sub dup #4Delta.Y j 3 -1 roll put % x y x y-priory + unitratiosq mul neg #4Normal.X j 3 -1 roll put % x y x + priorx sub dup #4Delta.X j 3 -1 roll put % x y x-priorx + #4Normal.Y j 3 -1 roll put % x y + 2 copy /priory ED /priorx ED % x y + #4.Y j 3 -1 roll put #4.X j 3 -1 roll put } for % + }% + \expandafter\xdef \csname #4pointcount\endcsname {\psk@plotpoints}% +% \typeout{Created points #40 .. #4\psk@plotpoints}% +}\ignorespaces}% +% +%code to place ticks along polyline +\def\pspolylineticks{\pst@object{pspolylineticks}}% +\def\pspolylineticks@i#1{\@ifnextchar[{\pspolylineticks@ii{#1}}{\pspolylineticks@ii{#1}[]}}% +\def\pspolylineticks@ii#1[#2]#3#4#5{{% +%#1= root name,#2=pscode (optional),#3=metric function,#4=first tick,#5=tick count +% Metric function may be a function of x, y (keyword metricFunction) +% or a function of x, y, dx, dy, ds requiring incremental build +\pst@killglue% +\addbefore@par{arrows=-,linewidth=\psk@ytickwidth\pslinewidth}% +\use@par% +\pst@killglue%there's a leak that can occur here with ticksize--fixed in recent pstricks.tex +\newcount\pst@cntC% +\pst@cntC=\expandafter\csname #1pointcount\endcsname\relax% +\pst@cntb=\pst@cntC\advance\pst@cntb\m@ne\relax% +\pst@cntd=\pst@cntC\advance\pst@cntd\@ne\relax% +\pst@Verb{ % so we can use definitions from tx@Dict in pstricks.pro + /TDict 20 dict def TDict begin % + /Func (#3) cvx def /sarray \the\pst@cntd\space array def % + #2 + \ifPST@metricFunction + 0 1 #1.X length 1 sub { /j ED sarray j % + #1.X j get /x ED #1.Y j get /y ED Func put } for % + \else %build by increments + sarray 0 \PST@metricInitValue\space put % + 1 1 #1.X length 1 sub { /j ED sarray j % + #1.X j 1 sub get /x ED #1.Y j 1 sub get /y ED #1Delta.X j get /dx ED #1Delta.Y j get /dy ED /ds dx dup mul dy dup mul add sqrt def % + Func sarray j 1 sub get add put } for % + \fi %\ifPSTfunctionMetric + /str 10 string def /tmpar [(Metric range: [) () (, ) () (])] def % + tmpar 1 sarray 0 get str cvs put + /str 10 string def + tmpar 3 sarray \the\pst@cntC\space get str cvs put tmpar + tx@NodeDict begin concatstringarray = end % +%compute ticks + /nl 0 def /nu \the\pst@cntC\space def + /smin sarray 0 get def + /smax sarray nu get def + /Os \ifx\PST@Os\@empty smin \else \PST@Os\space \fi def % + /Ds \ifx\PST@Ds\@empty smax Os sub 10 div \else \PST@Ds\space \fi def % + /scount smax Os sub Ds div cvi def % + /tarray scount 1 add array def % + /#1Tick.X scount 1 add array def % +/#1Tick.Y scount 1 add array def % +/#1TickN.X scount 1 add array def % +/#1TickN.Y scount 1 add array def % +0 1 scount { dup Ds mul Os add tarray 3 1 roll put } for %tick positions in tarray +% find the corresponding s values using binary search +0 1 scount { dup tarray exch get /s exch def /j exch def %sought metric value,index +/m nl def /n nu def /k nl nu add 2 div cvi def 20 { s sarray k get lt { % +/n k def /k k m add 2 div cvi def }{ /m k def /nl k def /k k n add 2 div cvi def } ifelse % +n 1 sub m le { /nl m def exit } if } repeat % +sarray n get sarray m get dup 3 1 roll % sm sn sm +sub dup 0 le { pop pop 0 }{%sm sn-sm +exch %sn-sm sm +s sub neg exch div } ifelse % s->(s-sm)/(sn-sm) +dup #1Delta.X m 1 add get mul #1.X m get add #1Tick.X j 3 -1 roll put % s on stack +#1Delta.Y m 1 add get mul #1.Y m get add #1Tick.Y j 3 -1 roll put % +#1TickN.X j #1Normal.X m 1 add get put #1TickN.Y j #1Normal.Y m 1 add get put % + } for % +/tmpar 2 array def /str 4 string def tmpar 0 (Created data for points #1Tick0..#1Tick) put tmpar 1 scount str cvs put tmpar tx@NodeDict begin concatstringarray = % + end end }% end pst@Verb +%Draw ticks +\multido{\iA=#4+1}{#5}{% + \pnode(! TDict begin \iA\space scount gt + { 1 0 /VV ED /UU ED 0 0 } + { #1TickN.X \iA\space get #1TickN.Y \iA\space get /VV ED /UU ED #1Tick.X \iA\space get #1Tick.Y \iA\space get } ifelse + 2 copy /YY ED /XX ED end){#1Tick\iA}% + \pnode(! TDict begin UU VV end ){#1Normal\iA}% + \pnode(! TDict begin VV UU neg unitratiosq div end ){#1Tangent\iA}% + \edef\cmd{\noexpand\psline(\the\pst@yticksizeA;{(! TDict begin UU VV end )})(\the\pst@yticksizeB;{(! TDict begin UU VV end )})}% + \pscustom{\translate(! TDict begin XX YY end)\cmd}}% +}\ignorespaces}% +% \define@key[psset]{pstricks-add}{randomPoints}[1000]{\def\psk@randomPoints{#1}} \define@boolkey[psset]{pstricks-add}[Pst@]{color}[true]{} \psset{randomPoints=1000,color=false} @@ -1122,6 +1268,7 @@ \def\psplotTangent@i#1#2#3{% \expandafter\psplotTangent@ii#2,,\@nil % \def\pst@par{#1}% +% \addbefore@par{Derive=NOT@EMPTY} \begin@OpenObj% \ifx\psk@Derive\@empty\ifPst@algebraic\def\psk@Derive{NOT@EMPTY}\fi\fi%%dr 0606 hv 1003 \addto@pscode{ @@ -1632,7 +1779,7 @@ \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart \global\@chartSepfalse% \if$\psk@chartSepValues$\else - \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta \global\@chartSeptrue\fi}% + \psforeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax \global\@chartSeptrue\fi}% \fi \if@chartSep% \pswedge(\psk@chartSep\p@;\pst@number\pst@dimo){\pst@chartRadius}{\pst@number\pst@dimn}{\pst@number\pst@dimm}% @@ -1660,7 +1807,7 @@ \pst@dimo=0.5\pst@dimn\advance\pst@dimo by 0.5\pst@dimm% half angle of the chart \global\@chartSepfalse \if$\psk@chartSepValues$\else - \psForeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta \global\@chartSeptrue\fi}% + \psForeach{\chart@tempC}{\psk@chartSepValues}{\ifnum\chart@tempC=\the\pst@cnta\relax \global\@chartSeptrue\fi}% \fi \if@chartSep% \pswedge[linecolor={chartFillColor\the\pst@cnta},fillstyle=solid,fillcolor={chartFillColor\the\pst@cnta}]% @@ -1880,7 +2027,6 @@ } % \def\resetOptions{% - \@zero=0% \def\pst@linetype{0}% \pstScalePoints(1,1){}{}% \psset[pstricks-add]{% diff --git a/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty b/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty index 99efb8098ed..8a152234b64 100644 --- a/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty +++ b/Master/texmf-dist/tex/latex/pstricks-add/pstricks-add.sty @@ -1,4 +1,4 @@ -%% $Id: pstricks-add.sty 288 2010-02-11 15:43:29Z herbert $ +%% $Id: pstricks-add.sty 298 2010-03-13 08:46:53Z herbert $ % \RequirePackage{pstricks} \ProvidesPackage{pstricks-add}[2010/02/11 v. 0.14 package wrapper for diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds index 99451827990..6ed86605c80 100755 --- a/Master/tlpkg/libexec/ctan2tds +++ b/Master/tlpkg/libexec/ctan2tds @@ -304,6 +304,7 @@ $Master = "$mydir/../.."; 'guitbeamer', "die 'skipping, nonfree'", 'hfbright', "&MAKEflatten", 'hfoldsty', "&MAKEflatten", + 'highlight', "die 'skipping, complicated compilation'", 'hilowres', "die 'skipping, nonfree'", 'hyph-utf8', "&MAKEcopy", 'hyphen-german',"die 'skipping, part of hyph-utf8'", -- cgit v1.2.3