summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pstricks-add
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-01-19 23:41:00 +0000
committerKarl Berry <karl@freefriends.org>2009-01-19 23:41:00 +0000
commit7182f14254c8a7ac0ee463a6a9944e914cca9875 (patch)
tree58bfeb2da572cdf35f31e68b31935c51984ee3ed /Master/texmf-dist/tex/generic/pstricks-add
parent3b0d311f8129942a21307bf752701045027438a2 (diff)
pstricks-add 3.16 (18jan09)
git-svn-id: svn://tug.org/texlive/trunk@11919 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.tex200
1 files changed, 153 insertions, 47 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 5c8b1a67389..96384ac46c1 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 49 2008-10-13 10:59:27Z herbert $
+%% $Id: pstricks-add.tex 75 2009-01-17 22:01:38Z herbert $
%%
%%
%% This is file `pstricks-add.tex',
@@ -29,8 +29,8 @@
\ifx\MultidoLoaded\endinput\else \input multido \fi
\ifx\PSTXKeyLoaded\endinput\else \input pst-xkey \fi
%
-\def\fileversion{3.11}
-\def\filedate{2008/10/13}
+\def\fileversion{3.17}
+\def\filedate{2009/01/17}
\message{`pstricks-add' v\fileversion, \filedate\space (dr,hv)}
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
@@ -168,6 +168,13 @@
%
%--------------------------------------- small stuff -------------------------------
+\def\use@keep@par{% same as \use@par, but keeps the values
+ \ifx\pst@par\@empty\else
+ \expandafter\@psset\pst@par,\@nil
+% \def\pst@par{}%
+ \fi%
+}
+%
\define@boolkey[psset]{pstricks-add}[Pst@]{CMYK}[true]{}
\psset[pstricks-add]{CMYK=true}
%
@@ -632,7 +639,7 @@
\tx@EndArrow%
}
% ArrowInsidePos parameter (default value 0.5)
-\define@key[psset]{pstricks-add}{ArrowInsidePos}{\pst@checknum{#1}\psk@ArrowInsidePos}%
+\define@key[psset]{pstricks-add}{ArrowInsidePos}[0.5]{\pst@checknum{#1}\psk@ArrowInsidePos}%
%\psset{ArrowInsidePos=0.5}
%
% Modified version of \begin@ClosedObj
@@ -649,8 +656,8 @@
% Redefinition of the PostScript /Line macro to print the intermediate
% arrow on each segment of the line
%
-\define@key[psset]{pstricks-add}{ArrowInsideNo}{\pst@checknum{#1}\psk@ArrowInsideNo}% hv 20031001
-\define@key[psset]{pstricks-add}{ArrowInsideOffset}{\pst@checknum{#1}\psk@ArrowInsideOffset}% hv 20031001
+\define@key[psset]{pstricks-add}{ArrowInsideNo}[1]{\pst@checknum{#1}\psk@ArrowInsideNo}% hv 20031001
+\define@key[psset]{pstricks-add}{ArrowInsideOffset}[0]{\pst@checknum{#1}\psk@ArrowInsideOffset}% hv 20031001
%\psset{ArrowInsideNo=1,ArrowInsideOffset=0}
%
\def\arrowType@H{H}
@@ -1047,7 +1054,7 @@
\pst@number\psyunit div /#1.y ED % /#1.y in user coor
\pst@number\psxunit div /#1.x ED } % /#1.x in user coor
%
-\define@key[psset]{pstricks-add}{lineAngle}{%
+\define@key[psset]{pstricks-add}{lineAngle}[0]{%
\ifdim#1pt=\z@\else\psset{armB=0.5}\fi
\def\psk@lineAngle{#1}}%
%\psset{lineAngle=0}%
@@ -1335,6 +1342,39 @@
%%%%%%%%%%% %%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
+%the following works only for plotstyle line, polygon and bezier
+\define@key[psset]{pstricks-add}{yMaxValue}{\def\psk@yMaxValue{#1 }}
+\psset{yMaxValue=-1.0}% can be in PS syntax (eg 1e1.2) and must be positiv!
+%
+% For quick plots, define:
+% \beginqp@<foo> : What to do to first point (PS code only).
+% \doqp@<foo> : What to do to subsequent points (PS code only).
+% \endqp@<foo> : How to end plot.
+% \testqp@<foo> : Set \@psttrue if OK to use quick plot.
+
+\def\doqp@line{
+ \psk@yMaxValue 0 gt
+ { dup abs
+ \psk@yMaxValue \pst@number\psyunit mul gt
+ { moveto }{ L } ifelse }
+ { L } ifelse
+}
+\def\doqp@polygon{
+ \psk@yMaxValue 0 gt
+ { dup abs
+ \psk@yMaxValue \pst@number\psyunit mul gt
+ { moveto }{ L } ifelse }
+ { L } ifelse
+}
+\def\doqp@bezier{/n n 1 add def n 3 mod 0 eq { % we need 3 points
+ \psk@yMaxValue 0 gt
+ { dup % last y value
+ abs \psk@yMaxValue\space \pst@number\psyunit mul gt
+ { moveto pop pop pop pop }{ curveto } ifelse }
+ { curveto } ifelse
+ } if
+}
+%
% Euclide Algorithm (macro by Jean-Come Charpentier)
% #1 : numerator (number.unit) (e.g. 4.\pi or 3.\ell or 12.a)
% #2 : denominator
@@ -1584,11 +1624,11 @@
\def\psxTick{\pst@object{psxTick}}% idea by Martin Chicoine
\def\psxTick@i(#1)#2{{
\pst@killglue
- \addbefore@par{arrows=-}
+ \addbefore@par{arrows=-,linewidth=\psk@xtickwidth\pslinewidth}
\use@par
\psline(#1,\pst@xticksizeB)(#1,\pst@xticksizeA)
\rput[t](! #1 \pst@number\pslabelsep \pst@number\pst@xticksizeB add
- \pst@number\psyunit div neg ){\vphantom{1}#2}}\ignorespaces}
+ \pst@number\psyunit div neg ){\pshlabel{#2\vphantom{1}}}}\ignorespaces}
%
%% #1 : optional arguments passed to psline
%% #2 : y value
@@ -1596,12 +1636,11 @@
\def\psyTick{\pst@object{psyTick}}% idea by Martin Chicoine
\def\psyTick@i(#1)#2{{
\pst@killglue
- \addbefore@par{arrows=-}
+ \addbefore@par{arrows=-,linewidth=\psk@ytickwidth\pslinewidth}
\use@par
\psline(\pst@yticksizeB,#1)(\pst@yticksizeA,#1)
\rput[r]{0}(!\pst@number\pst@yticksizeB \pst@number\pslabelsep add
- \pst@number\psxunit div neg #1){#2}}\ignorespaces}
-%
+ \pst@number\psxunit div neg #1){\psvlabel{#2}}}\ignorespaces}
%
%% #1 integer
%% #2 decimals
@@ -1679,6 +1718,7 @@
\ifPst@xAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{}{x}\fi%
\ifPst@yAxis\psxs@@axes\pst@dima\pst@dimb\pst@dimc\pst@dimd{exch}{y}\fi%
}}
+
\def\psaxes{\pst@object{psaxes}}
\def\psaxes@i{\pst@getarrows\psaxes@ii}
\def\psaxes@ii(#1){\@ifnextchar({\psaxes@iii(#1)}{\psaxes@iv(0,0)(0,0)(#1)}}
@@ -1687,7 +1727,10 @@
\def\psaxes@v(#1)(#2)(#3)[#4]{\@ifnextchar[{\psaxes@vi(#1)(#2)(#3)[#4]}{\psaxes@vi(#1)(#2)(#3)[#4][]}}%
\def\psaxes@vi(#1)(#2)(#3)[#4,#5][#6,#7]{%
\psaxes@vii(#1)(#2)(#3)%
- \uput[#5](#3|0,0){#4}\uput[#7](0,0|#3){#6}%
+ \begingroup
+ \use@par
+ \uput{\pslabelsep}[#5](#3|#1){#4}\uput{\pslabelsep}[#7](#1|#3){#6}%
+ \endgroup%
}
%
\def\psaxes@vii(#1,#2)(#3,#4)(#5,#6){%
@@ -1923,6 +1966,7 @@
\def\pst@tempA{none}%
\pst@addarrowdef%
\addto@pscode{
+ /showOrigin \ifshoworigin true \else false \fi def % 0 and ticks for 0/0 ?
\ifis@yAxis 0 \pst@number#4 \else \pst@number#3 0 \fi
\ifis@yAxis 0 \pst@number#2 \else \pst@number#1 0 \fi
ArrowA
@@ -1992,7 +2036,8 @@
\else\@nameuse{psls@\psxsubticklinestyle}\fi stroke} def
%\iffalse
% start ticks ---------------------------------------------------------
- 0 dT MaxValue 1 add{ % the positive part of the axes
+ showOrigin { 0 }{ dT } ifelse
+ dT MaxValue 1 add{ % the positive part of the axes
/cntTick exch def % the index
logLines { % log lines?
gsave
@@ -2061,7 +2106,8 @@
/dT dT neg def % the other side of the axis
/dsubT dsubT neg def
% start ticks ----------------------------------------------------------
- 0 dT MinValue epsilon viceversa { add }{ sub } ifelse {
+ showOrigin { 0 }{ dT } ifelse
+ dT MinValue epsilon viceversa { add }{ sub } ifelse {
/cntTick exch def
logLines { % log lines?
gsave
@@ -2275,9 +2321,19 @@
\@nameuse{endplot@\psplotstyle}%
}
%
+\define@boolkey[psset]{pstricks-add}[Psk@]{xyValues}[true]{}
+\psset[pstricks-add]{xyValues}
+%
\define@boolkey[psset]{pstricks-add}[Pst@]{ChangeOrder}[true]{}
+%
\pst@def{PreparePoints}<{%
counttomark /m exch def
+ \ifPsk@xyValues\else % we have only y values
+ /mm m def
+ /M m 1 add def
+ m { mm exch M 2 roll /M M 1 add def /mm mm 1 sub def } repeat
+ /m m dup add def
+ \fi
\ifPst@ChangeOrder
/m0 m def
m \psk@plotNoMax\space 1 add div 1 sub cvi {
@@ -2437,31 +2493,35 @@
\psgraph@vi(#1,#2)(#3,#4)(#5,#6)%
}
%
-\def\setxLabelC@@r#1,#2(#3,#4){%
+\def\setxLabelC@@r#1,#2(#3,#4)(#5){%
+ \pst@getcoor{#5}\pst@tempB
\ifx#1c
\pssetylength\pst@dimm{#2}
- \rput(! #4 #3 add 2 div \pst@number\pst@dimm \pst@number\psyunit div ){\psk@xAxisLabel}
+ \rput(! #4 #3 add 2 div \pst@number\pst@dimm \pst@tempB\space exch pop add
+ \pst@number\psyunit div ){\psk@xAxisLabel}
\else
\pst@getcoor{\psk@xAxisLabelPos}\pst@tempA
- \rput(! \pst@tempA\space \tx@UserCoor ){\psk@xAxisLabel}
+ \rput(! \pst@tempA\space \pst@tempB\space exch pop add \tx@UserCoor ){\psk@xAxisLabel}
\fi}
-\def\setyLabelC@@r#1,#2(#3,#4){%
+\def\setyLabelC@@r#1,#2(#3,#4)(#5){%
+ \pst@getcoor{#5}\pst@tempB
\ifx#2c
\pssetxlength\pst@dimm{#1}
- \rput{90}(! \pst@number\pst@dimm \pst@number\psxunit div #4 #3 add 2 div ){\psk@yAxisLabel}
+ \rput{90}(! \pst@number\pst@dimm \pst@tempB\space pop add
+ \pst@number\psxunit div #4 #3 add 2 div ){\psk@yAxisLabel}
\else
\pst@getcoor{\psk@yAxisLabelPos}\pst@tempA
- \rput{90}(! \pst@tempA\space \tx@UserCoor ){\psk@yAxisLabel}
+ \rput{90}(! \pst@tempB\space pop \pst@tempA\space 3 1 roll add exch \tx@UserCoor ){\psk@yAxisLabel}
\fi}
%
\def\psgraph@vi(#1,#2)(#3,#4)(#5,#6){%
\ifx\psk@xAxisLabel\@empty\else%
\ifx\psk@xAxisLabelPos\@empty \uput[0](#5,#2){\psk@xAxisLabel}%
- \else \expandafter\setxLabelC@@r\psk@xAxisLabelPos(#3,#5)\fi%
+ \else \expandafter\setxLabelC@@r\psk@xAxisLabelPos(#3,#5)(#1,#2)\fi
\fi%
\ifx\psk@yAxisLabel\@empty\else%
\ifx\psk@yAxisLabelPos\@empty \uput[90](#1,#6){\psk@yAxisLabel}%
- \else \expandafter\setyLabelC@@r\psk@yAxisLabelPos(#4,#6)\fi%
+ \else\expandafter\setyLabelC@@r\psk@yAxisLabelPos(#4,#6)(#1,#2)\fi
\fi%
\ignorespaces%
}
@@ -2550,7 +2610,8 @@
\define@key[psset]{pstricks-add}{adamsorder}{\def\psk@adamsorder{#1}}% adams - rk4
%\define@key[psset]{pstricks-add}{varstepincrease}{\def\psk@varstepincrease{#1}}% varrk4
%
-\def\psplot@i#1#2#3{%
+\def\psplot@i#1#2{\@ifnextchar[{\psplot@I{#1}{#2}}{\psplot@I{#1}{#2}[]}}
+\def\psplot@I#1#2[#3]#4{%
\pst@killglue
\begingroup
\use@par
@@ -2559,18 +2620,19 @@
\ifPst@polarplot
\addto@pscode{%
\psplot@init
+ #3
/x #1 def
/x1 #2 def
/dx x1 x sub \psk@plotpoints div def
- /F@pstplot \ifPst@algebraic (#3)
+ /F@pstplot \ifPst@algebraic (#4)
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx
- \else { #3 } \fi def
+ \else { #4 } \fi def
\ifPst@VarStep
/StillZero 0 def /LastNonZeroStep dx def
- /F2@pstplot tx@Derive begin (#3) (x) Derive (x) Derive end
+ /F2@pstplot tx@Derive begin (#4) (x) Derive (x) Derive end
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
@@ -2586,7 +2648,7 @@
\fi
/xy {% Adapted from \parametricplot@i
F@pstplot x \ifPst@algebraic RadtoDeg \fi PtoC
-% #3 dup x cos mul exch x sin mul
+% #4 dup x cos mul exch x sin mul
\pst@number\psyunit mul exch
\pst@number\psxunit mul exch
} def}%
@@ -2594,18 +2656,19 @@
% D.G. modification end
\addto@pscode{%
\psplot@init
+ #3
/x #1 def
/x1 #2 def
/dx x1 x sub \psk@plotpoints div def
- /F@pstplot \ifPst@algebraic (#3)
+ /F@pstplot \ifPst@algebraic (#4)
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx
- \else { #3 } \fi def
+ \else { #4 } \fi def
\ifPst@VarStep
/StillZero 0 def /LastNonZeroStep dx def
- /F2@pstplot tx@Derive begin (#3) (x) Derive (x) Derive end
+ /F2@pstplot tx@Derive begin (#4) (x) Derive (x) Derive end
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (x) tx@Derive begin Derive end } repeat
\fi\space
@@ -2621,7 +2684,7 @@
\fi
/xy {
x \pst@number\psxunit mul F@pstplot \pst@number\psyunit mul
-% \ifPst@algebraic F@pstplot \else #3 \fi \pst@number\psyunit mul
+% \ifPst@algebraic F@pstplot \else #4 \fi \pst@number\psyunit mul
} def}%
\fi
\gdef\psplot@init{}%
@@ -2647,14 +2710,19 @@
x x1 eq { exit } if} loop}%
\else\pst@killglue%
\addto@pscode{%
+ /ps@Exit false def
xy \@nameuse{beginqp@\psplotstyle}
\ifx\psk@method\@varrkiv\else\psk@plotpoints 1 sub \fi {
/x x dx add \ifx\psk@method\@varrkiv dup x1 gt { pop x1 } if \fi def
xy \@nameuse{doqp@\psplotstyle}
\ifx\psk@method\@varrkiv x x1 eq { exit } if \fi
- } \ifx\psk@method\@varrkiv loop\else repeat\fi
- /x x1 def
- xy \@nameuse{doqp@\psplotstyle}}%
+ }
+ ps@Exit { exit } if
+ \ifx\psk@method\@varrkiv loop \else repeat \fi
+ ps@Exit not {
+ /x x1 def
+ xy \@nameuse{doqp@\psplotstyle}
+ } if }%
\fi%
\@nameuse{endqp@\psplotstyle}}
\def\psplot@iii{%
@@ -2687,25 +2755,27 @@
\@nameuse{endplot@\psplotstyle}}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-\def\parametricplot@i#1#2#3{%
+\def\parametricplot@i#1#2{\@ifnextchar[{\parametricplot@I{#1}{#2}}{\parametricplot@I{#1}{#2}[]}}
+\def\parametricplot@I#1#2[#3]#4{%
\pst@killglue%
\begingroup
\use@par
\@nameuse{beginplot@\psplotstyle}%
\addto@pscode{%
\psplot@init
+ #3
/t #1 def
/t1 #2 def
/dt t1 t sub \psk@plotpoints div def
- /F@pstplot \ifPst@algebraic (#3)
+ /F@pstplot \ifPst@algebraic (#4)
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
\fi\space
tx@AlgToPs begin AlgToPs end cvx
- \else { #3 } \fi def
+ \else { #4 } \fi def
\ifPst@VarStep
/StillZero 0 def /LastNonZeroStep dt def
- /F2@pstplot tx@Derive begin (#3) (t) Derive (t) Derive end
+ /F2@pstplot tx@Derive begin (#4) (t) Derive (t) Derive end
\ifx\psk@PlotDerivative\@none\else
\psk@PlotDerivative\space { (t) tx@Derive begin Derive end } repeat
\fi\space
@@ -2722,7 +2792,7 @@
ifelse } bind def
\fi
/xy {
- \ifPst@algebraic F@pstplot \else #3 \fi
+ \ifPst@algebraic F@pstplot \else #4 \fi
\pst@number\psyunit mul exch
\pst@number\psxunit mul exch
} def}%
@@ -2748,13 +2818,17 @@
t t1 eq { exit } if } loop}%
\else\pst@killglue%
\addto@pscode{%
+ /ps@Exit false def
xy \@nameuse{beginqp@\psplotstyle}
\psk@plotpoints 1 sub {
/t t dt add def
xy \@nameuse{doqp@\psplotstyle}
+ ps@Exit { exit } if
} repeat
- /t t1 def
- xy \@nameuse{doqp@\psplotstyle}}%
+ ps@Exit not {
+ /t t1 def
+ xy \@nameuse{doqp@\psplotstyle}
+ } if }%
\fi%
\@nameuse{endqp@\psplotstyle}}
\def\parametricplot@iii{%
@@ -2802,8 +2876,40 @@
\def\endplot@bar{%
\psbar@ii\psk@fillstyle\ifpsshadow\pst@closedshadow\fi%
\pst@stroke
- \end@SpecialObj%
-}
+ \end@SpecialObj}
+%
+\define@key[psset]{pstricks-add}{PSfont}[Times-Roman]{\def\psk@PSfont{/#1 }}
+\define@key[psset]{pstricks-add}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth }
+\define@key[psset]{pstricks-add}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale }
+\define@key[psset]{pstricks-add}{decimals}[-1]{\pst@getint{#1}\psk@decimals }
+\psset[pstricks-add]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1}
+%
+\def\psvalues@ii{
+ \addto@pscode{false \tx@NArray \psvalues@iii}}
+\def\psvalues@iii{%
+ \psk@PSfont findfont \psk@fontscale scalefont setfont
+ newpath
+ n { /yO ED /xO ED
+ gsave
+% \psk@valuewidth 2 div \psk@fontscale mul 0 rlineto 0 \psk@fontscale rlineto
+% \psk@valuewidth 2 div \psk@fontscale mul neg 0 rlineto 0 \psk@fontscale neg rlineto
+% closepath gsave 1 setgray fill stroke grestore
+ yO \pst@number\psyunit div
+ \psk@decimals 0 eq { cvi } if
+ \psk@decimals 0 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
+ \psk@valuewidth string cvs /Str ED
+ Str stringwidth pop /yS \psk@fontscale def /xS ED
+ gsave newpath
+ xO yO \pst@number\pslabelsep add moveto \psk@rot rotate
+ xS 0 rlineto 0 yS rlineto xS neg 0 rlineto 0 yS neg rlineto
+ closepath 1 setgray fill stroke grestore
+ xO yO \pst@number\pslabelsep add moveto \psk@rot rotate Str show grestore } repeat
+}%
+\def\beginplot@values{\begin@SpecialObj}
+\def\endplot@values{%
+ \psvalues@ii%
+ \pst@stroke
+ \end@SpecialObj}
%
%
% LSM Least Square Method 2006-03-13 (hv)
@@ -3238,9 +3344,9 @@
\def\psGTriangle@i(#1)(#2)(#3)#4#5#6{{%
\def\solid@star{}%
\begin@ClosedObj
- \pst@getcoor{#1}\pst@tempA% A: "rgb xr xg xb" or "gray xg"
- \pst@getcoor{#2}\pst@tempB% B
- \pst@getcoor{#3}\pst@tempC% C
+ \pst@getcoor{#1}\pst@tempA % A: "rgb xr xg xb" or "gray xg"
+ \pst@getcoor{#2}\pst@tempB % B
+ \pst@getcoor{#3}\pst@tempC % C
\pst@getcolor{#4}\pst@colorA
\pst@getcolor{#5}\pst@colorB
\pst@getcolor{#6}\pst@colorC