Debian Codegraph @

texmf-dist/tex/latex/bxeepic/bxeepic.sty

raw
1 %
2 % bxeepic.sty
3 %
4
5 %% package declarations
6 \NeedsTeXFormat{LaTeX2e}
7 \ProvidesPackage{bxeepic}[2013/04/28 v0.2]
8
9 %% preparation
10 \def\bxpz@ee@pkgname{bxeepic}
11 \def\bxpz@ee@error{\PackageError\bxpz@ee@pkgname}
12 \def\bxpz@ee@warn{\PackageWarning\bxpz@ee@pkgname}
13 % (errors)
14 \def\bxpz@warn@peald#1{\bxpz@ee@warn
15 {Option '#1' ignored (pict2e already loaded)}}
16 \def\bxpz@warn@wnpnt{\bxpz@ee@warn
17 {Poly-line commands need at least two vertices.}}
18 \def\bxpz@warn@wnstr{\bxpz@ee@warn
19 {Blank lines due to too low stretch value.}}
20 % (globals)
21 \newif\ifbxpz@injoin
22 \newif\ifbxpz@dashset
23 \newif\ifbxpz@eepic@dotl
24 \newif\ifbxpz@uselbl
25 \newif\ifbxpz@first
26 \chardef\bxpz@boxa=8
27
28 %% public parameters
29 %%<*> \dashlinestretch
30 \def\dashlinestretch{0}
31 %%<*> \drawlinestretch
32 \def\drawlinestretch{0}
33 %%<*> \maxovaldiam
34 \newdimen\maxovaldiam \maxovaldiam=40pt
35 %%<*> \epictopgridlabelsep
36 \def\epictopgridlabelsep{2mm}
37 %%<*> \epicbottomgridlabelsep
38 \def\epicbottomgridlabelsep{2\unitlength}
39 %%<*> \epicsidegridlabelsep
40 \def\epicsidegridlabelsep{\spacewidth}
41 %% other initial settings
42 \AtEndOfPackage{%
43 \drawlines
44 \eepicdottedlines
45 \def\bxpz@tmpa{20pt}%
46 %\ifx\maxovalrad\bxpz@tmpa \def\maxovalrad{.5\maxovaldiam}\fi
47 }
48
49 %% internal parameters
50 \def\bxpz@dashlen@drawline{10pt}
51 \def\bxpz@setdash@phase{0}
52 \def\bxpz@dflt@linecap{0}
53 \def\bxpz@dflt@linejoin{0}
54
55 %% dvipdfmx option
56 \IfFileExists{p2e-dvipdfmx.def}{}{%else
57 % if pict2e lacks of proper support of dvipdfmx
58 \@ifpackageloaded{pict2e}{}{%else
59 \DeclareOption{dvipdfmx}{%
60 \PassOptionsToPackage{dvipdfm}{pict2e}%
61 \def\bxpz@begin@picture@hook{\let\pdfliteral\bxpz@pdfliteral}%
62 \def\bxpz@pdfliteral##1{\special{pdf:literal ##1}}%
63 \let\bxpz@org@@picture\@picture
64 \def\@picture{\bxpz@begin@picture@hook \bxpz@org@@picture}%
65 }%
66 }%
67 }
68 %% option handling
69 \newif\ifbxpz@safe
70 \DeclareOption{safe}{\bxpz@safetrue}
71 \DeclareOption{nosafe}{\bxpz@safefalse}
72 % other options are passed to pict2e
73 \@ifpackageloaded{pict2e}{%
74 \DeclareOption*{\bxpz@warn@peald\CurrentOption}%
75 }{%else
76 \DeclareOption*{\PassOptionsToPackage{\CurrentOption}{pict2e}}%
77 }%
78 \ExecuteOptions{nosafe}
79 \ProcessOptions*
80
81 % load pict2e if not done
82 \@ifpackageloaded{pict2e}{}{\RequirePackage{pict2e}}
83
84 % pretend that epic & eepic are already loaded
85 \@namedef{[email protected]}{2100/01/01}
86 \@namedef{[email protected]}{2100/01/01}
87
88 %%------ mode-dependent stuffs
89
90 %% exits unless in right mode
91 \ifnum\pIIe@mode<\@ne
92 \endinput\expandafter\fi
93
94 %%
95 \ifcase\pIIe@mode\relax
96 \or
97 \def\bxpz@setdash@op{setdash}
98 \or
99 \def\bxpz@setdash@op{d}
100 \fi
101 \def\bxpz@beginarray@op{[}
102 \def\bxpz@endarray@op{]}
103
104 %%------ Poly-line commands
105
106 %% \bxpz@asdraw / \bxpz@asjoin / \bxpz@asmode
107 \def\bxpz@asdraw{\chardef\bxpz@lm@invoke\z@}
108 \def\bxpz@asjoin{\chardef\bxpz@lm@invoke\@ne}
109 \def\bxpz@asmode{\chardef\bxpz@lm@invoke\tw@}
110
111 %%<*> \drawline/\dottedline/\dashline
112 % \dottedline[CHAR]{DOTGAP}(X1,Y1)...(XN,YN)
113 % \dashline[STRETCH]{DASHLEN}[DOTGAP](X1,Y1)...(XN,YN)
114 % * DOTGAP is ignored
115 % \drawline[STRETCH](X1,Y1)...(XN,YN)
116 % * switches to \dashline in case of negative STRETCH
117 \def\drawline{\bxpz@asdraw\bxpz@drawl@a}
118 \def\dottedline{\bxpz@asdraw\bxpz@dotl@a}
119 \def\dashline{\bxpz@asdraw\bxpz@dashl@a}
120 \def\bxpz@drawl@a{\@testopt\bxpz@drawl@b\drawlinestretch}
121 \def\bxpz@drawl@b[#1]{%
122 \ifnum#1<\z@ \def\bxpz@nxt{\bxpz@path{\bxpz@dp@drawl@x{#1}}}%
123 \else \let\bxpz@nxt\bxpz@drawl@c
124 \fi \bxpz@nxt}
125 \def\bxpz@drawl@c{\bxpz@path{\bxpz@dp@drawl}}
126 \def\bxpz@dashl@a{\@testopt\bxpz@dashl@b\dashlinestretch}
127 \def\bxpz@dashl@b[#1]#2{\@testopt{\bxpz@dashl@c{#1}{#2}}{}}
128 \def\bxpz@dashl@c#1#2[#3]{\bxpz@path{\bxpz@dp@dashl{#1}{#2}}}
129 \def\bxpz@dotl@a{\@testopt\bxpz@dotl@b{}}
130 \def\bxpz@dotl@b[#1]#2{\bxpz@path{\bxpz@dp@dotl{#1}{#2}}}
131 %\def\path{\bxpz@asdraw\bxpz@path{}}
132 %% \bxpz@path{<dash-pattern>}
133 \def\bxpz@path#1{%
134 #1\ifcase\bxpz@lm@invoke
135 \expandafter\bxpz@polyline
136 \or \expandafter\bxpz@join@start
137 \or \expandafter\bxpz@dash@mode
138 \fi}
139
140 %% \bxpz@polyline
141 % Same as \polyline in pict2e, except that \bxpz@stroke@graph is
142 % used instead of \pIIe@strokeGraph.
143 \def\bxpz@polyline(#1,#2){%
144 \@killglue
145 \pIIe@moveto{#1\unitlength}{#2\unitlength}%
146 \@ifnextchar\lp@r{\bxpz@polyline@a}%
147 {\ifnum\bxpz@lm@invoke=\z@ \bxpz@warn@wnpnt \fi \ignorespaces}}
148 \def\bxpz@polyline@a(#1,#2){%
149 \pIIe@lineto{#1\unitlength}{#2\unitlength}%
150 \@ifnextchar\lp@r{\bxpz@polyline@a}{\bxpz@stroke@graph\ignorespaces}}
151
152 %%<*> drawjoin / dottedjoin / dashjoin environment
153 % \begin{dottedjoin}[CHAR]{DOTGAP}...\end{dottedjoin}
154 % \begin{dashjoin}[STRETCH]{DASHLEN}[DOTGAP]...\end{dashjoin}
155 % \begin{drawjoin}[STRETCH]...\end{drawjoin}
156 \def\drawjoin{\bxpz@asjoin\bxpz@drawl@a}
157 \def\dottedjoin{\bxpz@asjoin\bxpz@dotl@a}
158 \def\dashjoin{\bxpz@asjoin\bxpz@dashl@a}
159 \def\bxpz@endjoin{\bxpz@join@end\aftergroup\bxpz@join@finale}
160 \let\enddrawjoin\bxpz@endjoin
161 \let\enddottedjoin\bxpz@endjoin
162 \let\enddashjoin\bxpz@endjoin
163
164 %%<*> \jput(X,Y){something}
165 \def\jput(#1,#2){%
166 \ifbxpz@injoin
167 \xdef\bxpz@g@join@last{(#1,#2)}%
168 \xdef\bxpz@g@join@path{\bxpz@g@join@path\bxpz@g@join@last}%
169 \fi \put(#1,#2)}
170 \let\bxpz@g@join@last\relax
171 \let\bxpz@g@join@path\@empty
172
173 %% \bxpz@join@start
174 \def\bxpz@join@start{%
175 \bxpz@renew@join \let\bxpz@dp@join\bxpz@dp
176 \edef\bxpz@wholewidth@join{\the\@wholewidth}%
177 \bxpz@dp@clear \bxpz@injointrue \ignorespaces}
178
179 %% \bxpz@join@end
180 \def\bxpz@join@end{\bxpz@renew@join}
181
182 %% \bxpz@join@finale
183 \def\bxpz@join@finale{%
184 \ifbxpz@injoin\else
185 \global\let\bxpz@g@join@last\relax
186 \global\let\bxpz@g@join@path\@empty
187 \fi \ignorespaces}
188
189 %%<*> \flushjoin
190 \def\flushjoin{%
191 \bxpz@flush@join \global\let\bxpz@g@join@last\relax}
192 %% \bxpz@renew@join
193 \def\bxpz@renew@join{%
194 \bxpz@flush@join
195 \ifx\bxpz@g@join@last\relax\else
196 \global\let\bxpz@g@join@path\bxpz@g@join@last \fi}
197 \def\bxpz@flush@join{%
198 \ifx\bxpz@g@join@path\@empty\else
199 \bgroup \bxpz@asjoin
200 \@wholewidth=\bxpz@wholewidth@join \let\bxpz@dp\bxpz@dp@join
201 \expandafter\bxpz@polyline\bxpz@g@join@path
202 \egroup \global\let\bxpz@g@join@path\@empty
203 \fi}
204
205 %%<*> \drawlines / \dottedlines / \dashlines
206 \def\drawlines{\bxpz@asmode\bxpz@drawl@a}
207 \def\dottedlines{\bxpz@asmode\bxpz@dotl@a}
208 \def\dashlines{\bxpz@asmode\bxpz@dashl@a}
209
210 %% \bxpz@dash@mode
211 \def\bxpz@dash@mode{%
212 \let\bxpz@dp@mode\bxpz@dp \bxpz@dp@clear \ignorespaces}
213
214 %%<*>\path(X1,Y1)..(Xn,Yn)
215 \def\path{\bxpz@asdraw \bxpz@polyline}
216
217 %%------ Dash-pattern generator
218
219 % A dash-pattern generator defines \bxpz@dp to be
220 % {<PS dash array>}{<dash flag>}
221 % where <dash flag> means: 0 = normal; 1 = ordinary dotted line,
222 % line-width adjustment is needed; 2 = character dotted line.
223
224 %% \bxpz@dp@drawl
225 \def\bxpz@dp@drawl{\let\bxpz@dp\bxpz@dp@drawl@val}
226 %% \bxpz@dp@dotl{<IGNORED>}{<dot-gap>}
227 \def\bxpz@dp@dotl#1#2{\bxpz@dp@start
228 \bxpz@addto@dp@nums{\@wholewidth}{#2\unitlength}%
229 \gdef\bxpz@g@dpflag{1}\bxpz@dp@end}
230 %% \bxpz@dp@drawl@x{<stretch>}
231 % For \drawline with negative stretch.
232 \def\bxpz@dp@drawl@x#1{\bxpz@dp@dashl@sub{%
233 \@tempcnta=#1\relax\multiply\@tempcnta\tw@
234 \@tempdima=\bxpz@dashlen@drawline}}
235 %% \bxpz@dp@dashl{<stretch>}{<dash-length>}
236 \def\bxpz@dp@dashl#1#2{\bxpz@dp@dashl@sub{%
237 \@tempcnta=#1\relax\advance\@tempcnta-100
238 \@tempdima=#2\unitlength}}
239 % \bxpz@dp@dashl@sub
240 % Here dash gap length is calculated so that 'ink ratio' in resulted
241 % lines equals the value derived from the given stretch value.
242 % ink ratio: (blank)0.0 0.5 1.0(solid)
243 % \drawline stretch: -100 .. -50 .. 0
244 % \dashline stretch: -100 .. 0 .. 100
245 \def\bxpz@dp@dashl@sub#1{\bxpz@dp@start
246 #1% here \@tempcnta is adjusted in range -200..0
247 \ifnum\@tempcnta<\z@
248 \ifnum\@tempcnta>-200 %
249 \@tempdimb=-\@tempcnta\@tempdima
250 \advance\@tempcnta200 \divide\@tempdimb\@tempcnta
251 \bxpz@addto@dp@nums{\@tempdima}{\@tempdimb}%
252 \else % 'blank' lines
253 \bxpz@warn@wnstr \bxpz@addto@dp@nums{\z@}{1000pt}%
254 \fi
255 \fi % if \@tempcnta >=0 then do nothing (solid lines)
256 \bxpz@dp@end}
257 % some internal stuffs
258 \def\bxpz@dp@start{%
259 \bgroup \global\let\bxpz@g@dp\@empty \gdef\bxpz@g@dpflag{0}}
260 \def\bxpz@dp@end{
261 \egroup \edef\bxpz@dp{{\bxpz@g@dpflag}{\bxpz@g@dp}}}
262 \def\bxpz@dp@drawl@val{{}{0}}
263 \def\bxpz@addto@dp@nums#1#2{%
264 \bgroup \@tempdima#1\relax \@tempdimb#2\relax
265 \xdef\bxpz@g@dp{%
266 \bxpz@g@dp\strip@pt\@tempdima\space\strip@pt\@tempdimb\space}%
267 \egroup}
268 \def\bxpz@dp@clear{\let\bxpz@dp\relax}
269
270 %%------ Strokes with dash-pattern in effect
271
272 %% pict2e original \pIIe@strokeGraph
273 \def\bxpz@pIIe@strokeGraph{\begingroup \@tempswafalse\pIIe@drawGraph}
274
275 % \bxpz@stroke@graph
276 \def\bxpz@stroke@graph{\begingroup \bxpz@draw@graph}
277 \def\bxpz@draw@graph{%
278 \ifx\bxpz@dp\relax \let\bxpz@dp\bxpz@dp@mode \fi
279 \ifx\bxpz@dp\bxpz@dp@drawl@val \let\bxpz@setdash\@empty
280 \else
281 \ifbxpz@eepic@dotl \roundcap \fi
282 \bxpz@set@dp\bxpz@dp
283 \ifnum \bxpz@dpflag=\@ne \bxpz@adj@linewidth \fi
284 \xdef\bxpz@setdash{\bxpz@beginarray@op\space\bxpz@dpary
285 \bxpz@endarray@op\space\bxpz@setdash@phase\space
286 \bxpz@setdash@op\space}%
287 \fi
288 \edef\x{\pIIe@debug@comment\space\pIIe@scale@PTtoBP}%
289 \edef\x{\x\space\bxpz@setdash\strip@pt\@wholewidth\space
290 \pIIe@setlinewidth@op}%
291 \edef\y{\pIIe@stroke@op}%
292 \expandafter\pIIe@code\expandafter{%
293 \expandafter\x\the\pIIe@GRAPH\space\y}%
294 \global\pIIe@GRAPH{}\xdef\pIIe@CPx{}\xdef\pIIe@CPy{}%
295 \endgroup
296 \let\bxpz@dp\relax}
297
298 %% \bxpz@set@dp\DP
299 \def\bxpz@set@dp#1{\expandafter\bxpz@set@dp@a#1}
300 \def\bxpz@set@dp@a#1#2{%
301 \def\bxpz@dpary{#2}\def\bxpz@dpflag{#1}}
302
303 \def\bxpz@adj@linewidth{%
304 \ifdim\@wholewidth<0.2pt \@wholewidth=2\@wholewidth
305 \else\ifdim\@wholewidth<1pt
306 \@wholewidth=0.75\@wholewidth \advance\@wholewidth0.25pt
307 \fi\fi}
308
309 %%------ Circles & ovals
310
311 % pict2e's original \@arc command
312 \let\bxpz@pIIe@arc\@arc
313
314 %% \@arc{<diam>}{<s_angle>}{<e_angle>}
315 % If the arguments obey the format shown above then passes them
316 % to \bxpz@eepic@arc; otherwise passes them to \bxpz@pIIe@arc.
317 \def\@arc{\@ifnextchar[{\@arc}{\bxpz@arc@a}}
318 \def\bxpz@arc@a#1{%
319 \def\bxpz@argi{#1}\futurelet\bxpz@tok\bxpz@arc@b}
320 \def\bxpz@arc@b{%
321 \ifx\bxpz@tok\bgroup \expandafter\bxpz@arc@c
322 \else \bxpz@pIIe@arc\bxpz@argi \fi}
323 \def\bxpz@arc@c#1{%
324 \def\bxpz@doargii{\bxpz@do{#1}}\futurelet\bxpz@tok\bxpz@arc@d}
325 \def\bxpz@arc@d{%
326 \ifx\bxpz@tok\bgroup \expandafter\bxpz@arc@f
327 \else \expandafter\bxpz@arc@e \fi}
328 \def\bxpz@arc@e{%
329 \bxpz@pIIe@arc\bxpz@argi \let\bxpz@do\@empty\bxpz@doargii}
330 \def\bxpz@arc@f{%
331 \def\bxpz@do##1{\bxpz@eepic@arc\bxpz@argi{##1}}\bxpz@doargii}
332
333 %% \bxpz@eepic@arc{<diam>}{<s_angle>}{<e_angle>}
334 \def\bxpz@eepic@arc#1#2#3{%
335 \bgroup
336 \@tempdima=#2\p@ \@tempdimb=#3\p@ \bxpz@conv@arc@param
337 \@tempdimc=#1\unitlength \divide\@tempdimc\tw@
338 \xdef\bxpz@g@tmpa{%
339 {\the\@tempdimc}{\strip@pt\@tempdima}{\strip@pt\@tempdimb}}%
340 \egroup
341 \if@tempswa
342 \def\bxpz@do{\pIIe@arc{\z@}{\z@}}%
343 \pIIe@moveto\z@\z@ \expandafter\bxpz@do\bxpz@g@tmpa
344 \pIIe@closepath\pIIe@fillGraph
345 \else
346 \def\bxpz@do{\pIIe@arc[1]{\z@}{\z@}}%
347 \expandafter\bxpz@do\bxpz@g@tmpa \pIIe@strokeGraph
348 \fi}
349
350 %% \bxpz@conv@arc@param
351 % Converts tpic degree arguments (s, e) to pict2e ones (S, E); values
352 % of (\@tempdima, \@tempdimb) are changed from (s, e) to (S, E).
353 % Let (S', E') = -(180/pi)(s, e); then:
354 % * if e - s >= 2pi (ie. S' - 360 >= E') then (S, E) = (0, 360)
355 % so that a whole circle is drawn;
356 % * otherwise, adjust S' and E' to values in range [0, 360), and then
357 % if S' < E' then decrement E' by 360, since in tpic an arc is
358 % always drawn in clockwise direction and thus S' >= E' must hold.
359 % Note: After scaling by 180/pi, degree values are rounded to multiples
360 % of 2^(-10). This rounding eliminates errors in the case of 'common
361 % angles' such as 15deg, while generally it enlarges the maximum possible
362 % error by factor about two.
363 \def\bxpz@conv@arc@param{%
364 %\typeout{BEFORE:\the\@tempdima/\the\@tempdimb}%
365 \bxpz@conv@arc@param@a\@tempdima \bxpz@conv@arc@param@a\@tempdimb
366 \@tempdimc\@tempdima \dimen@360\p@ \advance\@tempdimc-\dimen@
367 \ifdim \@tempdimb>\@tempdimc
368 \bxpz@conv@arc@param@b\@tempdima \bxpz@conv@arc@param@b\@tempdimb
369 \ifdim \@tempdima<\@tempdimb \advance\@tempdimb-\dimen@ \fi
370 \else \@tempdima\z@ \@tempdimb\dimen@ \fi
371 %\typeout{AFTER : \the\@tempdima/\the\@tempdimb}%
372 }
373 \def\bxpz@conv@arc@param@a#1{%
374 #1=57.29577951#1\advance#132sp \divide#164\multiply#1-64\relax}
375 \def\bxpz@conv@arc@param@b#1{%
376 \@whiledim#1>\z@ \do{\advance#1-\dimen@}%
377 \@whiledim#1<\z@ \do{\advance#1\dimen@}}%
378
379 %%<*> \ellipse[*]{<x_diam>}{<y_diam>}
380 \def\ellipse{%
381 \@ifstar{\begingroup\@tempswatrue\bxpz@ellipse}%
382 {\begingroup\@tempswafalse\bxpz@ellipse}}
383 \def\bxpz@ellipse#1#2{%
384 \@tempdima=#1\unitlength\@tempdimb=#2\unitlength
385 \ifdim\@tempdima<\z@ \@tempdima\z@ \fi
386 \ifdim\@tempdimb<\z@ \@tempdimb\z@ \fi
387 \divide\@tempdima\tw@ \divide\@tempdimb\tw@
388 \bxpz@ellipse@a
389 \if@tempswa \pIIe@fillGraph \else \pIIe@strokeGraph \fi
390 \endgroup}
391 \def\bxpz@ellipse@a{%
392 \buttcap \@ovxx\@tempdima \@ovyy\@tempdimb
393 \@ovdx=0.55228475\@ovxx \@ovdy=0.55228475\@ovyy
394 \pIIe@moveto\@ovxx\z@
395 \pIIe@curveto\@ovxx\@ovdy\@ovdx\@ovyy\z@\@ovyy
396 \pIIe@curveto{-\@ovdx}\@ovyy{-\@ovxx}\@ovdy{-\@ovxx}\z@
397 \pIIe@curveto{-\@ovxx}{-\@ovdy}{-\@ovdx}{-\@ovyy}\z@{-\@ovyy}%
398 \pIIe@curveto\@ovdx{-\@ovyy}\@ovxx{-\@ovdy}\@ovxx\z@
399 \pIIe@closepath}
400
401
402 %%------ Chaikin spline curves
403
404 %%<*> \spline
405 % Same as \polyline in pict2e, except that \bxpz@stroke@graph is
406 % used instead of \pIIe@strokeGraph.
407 \def\spline{\bxpz@firsttrue\bxpz@spline@a}
408 \def\bxpz@spline@a(#1,#2){%
409 \@killglue \@xdim=#1\unitlength \@ydim=#2\unitlength
410 \pIIe@moveto\@xdim\@ydim
411 \@ifnextchar\lp@r{\bxpz@spline@b}%
412 {\ifnum \bxpz@warn@wnpnt \ignorespaces}}
413 \def\bxpz@spline@b(#1,#2){%
414 % M1:previous midpoint (\@ovdx,\@ovdy)
415 % P1:previous point (\@xdim,\@ydim)
416 % M2:current midpoint (\@ovxx,\@ovyy)
417 % P2:current point (\@tempdima,\@tempdimb)
418 \@tempdima=#1\unitlength\@tempdimb=#2\unitlength
419 \@ovxx\@tempdima \advance\@ovxx\@xdim \divide\@ovxx\tw@
420 \@ovyy\@tempdimb \advance\@ovyy\@ydim \divide\@ovyy\tw@
421 \ifbxpz@first
422 \pIIe@lineto\@ovxx\@ovyy \bxpz@firstfalse
423 \else\bgroup
424 % quadratic Bezier curve M1--P1--M2
425 \pIIe@bezier@QtoC\@ovdx\@xdim\@ovdx
426 \pIIe@bezier@QtoC\@ovdy\@ydim\@ovdy
427 \pIIe@bezier@QtoC\@ovxx\@xdim\@xdim
428 \pIIe@bezier@QtoC\@ovyy\@ydim\@ydim
429 \pIIe@curveto\@ovdx\@ovdy\@xdim\@ydim\@ovxx\@ovyy
430 \egroup\fi
431 \@ovdx\@ovxx \@ovdy\@ovyy
432 \@xdim\@tempdima \@ydim\@tempdimb
433 \@ifnextchar\lp@r{\bxpz@spline@b}{\bxpz@spline@c}}
434 \def\bxpz@spline@c{%
435 \pIIe@lineto\@xdim\@ydim
436 \bxpz@stroke@graph\ignorespaces}
437
438
439 %%------ Functions not dependent on special features
440
441 %%<*> \allinesthickness
442 % In pict2e \linethickness setting applies to all kinds of lines.
443 % For better compatibility with eepic, \allinesthickness changes
444 % (without much aim) the LaTeX "line fonts".
445 \def\allinethickness{\bxpz@thicklinefont \linethickness}
446 \def\bxpz@thicklinefont{\let\@linefnt\tenlnw\let\@circlefnt\tencircw}
447
448 %%<*> \Thicklines
449 % Sets line-width to 1.5 times the width of \thicklines.
450 \def\Thicklines{\bxpz@thicklinefont \@wholewidth\fontdimen8\tenlnw
451 \linethickness{1.5\@wholewidth}}
452
453 %%<*> \picsquare
454 % Not of much use.
455 \def\picsquare{%
456 \hskip-\@halfwidth
457 \vrule\@width\@wholewidth\@height\@halfwidth\@depth\@halfwidth\relax}
458
459 %%<*> \multiputlist
460 % \multiputlist(X,Y)(DX,DY)[tbrl]{ITEM,...}
461 \def\multiputlist(#1,#2)(#3,#4){%
462 \@xdim=#1\unitlength \@ydim=#2\unitlength \@killglue
463 \@ifnextchar[{\bxpz@multiputlist@a{#3}{#4}}%
464 {\bxpz@multiputlist@a{#3}{#4}[]}}
465 \def\bxpz@multiputlist@a#1#2[#3]#4{%
466 \@for\bxpz@x:={#4}\do{%
467 \raise\@ydim\hb@xt@\z@{\kern\@xdim
468 \@imakepicbox(0,0)[#3]\bxpz@x \hss}%
469 \advance\@xdim#1\unitlength \advance\@ydim#2\unitlength}%
470 \ignorespaces}
471
472 %%<*> \matrixput
473 % \matrixput(X,Y)(DX1,DY1){N1}(DX2,DY2){N2}{ITEM}
474 \def\matrixput(#1,#2)(#3,#4)#5(#6,#7)#8#9{%
475 \bgroup \@xdim\z@ \@ydim\z@
476 \setbox\bxpz@boxa\hbox{%
477 \@multicnt=#8\relax
478 \@whilenum\@multicnt>\z@\do{%
479 \raise\@ydim\hb@xt@\z@{\kern\@xdim #9\hss}%
480 \advance\@xdim#6\unitlength \advance\@ydim#7\unitlength
481 \advance\@multicnt\m@ne}}%
482 \@xdim=#1\unitlength \@ydim=#2\unitlength \@killglue
483 \@multicnt=#5\relax
484 \@whilenum\@multicnt>\z@\do{%
485 \raise\@ydim\hb@xt@\z@{\kern\@xdim \copy\bxpz@boxa\hss}%
486 \advance\@xdim#3\unitlength \advance\@ydim#4\unitlength
487 \advance\@multicnt\m@ne}%
488 \egroup \ignorespaces}
489
490 %%<*> \grid
491 % \grid(W,H)(DW,DH)[X0,Y0]
492 \def\grid(#1,#2)(#3,#4){%
493 \@ovxx=#1\unitlength \@ovyy=#2\unitlength
494 \edef\bxpz@gridx{#3}\edef\bxpz@gridy{#4}%
495 \@ifnextchar[{\bxpz@grid@a}{\bxpz@grid@a[,]}}
496 \def\bxpz@grid@a[#1,#2]{%
497 \@killglue \let\spacewidth\@ovri
498 \setbox\bxpz@boxa\hbox{\space}\@ovri=\wd\bxpz@boxa
499 \@tempdimc=\z@ \@ovdx=\bxpz@gridx\unitlength
500 \ifx @#1@\bxpz@uselblfalse
501 \else \@tempdima=#1\p@ \bxpz@uselbltrue \fi
502 \@tempdimb\@ovxx \advance\@tempdimb.5\@ovdx \divide\@tempdimb\@ovdx
503 \@tempcnta\@tempdimb \advance\@tempcnta\@ne
504 \@whilenum\@tempcnta>\z@ \do{%
505 \hb@xt@\z@{\kern\@tempdimc \kern-\@halfwidth
506 \vrule\@height\@ovyy\@width\@wholewidth \hss}%
507 \ifbxpz@uselbl \bxpz@makelbl
508 \setbox\bxpz@boxa\hb@xt@\z@{\hss\copy\bxpz@boxa\hss}%
509 \hb@xt@\z@{\kern\@tempdimc
510 \vtop{\kern\epicbottomgridlabelsep\copy\bxpz@boxa}\hss}%
511 \raise\@ovyy\hb@xt@\z@{\kern\@tempdimc
512 \vbox{\copy\bxpz@boxa\kern\epictopgridlabelsep}\hss}%
513 \fi
514 \advance\@tempdima\bxpz@gridx\p@ \advance\@tempdimc\@ovdx
515 \advance\@tempcnta\m@ne}%
516 \@tempdimc=\z@ \@ovdy=\bxpz@gridy\unitlength
517 \ifx @#2@\bxpz@uselblfalse
518 \else \@tempdima=#2\p@ \bxpz@uselbltrue \fi
519 \@tempdimb\@ovyy \advance\@tempdimb.5\@ovdy \divide\@tempdimb\@ovdy
520 \@tempcnta\@tempdimb \advance\@tempcnta\@ne
521 \@whilenum\@tempcnta>\z@ \do{%
522 \raise\@tempdimc\hb@xt@\z@{%
523 \vrule\@height\@halfwidth\@depth\@halfwidth\@width\@ovxx \hss}%
524 \ifbxpz@uselbl \bxpz@makelbl
525 \setbox\bxpz@boxa\vbox to\z@{\vss\copy\bxpz@boxa\vss}%
526 \raise\@tempdimc\hb@xt@\z@{%
527 \hss\copy\bxpz@boxa\kern\epicsidegridlabelsep}%
528 \raise\@tempdimc\hb@xt@\z@{\kern\@ovxx
529 \kern\epicsidegridlabelsep\copy\bxpz@boxa\hss}%
530 \fi
531 \advance\@tempdima\bxpz@gridy\p@ \advance\@tempdimc\@ovdy
532 \advance\@tempcnta\m@ne}%
533 \let\spacewidth\@undefined
534 \ignorespaces}
535 \def\bxpz@makelbl{%
536 \edef\bxpz@tmpa{\noexpand\bxGridLabelForm{\strip@pt\@tempdima}}%
537 \setbox\bxpz@boxa\hbox{\bxpz@tmpa}}
538
539 %<+> \bxGridLabelForm{<real>}
540 % It must output the formatted string for value <real>. which is
541 % given as numerals (e.g. 72 or 10.333333).
542 % The default implementation uses decimal strings of the value
543 % rounded to integers.
544 \def\bxGridLabelForm#1{\@tempdima#1\p@ \advance\@tempdima.5\p@
545 \expandafter\bxpz@gridlabelform@a\the\@tempdima\@nil}
546 \def\bxpz@gridlabelform@a#1.#2\@nil{#1}
547
548 %%<*> \putfile{<filename>}{<general_text>}
549 \def\putfile#1#2{%
550 \def\bxpz@body{#2}%
551 \let\bxpz@dofile\bxpz@putfile@a \let\bxpz@dofile@skipped\relax
552 \bxpz@dofile@ifexists{#1}}
553 \let\bxpz@fhread\@inputcheck
554 \def\bxpz@putfile@a#1{%
555 \openin\bxpz@fhread=#1\relax \let\bxpz@tmpa\relax
556 \ifeof\bxpz@fhread\else \expandafter\bxpz@putfile@b \fi
557 \closein\bxpz@fhread \ignorespaces}
558 \def\bxpz@putfile@b{%
559 \read\bxpz@fhread to\bxpz@line
560 \ifx\bxpz@line\bxpz@line@par \let\bxpz@line\@empty \fi
561 \edef\bxpz@line{\bxpz@line\space\space}%
562 \expandafter\bxpz@putfile@c\bxpz@line
563 \ifeof\bxpz@fhread\else \expandafter\bxpz@putfile@b \fi}
564 \def\bxpz@putfile@c#1 {%
565 \ifx @#1@\relax \else
566 \ifx\bxpz@tmpa\relax \def\bxpz@tmpa{#1}%
567 \else \put(\bxpz@tmpa,#1){\bxpz@body}
568 \let\bxpz@tmpa\relax
569 \fi \expandafter\bxpz@putfile@c
570 \fi}
571 \def\bxpz@line@par{\par}
572
573 %% \bxpz@dofile@ifexists
574 \newif\ifbxpz@dofile@ok
575 \def\bxpz@InputIfFileExists#1#2{%
576 \IfFileExists{#1}{\bxpz@dofile@ifex@a\bxpz@dofile{#1}}}
577 \let\bxpz@ltx@InputIfFileExists\InputIfFileExists
578 \def\bxpz@dofile@ifexists#1{%
579 \let\InputIfFileExists\bxpz@InputIfFileExists
580 \bxpz@dofile@okfalse \@iinput{#1}%
581 \ifbxpz@dofile@ok\else
582 \bxpz@dofile@ifex@a \bxpz@dofile@skipped \fi}
583 \def\bxpz@dofile@ifex@a{\bxpz@dofile@oktrue
584 \let\InputIfFileExists\bxpz@ltx@InputIfFileExists}
585
586 %%------
587 \ifbxpz@safe %----<*safe>
588
589 %%<*> \[no]eepicdottedlines
590 % No-op in safe mode.
591 \let\eepicdottedlines\relax
592 \let\noeepicdottedlines\relax
593
594 \else %----<*!safe>
595
596 %%<*> \[no]eepicdottedlines
597 \let\eepicdottedlines\bxpz@eepic@dotltrue
598 \let\noeepicdottedlines\bxpz@eepic@dotlfalse
599
600 %% \bxpz@redefine@linestyle\LSCMD{<attr>}{<val>}
601 \def\bxpz@redefine@linestyle#1#2#3{%
602 \expandafter\bxpz@redefine@linestyle@a
603 \csname bxpz@raw@\expandafter\@gobble\string#1\expandafter\endcsname
604 \csname bxpz@#2\expandafter\endcsname
605 \csname bxpz@LS/#2/#3\expandafter\endcsname
606 \csname bxpz@SLS/#2\endcsname #1{#2}{#3}}
607 \def\bxpz@redefine@linestyle@a#1#2#3#4#5#6#7{%
608 % \[bxpz@raw@LSCMD]\[bxpz@<attr>]\[bxpz@LS/<attr>/<val>]
609 % \[bxpz@SLS/<attr>]\LSCMD{<attr>}{<val>}
610 \let#1#5\let#3#5\def#5{\def#2{#7}#3\aftergroup#4}%
611 \def#4{\csname bxpz@LS/#6/#2\endcsname}}
612 % redefine linestyle commands
613 \bxpz@redefine@linestyle\buttcap{lcap}{0}
614 \bxpz@redefine@linestyle\roundcap{lcap}{1}
615 \bxpz@redefine@linestyle\squarecap{lcap}{2}
616 \bxpz@redefine@linestyle\miterjoin{ljoin}{0}
617 \bxpz@redefine@linestyle\roundjoin{ljoin}{1}
618 \bxpz@redefine@linestyle\beveljoin{ljoin}{2}
619
620 % default values of states
621 \let\bxpz@lcap\bxpz@dflt@linecap
622 \let\bxpz@ljoin\bxpz@dflt@linejoin
623
624 %% patch to \pIIe@circle
625 % \buttcap moved one-level outside.
626 \def\pIIe@circle#1{%
627 \buttcap
628 \begingroup
629 \pIIe@qcircle[1]\z@{#1}\pIIe@qcircle \@ne{#1}%
630 \pIIe@qcircle \tw@{#1}\pIIe@qcircle\thr@@{#1}%
631 \endgroup}
632
633
634 \fi %----</safe>
635 \endinput
636 %%------
637 %
638 % List of epic features not contained in pict2e
639 %
640 %\multiputlist(X,Y)(DX,DY)[tbrl]{ITEM,...}
641 %\matrixput(X,Y)(DX1,DY1){N1}(DX2,DY2){N2}{ITEM}
642 %\grid(W,H)(DW,DH)[X0,Y0]
643 %\dottedline[CHAR]{DOTGAP}(X1,Y1)...(XN,YN)
644 %\dashline[STRETCH]{DASHLEN}[DOTGAP](X1,Y1)...(XN,YN)
645 %\drawline[STRETCH](X1,Y1)...(XN,YN)
646 %\jput(X,Y){ITEM}
647 %\begin{dottedjoin}[C]{G} ... \end{dottedjoin}
648 %\begin{dashjoin}[S]{D}[G] ... \end{dashjoin}
649 %\begin{drawjoin}[S] ... \end{drawjoin}
650 %\picsquare
651 %\putfile{FILE}
652 %\dashlinestretch
653 %\drawlinestretch
654 %
655 % List of eepic features not contained in pict2e
656 %
657 %\maxovaldimen (for \oval)
658 %\allinethickness
659 %\Thicklines
660 %\path(X1,Y1)..(Xn,Yn)
661 %\spline(X1,Y1)..(Xn,Yn)
662 %\ellipse[*]{XDIAM}{YDIAM}
663 %\arc{DIAM}{SANG}{EANG} *angle in radian, +ve = clockwise
664 %\filltype{FILL} / \blacken / \whiten / \shade
665 %
666 %% EOF