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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
|
%% BEGIN pst-eps.tex
%%
%% Writing EPS files with PSTricks 97.
%% See the PSTricks User's Guide for description.
%%
%%
%% COPYRIGHT 1993, 1994, 1999 by Timothy Van Zandt, tvz@nwu.edu.
%% COPYRIGHT 2006 by Herbert Voss, hvoss@tug.org.
%%
%% 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.
%%
\csname PSTfilesLoaded\endcsname
\let\PSTfilesLoaded\endinput
\ifx\PSTricksLoaded\endinput\else
\def\next{\input pstricks.tex}
\expandafter\next
\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey\fi
%
\def\fileversion{1.00}
\def\filedate{2006/11/04}
\message{ v\fileversion, \filedate}
%
\edef\TheAtCode{\the\catcode`\@}
\catcode`\@=11
\pst@addfams{pst-eps}
% Exporting PostScript files
% DG/SR modification begin - May 5, 1997 - Patch 1
% With LaTeX 2e, we must force now inclusion of header files
%\def\TeXtoEPS{\begingroup\pst@makebox{}\bgroup\ignorespaces}
\def\TeXtoEPS{%
\ifx\documentclass\@undefined\else\@begindvi\fi
\begingroup\pst@makebox{}\bgroup\ignorespaces}
% DG/SR modification end
\def\endTeXtoEPS{%
\egroup
% Get contents of page, in case it contains special's:
\begingroup
\global\setbox\pst@boxg\box\voidb@x
\output{\global\setbox\pst@boxg\box\@cclv}%
\par\hbox{}\penalty-10000
\endgroup
\dp\pst@boxg\z@
\ht\pst@boxg\z@
\wd\pst@boxg\z@
\pst@dimg=3pt
\shipout\hbox{%
\box\pst@boxg
\pst@Verb{gsave CM \tx@STV CP newpath moveto
\pst@number\pst@dimg neg 0 rmoveto clip setmatrix}%
\vrule width \wd\pst@hbox height \ht\pst@hbox depth \dp\pst@hbox
\pstVerb{currentpoint grestore moveto}%
\kern -\wd\pst@hbox
\unhbox\pst@hbox}%
\endgroup
\typeout{PSTricks: Converting TeX box to EPS.}%
\typeout{\@spaces\@spaces\space\space With dvips, use -E option.}}
% Writing PSTricks graphics to EPS files
\newwrite\pst@epsout
\newwrite\pst@tempout
\def\pst@getbp#1#2#3{%
\csname psset#1length\endcsname\pst@dimg{#2}%
\advance\pst@dimg .49bp
\pst@cntg=\pst@dimg
\multiply\pst@cntg 5
\divide\pst@cntg 328909
\edef#3{\the\pst@cntg}}
\define@key[psset]{pst-eps}{bbllx}{\pst@getbp{x}{#1}\psk@bbllx}
\define@key[psset]{pst-eps}{bblly}{\pst@getbp{y}{#1}\psk@bblly}
\define@key[psset]{pst-eps}{bburx}{\pst@getbp{x}{#1}\psk@bburx}
\define@key[psset]{pst-eps}{bbury}{\pst@getbp{y}{#1}\psk@bbury}
\psset[pst-eps]{bbllx=-1pt,bblly=-1pt,bburx=1pt,bbury=1pt}
\define@key[psset]{pst-eps}{headers}{%
\def\pst@tempg{#1}
\ifx\pst@tempg\@none
\def\psk@headers{\z@}% 0 -> none
\else
\def\pst@temph{all}%
\ifx\pst@tempg\pst@temph
\def\psk@headers{2\relax}% 2 -> all
\else
\def\psk@headers{1\relax}% 1 -> user
\fi
\fi}
%
\define@key[psset]{pst-eps}{headerfile}{\def\psk@headerfile{#1}}
\define@boolkey[psset]{pst-eps}[Pst@]{checkfile}[true]{}
\psset[pst-eps]{headers=none,checkfile=true,headerfile={}}
\define@key[psset]{pst-eps}{makeeps}{%
\def\pst@tempg{#1}%
\ifx\pst@tempg\@none
\def\psk@makeeps{\z@}% 0 -> none
\else
\def\pst@temph{all}%
\ifx\pst@tempg\pst@temph
\def\psk@makeeps{3\relax}% 3 -> all
\else
\def\pst@temph{all*}% 2 -> all*
\ifx\pst@tempg\pst@temph
\def\psk@makeeps{2\relax}%
\else
\def\psk@makeeps{1\relax}% 1 -> new
\fi
\fi
\fi}
\psset[pst-eps]{makeeps=new}
%
\def\pst@checkfile#1{%
\typeout{pst-eps: check for file #1}
\ifcase\psk@makeeps
\@pstfalse
\or
\immediate\openin1=#1
\ifeof1\relax\@psttrue\else\@pstfalse\fi
\immediate\closein1
\or
\immediate\openin1=#1
\ifeof1
\@psttrue
\else
\ifPst@checkfile
\typeout{^^J
PSTricks warning:^^J
!! File `#1' exists and will be erased if in current directory!^^J
!! Make `#1'? (y=yes; n=no)}
\read16 to \pst@tempg
\if y\pst@tempg\relax \@psttrue\else\@pstfalse\fi
\else\@psttrue\fi
\fi
\immediate\closein1
\or\@psttrue
\fi}
%
\def\PSTtoEPS{\def\pst@par{}\pst@object{PSTtoEPS}}
\begingroup
\catcode`\%=12
\catcode`\"=14
\long\gdef\PSTtoEPS@i#1#2{"
\begingroup
\use@par
\newlinechar`\^^J"
\pst@checkfile{#1}"
\if@pst
\immediate\openout\pst@epsout=#1
\def\write@eps##1{\immediate\write\pst@epsout{##1}}"
\def\addto@pscode##1{"
\begingroup
\newlinechar`\ "
\write@eps{##1}"
\endgroup}
\write@eps{"
%!PS-Adobe-3.0 EPSF-3.0^^J"
%%Creator: PSTricks^^J"
%%Title: #1^^J"
%%CreationDate: \the\year/\the\month/\the\day^^J"
%%BoundingBox:
\psk@bbllx\space\psk@bblly\space\psk@bburx\space\psk@bbury^^J"
%%EndComments}"
\ifcase\psk@headers
\def\pst@tempg{}"
\or
\let\pst@tempg\psk@headerfile
\or
\edef\pst@tempg{\pst@theheaders,\psk@headerfile}"
\fi
\ifx\pst@tempg\@empty\else
\expandafter\pst@writeheaders\pst@tempg,\@nil
\fi
\write@eps{%%BeginSetup}"
\addto@pscode\pst@dict
\write@eps{%%EndSetup}"
\ifdim\pstunit=1bp\else
\pst@dimg=\pstunit\relax
\write@eps{\number\pst@dimg\space 65781.8 div dup scale}"
\fi
\addto@pscode{"
\tx@STP
0 setlinecap
0 setlinejoin
10 setmiterlimit
[] 0 setdash
newpath}"
\setbox\pst@hbox=\hbox{"
\def\init@pscode{"
\write@eps{"
gsave
\psk@origin
\psk@swapaxes
\pst@number\pslinewidth SLW
\pst@usecolor\pslinecolor}}"
\def\use@pscode{\write@eps{grestore}}"
\let\pst@rawfile\pst@filetoeps
\def\psclip#1{\pst@misplaced\psclip}"
\let\endpsclip\relax
\def\pstextpath@@@[##1](##2,##3)##4{\pst@misplaced\pstextpath}"
\def\nc@object##1##2##3##4{\pst@misplaced{node connection}}"
\def\PSTtoEPS@i##1##2{\pst@misplaced\PSTtoEPS}"
#2}"
\write@eps{"
%%Trailer^^J"
end^^J"
%%EOF}"
\immediate\closeout\pst@epsout
\fi
\endgroup
\ignorespaces}
\gdef\pst@writeheaders#1,{"
\def\pst@tempg{#1}"
\ifx\pst@tempg\@empty\else
\write@eps{%%BeginProcSet: #1}"
\pst@filetoeps{#1}"
\write@eps{%%EndProcSet}"
\fi
\@ifnextchar\@nil{\let\pst@tempg}{\pst@writeheaders}}
\endgroup
\def\pst@filetoeps#1{%
\begingroup
\def\do##1{\catcode`##1=12\relax}%
\dospecials
\def\addto@pscode##1{\write@eps{##1}}%
\pst@@rawfile{#1}%
\endgroup}
\catcode`\@=\TheAtCode\relax
\endinput
%%
%% END pst-eps.tex
|