summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pstricks-add
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-06-12 00:11:41 +0000
committerKarl Berry <karl@freefriends.org>2010-06-12 00:11:41 +0000
commit3ca859b7c25a23c6fa253978191197782df3d799 (patch)
tree7f38b43de274e72138f80c27f917ef50b05578f1 /Master/texmf-dist/tex/generic/pstricks-add
parentb3ba42c57f43aa4acf39c30b4fc092ffdbf63269 (diff)
pstricks-add 3.40 (11jun10)
git-svn-id: svn://tug.org/texlive/trunk@18900 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/generic/pstricks-add')
-rw-r--r--Master/texmf-dist/tex/generic/pstricks-add/pstricks-add.tex158
1 files changed, 152 insertions, 6 deletions
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 <hvoss@tug.org>
+%% Michael Sharpe <msharpe@ucsd.edu>
%%
%% 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]{%