File: pspic.sty

package info (click to toggle)
dvipsk-ja 5.86g%2Bjp1.5f-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,600 kB
  • ctags: 3,930
  • sloc: ansic: 37,961; sh: 3,838; makefile: 706; perl: 365; csh: 47; awk: 35
file content (168 lines) | stat: -rw-r--r-- 6,346 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
\typeout{Document Style `PostScript PICTURE' <jan 22 1991>.}
%----------------------------------------------------------------------
%
%    PostScript PICTURE
%
%    For use with DVIPS (by Tomas Rokicki)
%
%
%    By: Kresten Krab Thorup, University of Aalborg, Denmark
%        <krab@iesd.auc.dk>
%        January 1991
%
%----------------------------------------------------------------------
%
% ==================================
%             psbox
% ==================================
%
\def\psbox#1{%
 \vbox{%
  \hbox{%
   \special{" \number\unitlength.0 65781.75 div dup scale 
              picdict begin
	      /lwidth \number\@wholewidth.0 \number\unitlength.0 div def
              lwidth setlinewidth	
              \moveto(0,0) #1 end}}}}
%
% ==================================
%  Commands for use in \psbox
% ==================================
%
\def\moveto(#1,#2){ /x #1 def /y #2 def x y moveto}
\def\rline(#1,#2){ newpath 
         x y moveto 
	 #1 #2 rlineto 
	 linedash 0 setdash stroke 
     /x x #1 add def 
     /y y #2 add def}
%
% ==================================
%   Commands for use in LaTeX 
% ==================================
%
%----------------------------------------------------------------------
% \line command of LaTeX
%----------------------------------------------------------------------
\def\line(#1,#2)#3{\psbox{%
     \@ccolour setgray
     /linedash \linedash def
        #1 0 eq
	    {/fac{#2 abs div #3 mul}def} 
	    {/fac{#3 #1 abs div mul}def}
        ifelse
    \rline( #1 fac , #2 fac ) }}
%----------------------------------------------------------------------
% \vector command of LaTeX
%----------------------------------------------------------------------
\def\vector(#1,#2)#3{\psbox{%
   \@ccolour setgray
   /linedash \linedash def 
        #1 0 eq
	    {/fac{#2 abs div #3 mul}def} 
	    {/fac{#3 #1 abs div mul}def}
        ifelse
   newpath 
      0 0 #1 fac #2 fac lwidth lwidth \number\headwidth.0 mul 
      lwidth \number\headlength.0 mul arrow fill}}
%----------------------------------------------------------------------
% \circle and \circle* commands of LaTeX
%----------------------------------------------------------------------
\def\circle{\@ifstar{\@dot}{\@circle}}
\def\@circle#1{\psbox{ newpath 
          0 0 #1 2 div 0 360 arc 
	  [] 0 setdash 
	  \@ccolour setgray stroke}}
\def\@dot#1{\psbox{newpath 
          0 0 #1 2 div 0 360 arc 
	  \@ccolour setgray fill}}
%----------------------------------------------------------------------
% \bezier(x1,y1)(x2,y2)(x3,y3)
%----------------------------------------------------------------------
\def\bezier(#1,#2)(#3,#4)(#5,#6){%
\psbox{#1 #2 #3 #4 #5 #6 curveto \@ccolour setgray \linedash 0 setdash stroke}%
}%
%----------------------------------------------------------------------
% \oval command of LaTeX
%----------------------------------------------------------------------
\def\oval(#1,#2){\@ifnextchar[{\@oval(#1,#2)}{\@oval(#1,#2)[full]}}
\def\@oval(#1,#2)[#3]{%
   \begingroup 
   \@ovxx = #1\unitlength 
   \@ovyy =#2\unitlength 
   \@tempdimb \ifdim \@ovyy >\@ovxx =\@ovxx\else =\@ovyy \fi 
   \ifnum\@tempdimb>\maxovaldiam \@tempdimb=\maxovaldiam \fi 
   \psbox{/rad \number\@tempdimb.0 \number\unitlength.0 div 2 div def 
         /dx #1 2 div rad sub def 
	 /dy #2 2 div rad sub def 
         \@ccolour setgray
	    newpath #3 [] 0 setdash stroke }%
   \endgroup}
%----------------------------------------------------------------------
% \ctext{...}  Text to be written with the current grayscale
%----------------------------------------------------------------------
\def\ctext#1{\special{ps:gsave \@ccolour
                  setgray}{}#1\special{ps:grestore}}
%----------------------------------------------------------------------
% Customization 
%----------------------------------------------------------------------
\def\vectorhead#1#2{\headlength=#1 \headwidth=#2 }
\def\dashpattern[#1]{\xdef\linedash{[#1] }}        
\def\colour#1{\def\@ccolour{\@nameuse{CC#1}}}
\def\shade#1{\def\@ccolour{ 1 #1 100 div sub }}
%
% ==================================
%          Initialization
% ==================================
%
\newdimen\maxovaldiam 
\maxovaldiam=14mm                   % Max diameter of LaTeX circle
%
\newcount\headlength                % length of arrowhead in terms of
				    % linewidth
\newcount\headwidth                 % width of arrowhead in terms of linewidth
\vectorhead{9}{5}                   % default vectorhead dimentions
%
\dashpattern[]                      % set default type of linedashes 
%
\def\CCwhite{1 }
\def\CCblack{0 }
\def\CCgray{.5 }
\def\CClightgray{.75 }
\def\CCdarkgray{.25 }
\colour{black}
%----------------------------------------------------------------------
% The P*stScr*pt dictionary
%----------------------------------------------------------------------
\special{!/picdict 200 dict def picdict begin 
/tr { 0 0 moveto newpath dx dy rad 0 90 arc} def 
/tl { 0 0 moveto newpath -1 dx mul dy rad 90 180 arc} def 
/bl { 0 0 moveto newpath -1 dx mul -1 dy mul rad 180 270 arc} def 
/br { 0 0 moveto newpath dx -1 dy mul rad 270 360 arc} def 
/b { bl stroke newpath br -1 dx mul -1 dy mul rad sub moveto dx 2 mul
     0 rlineto} def 
/t { tl stroke newpath tr -1 dx mul dy rad add moveto dx 2 mul 0
     rlineto } def
/l { bl stroke newpath tl -1 dx mul rad sub -1 dy mul moveto 0 dy 2
     mul rlineto } def 
/r { tr stroke newpath br dx rad add -1 dy mul moveto 0 dy 2 mul
     rlineto } def
/full { t stroke newpath r stroke newpath b stroke newpath l } def 
/mtrx matrix def 
%
/arrow { 
/headlength exch def /halfheadthickness exch 2 div def
/halfthickness exch 2 div def /tipy exch def /tipx exch def /taily
exch def /tailx exch def /dx tipx tailx sub def /dy tipy taily sub def
/arrowlength dx dx mul dy dy mul add sqrt def /angle dy dx atan def
/base arrowlength headlength sub def /savematrix mtrx currentmatrix
def tailx taily translate angle rotate gsave newpath 0 0 moveto base 0
lineto linedash 0 setdash stroke grestore base halfheadthickness neg
moveto arrowlength 0 lineto base halfheadthickness lineto base
halfthickness lineto closepath savematrix setmatrix
} def
%%
end}
%----------------------------------------------------------------------
%  end of pspic.sty
%----------------------------------------------------------------------