Gravitation : le problème des 2 corps. Partie 1 : Documentation théorique.
[pst-eqdf.git] / gravitation / pst-tools.tex
1 %% $Id: pst-tools.tex 599 2011-11-03 19:38:28Z herbert $
2 %%
3 %% This is file `pst-tools.tex',
4 %%
5 %% IMPORTANT NOTICE:
6 %%
7 %% Package `pst-tools.tex'
8 %%
9 %% Herbert Voss <hvoss@tug.org>
10 %%
11 %% This program can be redistributed and/or modified under the terms
12 %% of the LaTeX Project Public License Distributed from CTAN archives
13 %% in directory macros/latex/base/lppl.txt.
14 %%
15 %% DESCRIPTION:
16 %% `pst-tools' is a PSTricks package for helper functions
17 %%
18 %%
19 \csname PSTtoolsLoaded\endcsname
20 \let\PSTtoolsLoaded\endinput
21
22 \ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
23 \ifx\PSTXKeyLoaded\endinput\else \input pst-xkey.tex \fi
24 %
25 \edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
26 % interface to the `xkeyval' package
27 \pst@addfams{pst-tools}
28 %
29 \def\fileversion{0.1}
30 \def\filedate{2012/01/01}
31 \message{`PST-tools' v\fileversion, \filedate\space (hv)}
32 %
33 \define@boolkey[psset]{pst-tools}[Pst@]{dot}[true]{}
34 \define@key[psset]{pst-tools}{xShift}[0]{\def\psk@xShift{#1}}
35 \define@key[psset]{pst-tools}{PSfont}[Times-Roman]{\def\psk@PSfont{/#1 }}
36 \define@key[psset]{pst-tools}{valuewidth}[10]{\pst@getint{#1}\psk@valuewidth }
37 \define@key[psset]{pst-tools}{fontscale}[10]{\pst@checknum{#1}\psk@fontscale }
38 \define@key[psset]{pst-tools}{decimals}[-1]{\pst@getint{#1}\psk@decimals }
39 \psset[pst-tools]{PSfont=Times-Roman,fontscale=10,valuewidth=10,decimals=-1,xShift=0,dot}
40 %
41 \def\psPrintValue{\pst@object{psPrintValue}}
42 \def\psPrintValue@i#1{\expandafter\psPrintValue@ii#1,,\@nil}
43 \def\psPrintValue@ii#1,#2,#3\@nil{% #1,#2 only for algebraic code
44 \begin@SpecialObj
45 \addto@pscode{
46 gsave \psk@PSfont findfont \psk@fontscale scalefont setfont
47 \ifPst@algebraic
48 /x #1 def
49 /Func (#2) tx@AlgToPs begin AlgToPs end cvx def
50 Func
51 \else #1 \fi
52 \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul cvi exch div } if
53 \psk@valuewidth string cvs %/Output exch def % save output
54 \ifPst@dot dot2comma \fi % do we have to change dot to comma
55 \psk@xShift\space 0 moveto %Output
56 show grestore
57 }%
58 \end@SpecialObj%
59 }
60
61 \define@boolkey[psset]{pst-tools}[Pst@]{round}[true]{}%
62 \define@boolkey[psset]{pst-tools}[Pst@]{science}[true]{%
63 \ifPst@science\def\psk@Scin{true }\else\def\psk@Scin{false }\fi}
64 \psset[pst-tools]{science=false,round=false}
65 \def\psPrintValueNew{\pst@object{psPrintValueNew}}
66 \def\psPrintValueNew@i#1{\expandafter\psPrintValueNew@ii#1,,\@nil}
67 \def\psPrintValueNew@ii#1,#2,#3\@nil{% #1,#2 only for algebraic code
68 \begin@SpecialObj
69 \addto@pscode{ % thanks to Buddy Ledger
70 /mfont { \psk@PSfont findfont \psk@fontscale scalefont setfont } bind def
71 /mfontexp { \psk@PSfont findfont \psk@fontscale 1.2 div scalefont setfont } bind def
72 /s1 { /Symbol findfont \psk@fontscale scalefont setfont } bind def
73 \ifPst@algebraic
74 /x #1 def
75 /Func (#2) tx@AlgToPs begin AlgToPs end cvx def
76 Func
77 \else #1 \fi
78 /value ED
79 \psk@Scin {
80 value 0 ne { value log floor cvi /expon ED }{ /expon 0 def } ifelse
81 value 10 expon exp div
82 \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul
83 \ifPst@round round \else cvi \fi exch div } if
84 \psk@decimals 0 eq { cvi } if /numb ED
85 expon \psk@valuewidth string cvs /expon exch def
86 numb \psk@valuewidth string cvs
87 \ifPst@dot dot2comma \fi % do we have to change dot to comma
88 /Output exch def
89 /txspc \psk@fontscale 4 div def
90 \psk@xShift\space 0 moveto mfont Output show
91 txspc 0 rmoveto s1 (\string\264) show
92 txspc 0 rmoveto mfont (10) show
93 txspc 2 div txspc 1.5 mul rmoveto mfontexp expon show }
94 { value
95 \psk@decimals -1 gt { 10 \psk@decimals exp dup 3 1 roll mul
96 \ifPst@round round \else cvi \fi exch div } if
97 \psk@decimals 0 eq { cvi } if %inserted to handle decimals=0
98 \psk@valuewidth string cvs
99 \ifPst@dot dot2comma \fi % do we have to change dot to comma
100 \psk@xShift\space 0 moveto mfont %Output
101 show
102 } ifelse
103 }%
104 \end@SpecialObj%
105 }
106 %
107 \catcode`\@=\PstAtCode\relax
108 %
109 %% END: pst-tools.tex
110 \endinput
111 %

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.