summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/generic/pst-tools/Changes11
-rw-r--r--Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdfbin64396 -> 67428 bytes
-rw-r--r--Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex27
-rw-r--r--Master/texmf-dist/dvips/pst-tools/pst-tools.pro231
-rw-r--r--Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex12
5 files changed, 276 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/generic/pst-tools/Changes b/Master/texmf-dist/doc/generic/pst-tools/Changes
index 5aeb1c66b82..680a2891f1a 100644
--- a/Master/texmf-dist/doc/generic/pst-tools/Changes
+++ b/Master/texmf-dist/doc/generic/pst-tools/Changes
@@ -1,4 +1,6 @@
..... pst-tools.tex
+0.02 2012-10-16 - added option postString and stripSpaces
+ to macro \psPrintValue
0.01 2012-01-01 - first CTAN version
@@ -6,5 +8,10 @@
2012-01-01 first version
-..... pst-tools.pro
-0.01 2012-01-01 first version
+---- pst-tools.pro
+0.03 2012-10-16 - added function /rightTrim
+ - moved file from pstricks base to pst-tools
+0.02 2012-01-01 moved some stuff from pst-func.pro
+0.01 2011-04-23 initial version (hv)
+
+
diff --git a/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdf b/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdf
index e72d2331947..1af154fe372 100644
--- a/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdf
+++ b/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex b/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex
index 8ca374ace13..1c4e3a73582 100644
--- a/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex
+++ b/Master/texmf-dist/doc/generic/pst-tools/pst-tools-doc.tex
@@ -41,6 +41,8 @@ There are the following valid options for \Lcs{psPrintValue}:
\textrm{name} & \textrm{value} & \textrm{default}\\\hline
\Lkeyword{PSfont} & PS font name & Times & only valid \PS font names are possible, e.g.
\Lps{Times-Roman}, \Lps{Helvetica}, \Lps{Courier}, \Lps{AvantGard}, \Lps{Bookman}\\
+\Lkeyword{postString} & <string> & \{\} & will be appended to the number string\\
+\Lkeyword{trimSpaces} & <boolean> & false & will strip spaces on the right\\
\Lkeyword{fontscale} & <number> & 10 & the font scale in pt\\
\Lkeyword{valuewidth} & <number> & 10 & the width of the string for the converted
real number; if it is too small, no value is printed\\
@@ -109,6 +111,31 @@ Pay attention, in algebraic notation angles must be in radian and not degrees.
\makebox[6em]{\psPrintValue[PSfont=Palatino-Roman]{\rA,sin(x)^2+cos(x)^2}}\\}
\end{lstlisting}
+
+
+\begin{center}
+foo \makebox[2em][l]{\psPrintValue[dot]{3.14 10 mul round 10 div}}bar\\3pt
+foo \makebox[2em][l]{\psPrintValue[dot,PSfont=Symbol,
+ postString=\string\260]{3.14 10 mul round 10 div}}bar\\3pt
+foo \makebox[3.5em][l]{\psPrintValue[dot,PSfont=Symbol,decimals=6,
+ postString=\string\260]{3.14 dup mul}}bar
+\end{center}
+
+\bigskip
+
+\begin{lstlisting}
+foo \makebox[2em][l]{\psPrintValue[dot]{3.14 10 mul round 10 div}}bar\\3pt
+foo \makebox[2em][l]{\psPrintValue[dot,PSfont=Symbol,
+ postString=\string\260]{3.14 10 mul round 10 div}}bar\\3pt
+foo \makebox[3.5em][l]{\psPrintValue[dot,PSfont=Symbol,decimals=6,
+ postString=\string\260]{3.14 dup mul}}bar
+\end{lstlisting}
+
+
+
+
+
+
\clearpage
\section{List of all optional arguments for \texttt{pst-tools}}
diff --git a/Master/texmf-dist/dvips/pst-tools/pst-tools.pro b/Master/texmf-dist/dvips/pst-tools/pst-tools.pro
new file mode 100644
index 00000000000..971f66a1f21
--- /dev/null
+++ b/Master/texmf-dist/dvips/pst-tools/pst-tools.pro
@@ -0,0 +1,231 @@
+% $Id: pst-tools.pro 713 2012-10-16 14:25:00Z herbert $
+%
+%% PostScript tools prologue for pstricks.tex.
+%% Version 0.03, 2012/10/16
+%%
+%% This program can be redistributed and/or modified under the terms
+%% of the LaTeX Project Public License Distributed from CTAN archives
+%% in directory macros/latex/base/lppl.txt.
+%
+%
+/Pi2 1.57079632679489661925640 def
+/factorial { % n on stack, returns n!
+ dup 0 eq { 1 }{
+ dup 1 gt { dup 1 sub factorial mul } if }
+ ifelse } def
+%
+/MoverN { % m n on stack, returns the binomial coefficient m over n
+ 2 dict begin
+ /n exch def /m exch def
+ n 0 eq { 1 }{
+ m n eq { 1 }{
+ m factorial n factorial m n sub factorial mul div } ifelse } ifelse
+ end
+} def
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% subroutines for complex numbers, given as an array [a b]
+% which is a+bi = Real+i Imag
+%
+/cxadd { % [a1 b1] [a2 b2] = [a1+a2 b1+b2]
+ dup 0 get % [a1 b1] [a2 b2] a2
+ 3 -1 roll % [a2 b2] a2 [a1 b1]
+ dup 0 get % [a2 b2] a2 [a1 b1] a1
+ 3 -1 roll % [a2 b2] [a1 b1] a1 a2
+ add % [a2 b2] [a1 b1] a1+a2
+ 3 1 roll % a1+a2 [a2 b2] [a1 b1]
+ 1 get % a1+a2 [a2 b2] b1
+ exch 1 get % a1+a2 b1 b2
+ add 2 array astore
+} def
+%
+/cxneg { % [a b]
+ dup 1 get % [a b] b
+ exch 0 get % b a
+ neg exch neg % -a -b
+ 2 array astore
+} def
+%
+/cxsub { cxneg cxadd } def % same as negative addition
+%
+% [a1 b1][a2 b2] = [a1a2-b1b2 a1b2+b1a2] = [a3 b3]
+/cxmul { % [a1 b1] [a2 b2]
+ dup 0 get % [a1 b1] [a2 b2] a2
+ exch 1 get % [a1 b1] a2 b2
+ 3 -1 roll % a2 b2 [a1 b1]
+ dup 0 get % a2 b2 [a1 b1] a1
+ exch 1 get % a2 b2 a1 b1
+ dup % a2 b2 a1 b1 b1
+ 5 -1 roll dup % b2 a1 b1 b1 a2 a2
+ 3 1 roll mul % b2 a1 b1 a2 b1a2
+ 5 -2 roll dup % b1 a2 b1a2 b2 a1 a1
+ 3 -1 roll dup % b1 a2 b1a2 a1 a1 b2 b2
+ 3 1 roll mul % b1 a2 b1a2 a1 b2 a1b2
+ 4 -1 roll add % b1 a2 a1 b2 b3
+ 4 2 roll mul % b1 b2 b3 a1a2
+ 4 2 roll mul sub % b3 a3
+ exch 2 array astore
+} def
+%
+% [a b]^2 = [a^2-b^2 2ab] = [a2 b2]
+/cxsqr { % [a b] square root
+ dup 0 get exch 1 get % a b
+ dup dup mul % a b b^2
+ 3 -1 roll % b b^2 a
+ dup dup mul % b b^2 a a^2
+ 3 -1 roll sub % b a a2
+ 3 1 roll mul 2 mul % a2 b2
+ 2 array astore
+} def
+%
+/cxsqrt { % [a b]
+% dup cxnorm sqrt /r exch def
+% cxarg 2 div RadtoDeg dup cos r mul exch sin r mul cxmake2
+ cxlog % log[a b]
+ 2 cxrdiv % log[a b]/2
+ aload pop exch % b a
+ 2.781 exch exp % b exp(a)
+ exch cxconv exch % [Re +iIm] exp(a)
+ cxrmul %
+} def
+%
+/cxarg { % [a b]
+ aload pop % a b
+ exch atan % arctan b/a
+ DegtoRad % arg(z)=atan(b/a)
+} def
+%
+% log[a b] = [a^2-b^2 2ab] = [a2 b2]
+/cxlog { % [a b]
+ dup % [a b][a b]
+ cxnorm % [a b] |z|
+ log % [a b] log|z|
+ exch % log|z|[a b]
+ cxarg % log|z| Theta
+ cxmake2 % [log|z| Theta]
+} def
+%
+% square of magnitude of complex number
+/cxnorm2 { % [a b]
+ dup 0 get exch 1 get % a b
+ dup mul % a b^2
+ exch dup mul add % a^2+b^2
+} def
+%
+/cxnorm { % [a b]
+ cxnorm2 sqrt
+} def
+%
+/cxconj { % conjugent complex
+ dup 0 get exch 1 get % a b
+ neg 2 array astore % [a -b]
+} def
+%
+/cxre { 0 get } def % real value
+/cxim { 1 get } def % imag value
+%
+% 1/[a b] = ([a -b]/(a^2+b^2)
+/cxrecip { % [a b]
+ dup cxnorm2 exch % n2 [a b]
+ dup 0 get exch 1 get % n2 a b
+ 3 -1 roll % a b n2
+ dup % a b n2 n2
+ 4 -1 roll exch div % b n2 a/n2
+ 3 1 roll div % a/n2 b/n2
+ neg 2 array astore
+} def
+%
+/cxmake1 { 0 2 array astore } def % make a complex number, real given
+/cxmake2 { 2 array astore } def % dito, both given
+%
+/cxdiv { cxrecip cxmul } def
+%
+% multiplikation by a real number
+/cxrmul { % [a b] r
+ exch aload pop % r a b
+ 3 -1 roll dup % a b r r
+ 3 1 roll mul % a r b*r
+ 3 1 roll mul % b*r a*r
+ exch 2 array astore % [a*r b*r]
+} def
+%
+% division by a real number
+/cxrdiv { % [a b] r
+ 1 exch div % [a b] 1/r
+ cxrmul
+} def
+%
+% exp(i theta) = cos(theta)+i sin(theta) polar<->cartesian
+/cxconv { % theta
+ RadtoDeg dup sin exch cos cxmake2
+} def
+
+%%%%% ### bubblesort ###
+%% syntax : array bubblesort --> array2 trie par ordre croissant
+%% code de Bill Casselman
+%% http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/
+/bubblesort { % on stack must be an array [ ... ]
+4 dict begin
+ /a exch def
+ /n a length 1 sub def
+ n 0 gt {
+ % at this point only the n+1 items in the bottom of a remain to
+ % the sorted largest item in that blocks is to be moved up into
+ % position n
+ n {
+ 0 1 n 1 sub {
+ /i exch def
+ a i get a i 1 add get gt {
+ % if a[i] > a[i+1] swap a[i] and a[i+1]
+ a i 1 add
+ a i get
+ a i a i 1 add get
+ % set new a[i] = old a[i+1]
+ put
+ % set new a[i+1] = old a[i]
+ put
+ } if
+ } for
+ /n n 1 sub def
+ } repeat
+ } if
+ a % return the sorted array
+end
+} def
+%
+/concatstringarray{ % [(a) (b) ... (z)] --> (ab...z) 20100422
+ 0 1 index { length add } forall
+ string
+ 0 3 2 roll
+ { 3 copy putinterval length add }forall
+ pop
+} bind def
+%
+/dot2comma {% on stack a string (...)
+ 2 dict begin
+ /Output exch def
+ 0 1 Output length 1 sub {
+ /Index exch def
+ Output Index get 46 eq { Output Index 44 put } if
+ } for
+ Output
+ end
+} def
+%
+/rightTrim {
+ dup
+ length 1 sub -1 0 {
+ /i exch def dup i get 32 ne { exit } if
+ } for
+ 0 i 1 add getinterval
+ dup length string copy
+} bind def
+
+/psStringwidth /stringwidth load def
+/psShow /show load def
+
+%/stringwidth{ rightTrim psStringwidth } bind def
+
+%/show { rightTrim psShow } bind def
+%-----------------------------------------------------------------------------%
+% END pst-tools.pro
diff --git a/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex b/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex
index a6e4cad0e72..81885f0fea8 100644
--- a/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex
+++ b/Master/texmf-dist/tex/generic/pst-tools/pst-tools.tex
@@ -26,17 +26,20 @@
% interface to the `xkeyval' package
\pst@addfams{pst-tools}
%
-\def\fileversion{0.1}
-\def\filedate{2012/01/01}
+\def\fileversion{0.02}
+\def\filedate{2012/10/16}
\message{`PST-tools' v\fileversion, \filedate\space (hv)}
%
\define@boolkey[psset]{pst-tools}[Pst@]{dot}[true]{}
+\define@boolkey[psset]{pst-tools}[Pst@]{trimSpaces}[true]{}
\define@key[psset]{pst-tools}{xShift}[0]{\def\psk@xShift{#1}}
+\define@key[psset]{pst-tools}{postString}[]{\def\psk@postString{#1}}
\define@key[psset]{pst-tools}{PSfont}[Times-Roman]{\def\psk@PSfont{/#1 }}
\define@key[psset]{pst-tools}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth }
\define@key[psset]{pst-tools}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale }
\define@key[psset]{pst-tools}{decimals}[-1]{\pst@getint{#1}\psk@decimals }
-\psset[pst-tools]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1,xShift=0,dot}
+\psset[pst-tools]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1,
+ xShift=0,dot,trimSpaces=false,postString={}}
%
\def\psPrintValue{\pst@object{psPrintValue}}
\def\psPrintValue@i#1{\expandafter\psPrintValue@ii#1,,\@nil}
@@ -51,6 +54,9 @@
\else #1 \fi
\psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
\psk@valuewidth string cvs %/Output exch def % save output
+%/concatstringarray{ % [(a) (b) ... (z)] --> (ab...z) 20100422
+ \ifx\relax\psk@postString\relax\else [ exch (\psk@postString) ] concatstringarray \fi
+ \ifPst@trimSpaces rightTrim \fi
\ifPst@dot dot2comma \fi % do we have to change dot to comma
\psk@xShift\space 0 moveto %Output
show grestore