1
%% These are from tex.lpro
2
/TeXDict 250 dict def % define a working dictionary ( IBM: color - 200->250 )
3
TeXDict begin % start using it.
12
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13
%% header for the \special command
14
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15
% The structure of the PostScript produced by dvips for \special is:
17
% - any number of @hsize, @hoffset, @hscale, etc., commands
19
% - the user's file of PostScript commands
37
/letter {} N /note {} N /a4 {} N /legal {} N
41
% The following definition sets up the units that hscale/vscale are in.
42
% For certain sites this might require change, but it is
43
% recommended instead that any macro packages that require
44
% hscale/vscale set the units appropriately via
46
% \special{! /@scaleunit 1 def }
50
% \special{" /@scaleunit 1 def }
52
% before each instance if multiple macro packages with
53
% different requirements are being used.
56
% s @hscale - set scale factor
57
/@hscale {@scaleunit div /hsc X} B
58
/@vscale {@scaleunit div /vsc X} B
60
% d @hsize - specify a horizontal clipping dimension
61
/@hsize {/hs X /CLIP 1 N} B
62
/@vsize {/vs X /CLIP 1 N} B
66
% d @hoffset - specify a shift for the figure
70
% a @angle - set rotation angle
74
% Here we handle bounding box calculations, if necessary.
76
/@rwi { 10 div /rwi X /rwiSeen true N } B % rwi will be real width after scaling
77
/@rhi { 10 div /rhi X /rhiSeen true N } B % rhi will be real height after scaling
88
{ userdict /md known % if md is defined
89
{ userdict /md get type /dicttype eq % and if it is a dictionary
91
userdict begin % expand it if necessary
92
md length 10 add md maxlength ge
93
{/md md dup length 20 add dict copy def}if
95
md begin % then redefine some stuff
100
1 0 mtx defaultmatrix dtransform S atan/pa X
101
newpath clippath mark
102
{transform{itransform moveto}}
103
{transform{itransform lineto}}
104
{ 6 -2 roll transform
107
{ itransform 6 2 roll
114
pathforall newpath counttomark array astore /gc xdf
116
10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}if
119
pxs pys scale ppr aload pop
122
pop S neg S TR pop 1 -1 scale
125
pop S neg S TR 180 rotate 1 -1 scale
126
ppr 3 get ppr 1 get neg sub neg ppr 2 get
127
ppr 0 get neg sub neg TR
129
xflip yflip not and {
130
pop S neg S TR pop 180 rotate
131
ppr 3 get ppr 1 get neg sub neg 0 TR
133
yflip xflip not and {
134
ppr 1 get neg ppr 0 get neg TR
139
TR pop pop 270 rotate 1 -1 scale
142
TR pop pop 90 rotate 1 -1 scale
143
ppr 3 get ppr 1 get neg sub neg ppr 2 get
144
ppr 0 get neg sub neg TR
146
xflip yflip not and {
147
TR pop pop 90 rotate ppr 3 get
148
ppr 1 get neg sub neg 0 TR
150
yflip xflip not and {
151
TR pop pop 270 rotate ppr 2 get
152
ppr 0 get neg sub neg 0 S TR
156
ppr aload pop 4 -1 roll add 2 div 3 1 roll add 2 div 2 copy
157
TR .96 dup scale neg S neg S TR
160
/cp {pop pop showpage pm restore}N
167
% The following procedure brings us back to PostScript size. It takes
168
% into account the current global dvi magnification, so graphics
169
% scale with the document.
172
Resolution 72 div VResolution 72 div neg scale
173
magscale { DVImag dup scale } if
177
% We need the psfig macros.
179
% All software, documentation, and related files in this distribution of
180
% psfig/tex are Copyright (c) 1987 Trevor J. Darrell
182
% Permission is granted for use and non-profit distribution of psfig/tex
183
% providing that this notice be clearly maintained, but the right to
184
% distribute any portion of psfig/tex for profit or as part of any commercial
185
% product is specifically reserved for the author.
188
% psfigTeX PostScript Prolog
189
% $Header: /usr/local/src/TeX/Dvips-5.0.2/RCS/special.lpro,v 1.1 90/03/10 20:32:57 grunwald Exp $
191
/psfts { S 65781.76 div N } N
193
% x y bb-llx bb-lly bb-urx bb-ury startTexFig -
195
/psf$SavedState save N
196
userdict maxlength dict begin
200
currentpoint TR %set the current point as the user's origin
209
/psf$sx psf$x psf$urx psf$llx sub div N % scaling for x
210
/psf$sy psf$y psf$ury psf$lly sub div N % scaling for y
212
psf$sx psf$sy scale % scale by (sx,sy)
214
psf$llx neg psf$ury neg TR
222
/p 3 def % necessary to get around a bug in Adobe Illustrator
226
% llx lly urx ury doclip - (args in figure coordinates)
228
psf$llx psf$lly psf$urx psf$ury
229
currentpoint 6 2 roll
240
/endTexFig { end psf$SavedState restore } N
242
% this will be invoked as the result of a \special command (for the
243
% inclusion of PostScript graphics). The basic idea is to change all
244
% scaling and graphics back to defaults, but to shift the origin
245
% to the current position on the page.
247
/@beginspecial % - @beginspecial - -- enter special mode
253
currentpoint TR %set the current point as the user's origin
254
@SpecialDefaults % setup default offsets, scales, sizes, and angle
255
count /ocount X /dcount countdictstack N
258
/@setspecial % to setup user specified offsets, scales, sizes (for clipping)
261
{ newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto
269
rhiSeen { rhi ury lly sub div } { dup } ifelse
270
scale llx neg lly neg TR
272
rhiSeen { rhi ury lly sub div dup scale llx neg lly neg TR } if
275
{ newpath llx lly moveto urx lly lineto urx ury lineto llx ury lineto
284
/@endspecial % - @endspecial - -- leave special mode
285
{ count ocount sub {pop} repeat
286
countdictstack dcount sub {end} repeat
287
grestore SpecialSave restore
291
% xdvik special treatment for saving definitions made in SDict (while using
292
% the bang special; try to guarantee that the dictionary stack is ok!
293
% xdvik should not systematically bracket code within save/restore pairs,
294
% anyway: such bracketing breaks a lot of code (many packages do change
295
% TeXDict from with ps: specials for instance) and we should only guarantee
296
% that bracketing is done within @beginspecial and @endspecial. -- YA
300
userdict /xdvi$sav save put
312
end % revert to previous dictionary