Debian Codegraph @

utils/axodraw2/axodraw2-src/axodraw2.sty

raw
1 % This is axodraw2.sty
2 %
3 % (C) 1994-2018 by authors:
4 % John Collins (jcc8 at psu dot edu)
5 % Jos Vermaseren (t68 at nikhef dot nl)
6 %
7 %
8 % Conditions of use:
9 %
10 % axodraw is free software: you can redistribute it and/or modify it under
11 % the terms of the GNU General Public License as published by the Free
12 % Software Foundation, either version 3 of the License, or (at your option)
13 % any later version.
14 %
15 % axodraw is distributed in the hope that it will be useful, but WITHOUT ANY
16 % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 % details.
19 %
20 % For the GNU General Public License see <http://www.gnu.org/licenses/>.
21 %
22 % Code necessities:
23 %
24 % 1. \ignorespaces at end of commands that draw things. Often it won't
25 % matter, but occasionally a command in a picture environment
26 % will set material and a following uncommented end-of-line in
27 % the user's code will shift the insertion point.
28 % 2. Use end-of-line comments whereever TeX might use the end-of-line as
29 % a space to be typeset.
30 %
31 % Conventions
32 %
33 % 1. Any font and color changes that are supposed to be local should
34 % be made local, either by explicit TeX grouping or by being
35 % inside commands (e.g., box-making commands) that enforce groups.
36 % Braces work, but \begingroup and \endgroup are easier to see in
37 % multiline groups.
38 % 2. Scaling:
39 % \unitlength is the unit for the canvas (as in picture environment).
40 % \axoscale is for the unit for coordinates, widths, etc
41 % \axotextscale is for all text objects, BUT only when
42 % PSText is NOT set to scale as graphics objects
43 % When PSText is set to scale as graphics objects, PSText
44 % scales by \axoscale, but TeX-text has unit scaling.
45 % Given a specification of a position (x,y) as in a call to \Line,
46 % the position of the point relative to the origin is
47 % x_act = (x + \axoxo ) \axoscale pt + \axoxoffset \unitlength
48 % y_act = (y + \axoyo ) \axoscale pt + \axoyoffset \unitlength
49 % Widths and the like for lines are in units of \axoscale pt
50 %
51 % #[ About folds : (this line starts with one % and two tabs)
52 %
53 % The internals of the file have been organized in folds.
54 % These are defined as a range of lines if which the first and last
55 % lines have a special format. Each starts with any three characters
56 % (may include tabs), then #[ for the start line and #] for the closing
57 % line, then both lines need identical name fields, closed by a colon.
58 % After the colon can be anything. When a fold is closed one should see
59 % only the first line but with the #[ replaced by ## as in
60 % ## About folds : (this line starts with one % and two tabs)
61 % Folds can be nested.
62 % This fold concept comes originally from the occam compiler for the
63 % transputer in the second half of the 1980's although there it was
64 % implemented differently. It was taken over by the STedi editor in its
65 % current form. The sources of this editor are available from the form
66 % home site: http://www.nikhef.nl/~form
67 % Some people have managed to emulate these folds in editors like emacs
68 % and vim.
69 %
70 % #] About folds :
71 %
72 \ProvidesPackage{axodraw2}[2018/10/10 v2.1.2]
73 %
74 % axodraw.sty file, both for .tex -> .dvi -> .ps and for .tex -> .pdf
75 %
76 % #[ Common LaTeX code :
77 % #[ Variables :
78 %
79 %
80 \RequirePackage{keyval}
81 \RequirePackage{ifthen}
82 \RequirePackage{graphicx}
83 \RequirePackage{color}
84 \RequirePackage{ifxetex}
85 %
86 %
87 \DeclareOption{v1compatible}{
88 \def\B2Text{\BTwoText}
89 \def\G2Text{\GTwoText}
90 \def\C2Text{\CTwoText}
91 }
92 \DeclareOption{canvasScaleIs1pt}{\canvasScaleOnept}
93 \DeclareOption{canvasScaleIsObjectScale}{\canvasScaleObjectScale}
94 \DeclareOption{canvasScaleIsUnitLength}{\canvasScaleUnitLength}
95 \DeclareOption{PSTextScalesIndependently}{\PSTextScalesLikeGraphicsfalse}
96 \DeclareOption{PSTextScalesLikeGraphics}{\PSTextScalesLikeGraphicstrue}
97
98 % N.B. Option processing is deferred to end of this file, so that all
99 % definitions and initializations have been done first.
100
101 % Settings for pdf v. dvi/ps output:
102 % We need to be able to run under latex, pdflatex, lualatex, and
103 % xelatex, and use (if possible) \pdfoutput and \pdfliteral
104 %
105 % latex: Initially \pdfoutput is 0, and \pdfliteral is defined but
106 % not usable.
107 % pdflatex: Initially \pdfoutput is 1, and \pdfliteral is defined and
108 % usable.
109 % lualatex: same as pdflatex in versions up to 0.80
110 % But in versions from 0.85, pdfouput and pdfliteral aren't
111 % defined; instead \outputmode, \pdfextension literal{...}
112 % are available instead.
113 % xelatex: Both \pdfoutput and \pdfliteral are undefined
114 % but special{pdf:literal ...} gives same effect as
115 % \pdfliteral would, and we can assume pdf mode always.
116 % When \pdfoutput is defined, the user can change its value to change
117 % the type of output. This must be done before the first page is
118 % created. But various packages (including graphics and ifpdf, as
119 % well as axodraw) take actions when the package is loaded that depend
120 % on current state of \pdfoutput (or its equivalent). So it is
121 % reasonable to require that \pdfoutput be set only before packages
122 % are loaded and not set later.
123 %
124 % We define \axo@pdfoutput and \axo@pdfliteral for our uses to have
125 % function of \pdfoutput and \pdfliteral, but to be defined always.
126 % We initialize them to a default suitable for dvi mode, and override
127 % these definitions to cover the situations listed above. This needs
128 % tests for whether \pdfoutput, \outputmode, etc are undefined of
129 % defined. We put these inside a group, to evade the side effect that
130 % \@ifundefined defines the object being tested.
131 %
132 % Default values:
133 \newcount\axo@pdfoutput
134 \axo@pdfoutput=0
135 \def\axo@pdfliteral#1%
136 {\PackageWarning{axo}{Bug: pdfliteral accessed but not available}}
137 \bgroup
138 \@ifundefined{pdfoutput}%
139 {}%
140 {\global\axo@pdfoutput=\pdfoutput}%
141 %
142 \@ifundefined{pdfliteral}%
143 {}%
144 {% Define \axo@pdfliteral to call \pdfliteral, so that if the
145 % definition of \pdfliteral were to be overridden, we get to
146 % use the changed definition
147 \gdef\axo@pdfliteral#1{\pdfliteral{#1}}}%
148 \@ifundefined{outputmode}%
149 {}%
150 {\global\axo@pdfoutput=\outputmode}
151 \@ifundefined{pdfextension}%
152 {}%
153 {\gdef\axo@pdfliteral#1{\pdfextension literal{#1}}}
154 \egroup
155 \ifxetex
156 \axo@pdfoutput=1
157 \def\axo@pdfliteral#1{\special{pdf:literal #1}}
158 \fi
159
160 %
161 % For communicating with axohelp with global file
162 %
163 \newif\ifaxo@axohelpRerun
164 \axo@axohelpRerunfalse
165 %
166 \newcounter{axo@objectIndex}
167 \setcounter{axo@objectIndex}{0}
168 \newwrite\axo@spec
169 \newread\axo@axohelpFile
170 %
171 \newcommand\axo@setObject[3]{
172 \expandafter\gdef\csname axo@input@#1\endcsname{#2}
173 \expandafter\gdef\csname axo@output@#1\endcsname{#3}
174 }
175 %
176 \ifcase\axo@pdfoutput
177 \else
178 \IfFileExists{\jobname.ax2}%
179 {{% For comparisons between current definition of object
180 % and previously processed definition, spaces must be preserved.
181 \obeyspaces
182 \openin\axo@axohelpFile=\jobname.ax2
183 }}%
184 {%
185 \PackageWarning{axo}{File `\jobname.ax2' not found.}
186 \axo@axohelpReruntrue
187 }
188 \AtBeginDocument{\immediate\openout\axo@spec\jobname.ax1}
189 \AtEndDocument{\immediate\closeout\axo@spec
190 \ifaxo@axohelpRerun
191 \PackageWarning{axodraw2}{Run `axohelp \jobname'
192 and then rerun pdflatex.}
193 \fi
194 }
195 \fi
196
197 % Commands to set parameters
198 %
199 % Arrow scale:
200 \newcommand{\AXO@DefaultArrowScale}{1}
201 \newcommand\SetArrowScale[1]{%
202 \renewcommand\AXO@DefaultArrowScale{#1}%
203 }
204 % Alternative name
205 \newcommand\DefaultArrowScale[1]{\SetArrowScale{#1}}
206 \SetArrowScale{1}
207
208 % Arrow inset:
209 \newcommand\AXO@ArrowInset{0.2}
210 %\renewcommand\AXO@ArrowInset{-1 }
211 \newcommand\SetArrowInset[1]{%
212 \renewcommand\AXO@ArrowInset{#1}%
213 }
214
215 % Arrow aspect:
216 \newcommand\AXO@DefaultArrowAspect{1.25}
217 \newcommand\SetArrowAspect[1]{%
218 \renewcommand\AXO@DefaultArrowAspect{#1}%
219 }
220
221 % Arrow position (fractional position along line):
222 \newcommand\AXO@ArrowPos{0.5}
223 \newcommand\SetArrowPosition[1]{%
224 \renewcommand\AXO@ArrowPos{#1}%
225 }
226
227 % Arrow stroke width
228 \newcommand{\AXO@DefaultArrowStroke}{0 }
229 \newcommand\SetArrowStroke[1]{%
230 \renewcommand\AXO@DefaultArrowStroke{#1}%
231 }
232
233 \newlength{\axounitlength}
234 % The next two are scratch registers
235 \newlength\axo@x
236 \newlength\axo@y
237 % Initializations
238 \axounitlength=\unitlength
239 \def\axocanvas{1} % How unitlength is set in axopicture environment
240 % 0 => 1 pt
241 % 1 => \axoscale pt
242 % 2 => Don't set it
243 \def\axominusone{-1}
244 \def\axoone{1}
245 \def\axozero{0}
246 \def\axowidth{0.5}
247 \def\axoscale{1.0}
248 \def\axotextscale{1.0}
249 \newif\ifPSTextScalesLikeGraphics
250 \PSTextScalesLikeGraphicstrue
251 \def\axoxoff{0}
252 \def\axoyoff{0}
253 \def\axoxo{0}
254 \def\axoyo{0}
255 \def\axoarrowsize{2}
256 %
257 %
258 % Now the user callable routines, and their immediate helpers
259 %
260 % Commands for setting parameters applicable to subsequent graphical objects:
261 %
262 \def\SetLineSep#1{\def\AXO@Sep{#1}\ignorespaces}\relax
263 \let\SetSep=\SetLineSep\relax
264 \def\SetDashSize#1{\def\AXO@DashSize{#1}\ignorespaces}\relax
265 \def\SetWidth#1{\def\axowidth{#1}\ignorespaces}
266 \def\SetArrowSize#1{\def\axoarrowsize{#1}}
267
268 \def\SetObjectScale#1{\def\axoscale{#1}\ignorespaces}
269 \def\SetCanvasScale#1{\unitlength = #1 pt\ignorespaces}
270 \def\SetTextScale#1{\def\axotextscale{#1}\ignorespaces}
271 \let\SetScale = \SetObjectScale
272
273 \def\SetOffset(#1,#2){\def\axoxoff{#1}\def\axoyoff{#2}\ignorespaces}
274 \def\SetScaledOffset(#1,#2){\def\axoxo{#1}\def\axoyo{#2}\ignorespaces}
275
276 \def\canvasScaleOnept{\def\axocanvas{0}}
277 \def\canvasScaleObjectScale{\def\axocanvas{1}}
278 \def\canvasScaleUnitLength{\def\axocanvas{2}}
279
280 %
281 %
282 % #] Variables :
283 % #[ Defining commands with optional arguments :
284 %
285 \def\defWithOption#1#2#3{%
286 \@namedef{#1}%
287 {%
288 \@ifnextchar[%]
289 {\@nameuse{#1@A}}%
290 {\@nameuse{#1@A}[]}%
291 }%
292 \@namedef{#1@A}[##1]#2%
293 {#3}%
294 }
295 %
296 % #] Defining commands with optional arguments :
297 % #[ axopicture :
298 %
299 % Version of picture environment with unitlength set to 1pt
300 % as assumed by axodraw. We also store some variables and reset them
301 % afterwards. This makes the picture environment also local from the
302 % axodraw viewpoint. To change the global settings one should issue
303 % the corresponding command from outside the axopicture environment.
304 % Use: \begin{axopicture}(width,height)(xshift,yshift)
305 % \end{axopicture}
306 % The old use with the regular picture environment will still work,
307 % but it will have the old shortcomings connected to it.
308 %
309 \let\OLDpicture=\picture
310 \let\endOLDpicture=\endpicture
311 \newenvironment{axopicture}
312 {%
313 \ifcase \axocanvas
314 \setlength{\unitlength}{1 pt}%
315 \or
316 \setlength{\unitlength}{\axoscale\space pt}%
317 \else
318 % Leave \unitlength as whatever the user set
319 \fi
320 \begin{OLDpicture}%
321 }
322 {%
323 \end{OLDpicture}%
324 \ignorespacesafterend
325 }
326 %
327 % #] axopicture :
328 % #[ AXO@keys :
329 %
330
331 % Diagnostics for unimplemented features:
332 \newif\ifAXONotImplemented
333 \AXONotImplementedfalse
334 \def\AXO@NOTIMPLEMENTED#1{%
335 \global\AXONotImplementedtrue
336 \PackageWarning{axodraw2}{#1}%
337 }
338 \AtEndDocument{%
339 \ifAXONotImplemented
340 \PackageWarningNoLine{axodraw2}{unimplemented features used
341 somewhere in document}%
342 \fi
343 }
344
345 % The next is used temporarily, it gives the result of parsing an
346 % arrow-using command to give the Postscript code for setting the
347 % arrow.
348 %
349 % Keys for optional arguments:
350 % First the variables used, with some defaults.
351 \newif\ifAXO@arrow
352 \AXO@arrowfalse
353 \newif\ifAXO@clock
354 \AXO@clockfalse
355 \newif\ifAXO@dash
356 \AXO@dashfalse
357 \newif\ifAXO@double
358 \AXO@doublefalse
359 \newif\ifAXO@flip % Flip arrow orientation, as in JaxoDraw
360 \AXO@flipfalse
361 \newif\ifAXO@linecolor % Option sets color for current line
362 \AXO@linecolorfalse
363
364 \def\AXO@Sep{2} % Double line separation
365 \def\AXO@DashSize{3}
366
367 % Then the definitions of the keys
368 \define@key{axo}{arrowscale}{%
369 \def\AXO@CurrentArrowScale{#1}%
370 }
371 \define@key{axo}{arrowwidth}{%
372 \def\AXO@CurrentArrowWidth{#1}%
373 }
374 \define@key{axo}{arrowlength}{%
375 \def\AXO@CurrentArrowLength{#1}%
376 }
377 % Make arrowheight a synonym for arrowlength
378 \let\KV@axo@arrowheight=\KV@axo@arrowlength
379 %
380 \define@key{axo}{arrowpos}{%
381 \def\AXO@CurrentArrowPos{#1 }
382 }
383 %
384 \define@key{axo}{arrowaspect}{%
385 \def\AXO@CurrentArrowAspect{#1 }
386 }
387 %
388 \define@key{axo}{arrowinset}{%
389 \def\AXO@CurrentArrowInset{#1 }
390 }
391 % Make inset a synonym for arrowinset
392 \let\KV@axo@inset=\KV@axo@arrowinset
393 %
394 \define@key{axo}{arrowstroke}{%
395 \def\AXO@CurrentArrowStroke{#1 }
396 }
397 %
398 \define@key{axo}{arrow}[true]{%
399 \AXO@boolkey{#1}{arrow}%
400 }
401 \define@key{axo}{clock}[true]{%
402 \AXO@boolkey{#1}{clock}%
403 }
404 \define@key{axo}{clockwise}[true]{%
405 \AXO@boolkey{#1}{clock}%
406 }
407 \define@key{axo}{color}{%
408 \def\AXO@CurrentColor{#1}%
409 \AXO@linecolortrue
410 }
411 % Make colour a synonym for color
412 \let\KV@axo@colour=\KV@axo@color
413 %
414 \define@key{axo}{dash}[true]{%
415 \AXO@boolkey{#1}{dash}%
416 }
417 \define@key{axo}{dashsize}{%
418 \def\AXO@CurrentDashSize{#1 }
419 }
420 \define@key{axo}{dsize}{%
421 \def\AXO@CurrentDashSize{#1 }
422 }
423 \define@key{axo}{double}[true]{%
424 \AXO@boolkey{#1}{double}%
425 }
426 \define@key{axo}{flip}[true]{%
427 \AXO@boolkey{#1}{flip}%
428 }
429 \define@key{axo}{linesep}{%
430 \def\AXO@CurrentSep{#1}
431 }
432 \define@key{axo}{sep}{%
433 \def\AXO@CurrentSep{#1}
434 }
435 \define@key{axo}{width}{%
436 \def\AXO@CurrentWidth{#1}%
437 }
438 %
439 % #] AXO@keys :
440 % #[ AXO@Parse :
441 %
442 % Parsing of optional arguments, etc
443 %
444 \def\AXO@Parse#1#2{%
445 % Usage: \AXO@Parse#1#2 or \AXO@Parse#1#2[#3]
446 % #1 is a command for setting an object, that takes no optional argument
447 % #2 and the optional #3 are keyword settings.
448 % There then follow the compulsory arguments for the command in #1.
449 %
450 % E.g., \AXO@Parse{\AXO@Line}{double}(x1,y1)(x2,y2)
451 % \AXO@Parse{\AXO@Line}{double}[arrow](x1,y1)(x2,y2)
452 %
453 % I will
454 % (a) Set standard initial settings (arrows, etc)
455 % (b) Parse the keyword settings in #2 and #3, e.g., scale = 3,
456 % (c) Call #1 to make the object
457 \AXO@arrowfalse
458 \AXO@clockfalse
459 \AXO@dashfalse
460 \AXO@doublefalse
461 \AXO@flipfalse
462 \AXO@linecolorfalse
463 \let\AXO@CurrentWidth\axowidth
464 \let\AXO@CurrentArrowPos\AXO@ArrowPos
465 \let\AXO@CurrentArrowWidth\relax
466 \let\AXO@CurrentArrowLength\relax
467 \let\AXO@CurrentArrowInset\AXO@ArrowInset
468 \let\AXO@CurrentArrowScale\AXO@DefaultArrowScale
469 \let\AXO@CurrentArrowStroke\AXO@DefaultArrowStroke
470 \let\AXO@CurrentArrowAspect\AXO@DefaultArrowAspect
471 \let\AXO@CurrentDashSize\AXO@DashSize
472 \let\AXO@CurrentSep=\AXO@Sep
473 \@ifnextchar[{\AXO@Options{#1}{#2}}%
474 {\AXO@Options{#1}{#2}[]}%
475 }
476 %
477 % #] AXO@Parse :
478 % #[ AXO@Options :
479 %
480 \def\AXO@Options#1#2[#3]{%
481 % #1 is command to execute, #2 and #3 are options.
482 \setkeys{axo}{#2}%
483 \setkeys{axo}{#3}%
484 \ifx\AXO@CurrentArrowLength\relax
485 \def\AXO@CurrentArrowLength{0 }%
486 \fi
487 \ifx\AXO@CurrentArrowWidth\relax
488 \def\AXO@CurrentArrowWidth{0 }%
489 \fi
490 \ifAXO@arrow
491 \def\AXO@ArrowArg{
492 \AXO@CurrentArrowStroke \space %
493 \AXO@CurrentArrowWidth \space %
494 \AXO@CurrentArrowLength \space %
495 \AXO@CurrentArrowInset \space %
496 \AXO@CurrentArrowScale \space %
497 \AXO@CurrentArrowAspect \space %
498 \AXO@CurrentArrowPos \space %
499 \ifcase\axo@pdfoutput
500 true \space % Indicates that an arrow should be drawn.
501 \else
502 1 \space % Indicates that an arrow should be drawn.
503 \fi
504 }%
505 \else
506 \ifcase\axo@pdfoutput
507 \def\AXO@ArrowArg{ 0 0 0 0 0 0 0 false }%
508 \else
509 \def\AXO@ArrowArg{ 0 0 0 0 0 0 0 0 }%
510 \fi
511 \fi
512 #1%
513 }
514 %
515 \def\AXO@useopts{%
516 % Override global settings by those from options
517 % HACK: The \@killglue solves problem that setting color
518 % causes a shift in horizontal position.
519 % Motivation: From definition of \put.
520 \@killglue
521 \ifAXO@linecolor \SetColor{\AXO@CurrentColor}\fi
522 }
523 %
524 % Now ensure there is a setting for the current arrow
525 \AXO@Parse{}{}
526 %
527 % #] AXO@Options :
528 % #[ AXO@varia :
529 %
530 % Now ensure there is a setting for the current arrow
531 \AXO@Parse{}{}
532
533 \def\AXO@PrependOption#1#2{%
534 % Run command #1, which has an optional argument, with #2 prepended
535 % to the command's optional arguments. If there are no optional
536 % arguments, just run the command with #2 as the optional arguments
537 \@ifnextchar[{\AXO@TwoOption{#1}{#2}}%
538 {#1[#2]}%
539 }
540 \def\AXO@TwoOption#1#2[#3]{%
541 #1[#2,#3]%
542 }
543 %
544 % Copied from graphicx.sty, for use with boolean keys
545 % Modified to do lower casing here
546 \def\AXO@boolkey#1#2{%
547 \lowercase{\AXO@boolkeyA{#1}}{#2}%
548 }
549 \def\AXO@boolkeyA#1#2{%
550 \csname AXO@#2\ifx\relax#1\relax true\else#1\fi\endcsname
551 }
552 %
553 % #] AXO@varia :
554 % #[ Colors :
555 %
556 % Here we make an interface, compatible with both: color.sty,
557 % with the commands of axodraw v. 1, and with the commands of
558 % colordvi.sty (used by axodraw v. 1).
559 %
560 % 1. We make a set of named colors suitable for use with both
561 % axodraw's commands that take color arguments and with
562 % color.sty's \color command.
563 % 2. We define a command \SetColor to set a named color as the
564 % current color. It is now identical to \color.
565 % 3. For each of the colors that we define here, we make
566 % named color setting commands, e.g., \Red
567 % \textRed. \Red sets its (one) argument in Red, \textRed
568 % is a "declaration" that changes the current color.
569 % All the commands for setting color apply to both regular LaTeX
570 % material and to axodraw objects. Their setting of color
571 % respects LaTeX environments and TeX groups.
572 %
573 % We also define
574 % a. Named-color commands like \textRed and \Red for named
575 % colors to give the same interface as the colordvi
576 % package (and hence axodraw v. 1).
577 % b. \SetColor command to set a named color.
578
579
580 \let\SetColor=\color
581
582 % For v. 1 compatibility:
583 \def\IfColor#1#2{#1}
584
585 \newcommand\newcolor[2]{%
586 % Define a named color both in the color.sty style
587 % and in the colordvi.sty, with also a command giving the CMYK value.
588 % #1 is the color's name, #2 is its CMYK definition, space
589 % separated.
590 %
591 % Invoke color.sty's \definecolor after change of argument format:
592 \axo@new@color #1 #2\@%
593 % Define commands to use this color,
594 % E.g., if #1 is Red, then define \Red and \textRed:
595 \expandafter\def\csname #1\endcsname##1{{\SetColor{#1}##1}\ignorespaces}
596 \expandafter\def\csname text#1\endcsname{\SetColor{#1}\ignorespaces}
597 % The following to give the cmyk value of a color, e.g., \cmykRed,
598 % is no longer needed, since we no longer do color setting in
599 % postscript and pdf code:
600 %% \expandafter\def\csname cmyk#1\endcsname{#2}
601 }
602
603 % Command to invoke color.sty's \definecolor, which needs a translation
604 % of our space-separated CMYK vector to a comma-separated vector:
605 \def\axo@new@color #1 #2 #3 #4 #5\@{\definecolor{#1}{cmyk}{#2,#3,#4,#5}}
606
607
608 % For consistency we define our named colors here, rather than
609 % using color.sty's mechanisms. The
610 % first 68 are standard colors, as defined by dvips, and
611 % implemented in both colordvi.ps, and in color.sty with its
612 % usenames and dvipsnames options (in the file dvipsnam.def
613 % provided by the LaTeX graphics package).
614 %
615 % We define an extra 5 colors at the end
616 %
617 % The 68 dvips-defined colors are:
618 %
619 \newcolor{GreenYellow}{0.15 0 0.69 0}
620 \newcolor{Yellow}{0 0 1 0}
621 \newcolor{Goldenrod}{0 0.10 0.84 0}
622 \newcolor{Dandelion}{0 0.29 0.84 0}
623 \newcolor{Apricot}{0 0.32 0.52 0}
624 \newcolor{Peach}{0 0.50 0.70 0}
625 \newcolor{Melon}{0 0.46 0.50 0}
626 \newcolor{YellowOrange}{0 0.42 1 0}
627 \newcolor{Orange}{0 0.61 0.87 0}
628 \newcolor{BurntOrange}{0 0.51 1 0}
629 \newcolor{Bittersweet}{0 0.75 1 0.24}
630 \newcolor{RedOrange}{0 0.77 0.87 0}
631 \newcolor{Mahogany}{0 0.85 0.87 0.35}
632 \newcolor{Maroon}{0 0.87 0.68 0.32}
633 \newcolor{BrickRed}{0 0.89 0.94 0.28}
634 \newcolor{Red}{0 1 1 0}
635 \newcolor{OrangeRed}{0 1 0.50 0}
636 \newcolor{RubineRed}{0 1 0.13 0}
637 \newcolor{WildStrawberry}{0 0.96 0.39 0}
638 \newcolor{Salmon}{0 0.53 0.38 0}
639 \newcolor{CarnationPink}{0 0.63 0 0}
640 \newcolor{Magenta}{0 1 0 0}
641 \newcolor{VioletRed}{0 0.81 0 0}
642 \newcolor{Rhodamine}{0 0.82 0 0}
643 \newcolor{Mulberry}{0.34 0.90 0 0.02}
644 \newcolor{RedViolet}{0.07 0.90 0 0.34}
645 \newcolor{Fuchsia}{0.47 0.91 0 0.08}
646 \newcolor{Lavender}{0 0.48 0 0}
647 \newcolor{Thistle}{0.12 0.59 0 0}
648 \newcolor{Orchid}{0.32 0.64 0 0}
649 \newcolor{DarkOrchid}{0.40 0.80 0.20 0}
650 \newcolor{Purple}{0.45 0.86 0 0}
651 \newcolor{Plum}{0.50 1 0 0}
652 \newcolor{Violet}{0.79 0.88 0 0}
653 \newcolor{RoyalPurple}{0.75 0.90 0 0}
654 \newcolor{BlueViolet}{0.86 0.91 0 0.04}
655 \newcolor{Periwinkle}{0.57 0.55 0 0}
656 \newcolor{CadetBlue}{0.62 0.57 0.23 0}
657 \newcolor{CornflowerBlue}{0.65 0.13 0 0}
658 \newcolor{MidnightBlue}{0.98 0.13 0 0.43}
659 \newcolor{NavyBlue}{0.94 0.54 0 0}
660 \newcolor{RoyalBlue}{1 0.50 0 0}
661 \newcolor{Blue}{1 1 0 0}
662 \newcolor{Cerulean}{0.94 0.11 0 0}
663 \newcolor{Cyan}{1 0 0 0}
664 \newcolor{ProcessBlue}{0.96 0 0 0}
665 \newcolor{SkyBlue}{0.62 0 0.12 0}
666 \newcolor{Turquoise}{0.85 0 0.20 0}
667 \newcolor{TealBlue}{0.86 0 0.34 0.02}
668 \newcolor{Aquamarine}{0.82 0 0.30 0}
669 \newcolor{BlueGreen}{0.85 0 0.33 0}
670 \newcolor{Emerald}{1 0 0.50 0}
671 \newcolor{JungleGreen}{0.99 0 0.52 0}
672 \newcolor{SeaGreen}{0.69 0 0.50 0}
673 \newcolor{Green}{1 0 1 0}
674 \newcolor{ForestGreen}{0.91 0 0.88 0.12}
675 \newcolor{PineGreen}{0.92 0 0.59 0.25}
676 \newcolor{LimeGreen}{0.50 0 1 0}
677 \newcolor{YellowGreen}{0.44 0 0.74 0}
678 \newcolor{SpringGreen}{0.26 0 0.76 0}
679 \newcolor{OliveGreen}{0.64 0 0.95 0.40}
680 \newcolor{RawSienna}{0 0.72 1 0.45}
681 \newcolor{Sepia}{0 0.83 1 0.70}
682 \newcolor{Brown}{0 0.81 1 0.60}
683 \newcolor{Tan}{0.14 0.42 0.56 0}
684 \newcolor{Gray}{0 0 0 0.50}
685 \newcolor{Black}{0 0 0 1}
686 \newcolor{White}{0 0 0 0}
687 %
688 % Our extra colors
689 %
690 \newcolor{LightYellow}{0 0 0.7 0}
691 \newcolor{LightRed}{0 0.75 0.7 0}
692 \newcolor{LightBlue}{0.7 0.5 0 0}
693 \newcolor{LightGray}{0 0 0 0.1}
694 \newcolor{VeryLightBlue}{0.15 0.07 0 0}
695 %
696 \SetColor{Black}
697 %
698 % #] Colors :
699 % #] Common LaTeX code :
700 % #[ LaTeX primitives :
701 %
702 % #[ Putting material
703 %
704
705 % Some utilities that remove extra space that creeps in, particularly
706 % when extra groups are inserted before the use of \put.
707 % Use the definition of \@killglue used in latex.ltx for \put,
708 % but copy it here, since \@killglue is internal and not documented.
709 \gdef\AXO@killglue{\unskip\@whiledim \lastskip >\z@\do{\unskip}}
710
711 % Special purpose versions of \put and \special
712 \long\gdef\putLen(#1,#2)#3{%
713 % Like LaTeX's \put, except that #1 and #2 are lengths instead of numbers
714 % giving lengths in units of \unitlength.
715 \AXO@killglue\raise#2\relax
716 \hbox to 0pt{\kern#1\relax #3\hss}%
717 \ignorespaces
718 }
719 %
720 \def\AxoPut(#1,#2)#3{%
721 % Like \put, but shifted by axodraw's offsets.
722 % This provides a way of coding the offsets in one place.
723 % But we are only using it in a limited set of cases so far.
724 \AXO@killglue
725 \bgroup
726 \axounitlength = \axoscale pt
727 \axo@x = \axoxoff \unitlength
728 \advance\axo@x by \axoxo \axounitlength
729 \advance\axo@x by #1 \axounitlength
730 \axo@y = \axoyoff \unitlength
731 \advance\axo@y by \axoyo \axounitlength
732 \advance\axo@y by #2 \axounitlength
733 \putLen(\axo@x,\axo@y){%
734 % If there are axodraw objects in #3, they should not also
735 % apply shifts, that would be double
736 % counting! Hence:
737 \SetOffset(0,0)%
738 \SetScaledOffset(0,0)%
739 #3%
740 }%
741 \egroup
742 \ignorespaces
743 }
744
745 \def\AXOspecial#1{%
746 % Insertion of postscript code:
747 % Replacement for \special{" ...}, with the color initialized
748 % to the color befor the \special. (Ordinary \special{"...}
749 % initializes color to black.)
750 % Definitions made by \special{!...} are in dictionary SDict
751 % (as stated in dvips documentation), and we save color there.
752 \special{ps:: SDict begin savecolor end }%
753 \special{" restorecolor #1 }%
754 }
755
756 \def\AXOputPS#1{%
757 % Insert postscript code after allowing for offsets.
758 \AxoPut(0,0){\AXOspecial{#1}}%
759 }
760
761 \def\AXOputPDF#1{
762 % Insert pdf code after allowing for offsets.
763 \AxoPut(0,0){\axo@pdfliteral{#1}}%
764 }
765
766 %
767 % Now variables and routines for setting material in boxes (used by
768 % the BText etc commands.
769 %
770 \newdimen\tmpX
771 \newdimen\tmpY
772 \newsavebox{\tmpBox}
773 \newsavebox{\tmpBoxA}
774 %
775 \newcount\axo@tmp
776 \newcount\axo@tmpA
777 \newcount\axo@tmpB
778
779 \newcount\bpinsp
780 \bpinsp = 65782
781 \newcount\ptinsp
782 \ptinsp = 65536
783
784 \def\AssignDecDiv#1#2#3{%
785 % Assign the variable of name #1 to the result of dividing integer
786 % #2 by integer #3, with result as a textual decimal. Absolute
787 % accuracy: 0.001.
788 % Typical use: conversion of lengths to points and big points.
789 % \AssignDecDiv{cachedscale}{\unitlength}{65536}
790 % \AssignDecDiv{cachedscale}{\unitlength}{\ptinsp}
791 % to get length in points.
792 % Notes on conversion
793 % 1 sp = 2^{-16} pt = (1/65536) pt
794 % 1 pt = (1/72.27) in
795 % 1 bp = (1/72) in
796 % 1 sp = (1/65781.76) bp
797 % Use \relax at end of lines setting count registers.
798 % This ensures that the code works both when the arguments are
799 % given as numbers, e.g., \AxoDecDiv{100}{3}, as well as when they are
800 % given as lengths, etc, e.g., \AxoDecDiv{\unitlength}{256}
801 %
802 \axo@tmp = #2\relax
803 \axo@tmpA = \axo@tmp
804 \divide \axo@tmpA by #3\relax
805 \axo@tmpB=\axo@tmpA
806 \multiply \axo@tmpA by #3\relax
807 \advance \axo@tmp by -\axo@tmpA
808 \multiply \axo@tmp by 1000
809 \divide \axo@tmp by #3\relax
810 \expandafter\edef\csname #1\endcsname{\the\axo@tmpB.\the\axo@tmp}%
811 }
812
813 \def\SetTmpBox#1{%
814 % Sets the box \tmpBox to the contents of #1 set with current PS
815 % font and size. Sets \tmpX and \tmpY to the dimensions of the box
816 % plus some space around it, suitable for drawing an enclosing box.
817 %
818 % The vertical box setting numbers agree with those in axodraw's
819 % postscript code, but not (28 July 2014) with the axohelp pdf code.
820 % The reverse is true for the horizontal box settings.
821 % We can tweak them further.
822 % This is a standardized routine for use in all versions of postscript
823 % textbox routines.
824 % N.B. Use LaTeX's \sbox at first step, not TeX primitives to set
825 % box contents; it works properly with color.
826 \sbox{\tmpBox}{\UseCurrentPSFont #1}%
827 \tmpX = \axofontsize pt
828 \advance \tmpX by \wd\tmpBox
829 \tmpY = \axofontsize pt
830 \tmpY = 0.33333 \tmpY
831 \advance \tmpY by \ht\tmpBox
832 \advance \tmpY by \dp\tmpBox
833 \AssignDecDiv{tmpXT}{\tmpX}{\ptinsp}%
834 \AssignDecDiv{tmpYT}{\tmpY}{\ptinsp}%
835 }
836
837 \def\SetTmpBoxTwo#1#2{%
838 % Equivalent of \SetTmpBox for two line commands.
839 %
840 % N.B. Use LaTeX's \sbox at first step, not TeX primitives to set
841 % box contents; it works properly with color.
842 \sbox{\tmpBox}{\UseCurrentPSFont #1}%
843 \sbox{\tmpBoxA}{\UseCurrentPSFont #2}%
844 \ifdim \wd\tmpBox > \wd\tmpBoxA
845 \tmpX = \wd\tmpBox
846 \else
847 \tmpX = \wd\tmpBoxA
848 \fi
849 \advance \tmpX by \axofontsize pt
850 \tmpY = \axofontsize pt
851 \setbox\tmpBox=%
852 \vbox{%
853 \lineskip = 0.1 \tmpY
854 \baselineskip = 1.1 \tmpY
855 \vskip 0.3 \tmpY
856 \hbox{\makebox[0pt]{\box\tmpBox}}%
857 \hbox{\makebox[0pt]{\box\tmpBoxA}}%
858 \vskip 0.3 \tmpY
859 }%
860 \tmpY = \ht\tmpBox
861 \advance \tmpY by \dp\tmpBox
862 \AssignDecDiv{tmpXT}{\tmpX}{\ptinsp}%
863 \AssignDecDiv{tmpYT}{\tmpY}{\ptinsp}%
864 }
865 %
866 % #] Putting
867 % #[ Point setting and using :
868 %
869 \def\SetPoint#1(#2,#3){%
870 % Define a named point in 2D
871 \@namedef{[email protected]@#1}{#2}%
872 \@namedef{[email protected]@#1}{#3}%
873 }
874 \def\useX#1{%
875 % Use a named point
876 \@nameuse{[email protected]@#1}%
877 }
878 \def\useY#1{%
879 % Use a named point
880 \@nameuse{[email protected]@#1}%
881 }
882 %
883 % #] Point setting and using :
884 % #[ Particle routines :
885 % #[ Gluon :
886 %
887 \def\Gluon{%
888 %
889 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
890 %
891 \AXO@Parse{\AXO@Gluon}{}%
892 }
893 %
894 % #] Gluon :
895 % #[ DoubleGluon :
896 %
897 \defWithOption{DoubleGluon}{(#2,#3)(#4,#5)#6#7#8}{%
898 %
899 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
900 %
901 \Gluon[double,sep=#8,#1](#2,#3)(#4,#5){#6}{#7}%
902 }
903 %
904 % #] DoubleGluon :
905 % #[ DashGluon :
906 %
907 \defWithOption{DashGluon}{(#2,#3)(#4,#5)#6#7#8}{%
908 %
909 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
910 %
911 \Gluon[dash,dashsize=#8,#1](#2,#3)(#4,#5){#6}{#7}%
912 }
913 %
914 % #] DashGluon :
915 % #[ DashDoubleGluon :
916 %
917 \defWithOption{DashDoubleGluon}{(#2,#3)(#4,#5)#6#7#8#9}{%
918 %
919 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
920 %
921 \Gluon[double,sep=#8,dash,dashsize=#9,#1](#2,#3)(#4,#5){#6}{#7}%
922 }
923 %
924 % #] DashDoubleGluon :
925 % #[ GluonCirc :
926 %
927 % Draws a gluon on a circle. The center of the circle is at (#1,#2)
928 % The radius and the phase angle are (#3,#4), #5 is the
929 % amplitude of the gluon, and #6 is the number of windings.
930 %
931 \def\GluonCirc{%
932 %
933 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
934 %
935 \AXO@Parse{\AXO@GluonCirc}{}%
936 }
937 %
938 % #] GluonCirc :
939 % #[ DoubleGluonCirc :
940 %
941 \defWithOption{DoubleGluonCirc}{(#2,#3)(#4,#5)#6#7#8}{%
942 %
943 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
944 %
945 \GluonCirc[double,sep=#8,#1](#2,#3)(#4,#5){#6}{#7}%
946 }
947 %
948 % #] DoubleGluonCirc :
949 % #[ DashGluonCirc :
950 %
951 \defWithOption{DashGluonCirc}{(#2,#3)(#4,#5)#6#7#8}{%
952 %
953 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
954 %
955 \GluonCirc[dash,dashsize=#8,#1](#2,#3)(#4,#5){#6}{#7}%
956 }
957 %
958 % #] DashGluonCirc :
959 % #[ DashDoubleGluonCirc :
960 %
961 \defWithOption{DashDoubleGluonCirc}{(#2,#3)(#4,#5)#6#7#8#9}{%
962 %
963 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude and number of windings
964 %
965 \GluonCirc[double,sep=#8,dash,dashsize=#9,#1](#2,#3)(#4,#5){#6}{#7}%
966 }
967 %
968 % #] DashDoubleGluonCirc :
969 % #[ GluonArc :
970 %
971 \def\GluonArc{%
972 % \GluonArc(x,y)(r,theta1,theta2){amplitude}{numwind}
973 % draws a gluon on an arc centered at (x,y) of radius r, starting
974 % at theta1, and ending at theta2, with given amplitude and
975 % number of windings
976 %
977 \AXO@Parse{\AXO@GluonArc}{}%
978 }
979 %
980 \let\GlueArc=\GluonArc % For backward compatibility
981 %
982 % #] GluonArc :
983 % #[ DoubleGluonArc :
984 %
985 \defWithOption{DoubleGluonArc}{(#2)(#3)#4#5#6}{%
986 %
987 % \DoubleGluonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{sep}
988 % draws a gluon on an arc centered at (x,y) of radius r, starting
989 % at theta1, and ending at theta2, with given amplitude and
990 % number of windings
991 %
992 \GluonArc[double,sep=#6,#1](#2)(#3){#4}{#5}%
993 }
994 %
995 \let\DoubleGlueArc=\DoubleGluonArc % For backward compatibility
996 %
997 % #] DoubleGluonArc :
998 % #[ DashGluonArc :
999 %
1000 \defWithOption{DashGluonArc}{(#2)(#3)#4#5#6}{%
1001 %
1002 % \DashGluonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1003 % draws a gluon on an arc centered at (x,y) of radius r, starting
1004 % at theta1, and ending at theta2, with given amplitude and
1005 % number of windings
1006 %
1007 \GluonArc[dash,dashsize=#6,#1](#2)(#3){#4}{#5}%
1008 }
1009 %
1010 \let\DashGlueArc=\DashGluonArc % For backward compatibility
1011 %
1012 % #] DashGluonArc :
1013 % #[ DashDoubleGluonArc :
1014 %
1015 \defWithOption{DashDoubleGluonArc}{(#2)(#3)#4#5#6#7}{%
1016 %
1017 % \DashGluonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1018 % draws a gluon on an arc centered at (x,y) of radius r, starting
1019 % at theta1, and ending at theta2, with given amplitude and
1020 % number of windings
1021 %
1022 \GluonArc[double,sep=#6,dash,dashsize=#7,#1](#2)(#3){#4}{#5}%
1023 }
1024 %
1025 \let\DashDoubleGlueArc=\DashDoubleGluonArc % For backward compatibility
1026 %
1027 % #] DashDoubleGluonArc :
1028 % #[ GluonArcn :
1029 %
1030 \defWithOption{GluonArcn}{(#2)(#3)#4#5}{%
1031 % \GluonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}
1032 % draws a gluon on an arc centered at (x,y) of radius r, starting
1033 % at theta1, and ending at theta2, with given amplitude and
1034 % number of windings. The n stands for clockwise
1035 %
1036 \GluonArc[clockwise,#1](#2)(#3){#4}{#5}%
1037 }
1038 %
1039 \let\GlueArcn=\GluonArcn % For backward compatibility
1040 %
1041 % #] GluonArcn :
1042 % #[ DoubleGluonArcn :
1043 %
1044 \defWithOption{DoubleGluonArcn}{(#2)(#3)#4#5#6}{%
1045 %
1046 % \DoubleGluonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{sep}
1047 % draws a gluon on an arc centered at (x,y) of radius r, starting
1048 % at theta1, and ending at theta2, with given amplitude and
1049 % number of windings. Clockwise.
1050 %
1051 \GluonArc[clockwise,double,sep=#6,#1](#2)(#3){#4}{#5}%
1052 }
1053 %
1054 \let\DoubleGlueArcn=\DoubleGluonArcn % For backward compatibility
1055 %
1056 % #] DoubleGluonArcn :
1057 % #[ DashGluonArcn :
1058 %
1059 \defWithOption{DashGluonArcn}{(#2)(#3)#4#5#6}{%
1060 %
1061 % \DashGluonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1062 % draws a gluon on an arc centered at (x,y) of radius r, starting
1063 % at theta1, and ending at theta2, with given amplitude and
1064 % number of windings. Clockwise.
1065 %
1066 \GluonArc[clockwise,dash,dashsize=#6,#1](#2)(#3){#4}{#5}%
1067 }
1068 %
1069 \let\DashGlueArcn=\DashGluonArcn % For backward compatibility
1070 %
1071 % #] DashGluonArcn :
1072 % #[ DashDoubleGluonArcn :
1073 %
1074 \defWithOption{DashDoubleGluonArcn}{(#2)(#3)#4#5#6#7}{%
1075 %
1076 % \DashGluonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1077 % draws a gluon on an arc centered at (x,y) of radius r, starting
1078 % at theta1, and ending at theta2, with given amplitude and
1079 % number of windings. Clockwise.
1080 %
1081 \GluonArc[clockwise,double,sep=#6,dash,dashsize=#7,#1](#2)(#3){#4}{#5}%
1082 }
1083 %
1084 \let\DashDoubleGlueArcn=\DashDoubleGluonArcn % For backward compatibility
1085 %
1086 % #] DashDoubleGluonArcn :
1087 % #[ Photon :
1088 %
1089 \def\Photon{%
1090 % \Photon[opt](x1,y1)(x2,y2){amplitude}{numwind}
1091 % Draws a photon from (x1,y1) to (x2,y2) with given amplitude and
1092 % number of windings
1093 % Supported options: double, sep, linesep
1094 %
1095 \AXO@Parse{\AXO@Photon}{}%
1096 }
1097 %
1098 % #] Photon :
1099 % #[ DoublePhoton :
1100 %
1101 \defWithOption{DoublePhoton}{(#2,#3)(#4,#5)#6#7#8}{%
1102 %
1103 % Draws a photon from (x1,y1) to (x2,y2) with amplitude and number of windings
1104 %
1105 \Photon[double,sep=#8,#1](#2,#3)(#4,#5){#6}{#7}%
1106 }
1107 %
1108 % #] DoublePhoton :
1109 % #[ DashPhoton :
1110 %
1111 \defWithOption{DashPhoton}{(#2,#3)(#4,#5)#6#7#8}{%
1112 %
1113 % Draws a photon from (x1,y1) to (x2,y2) with amplitude and number of windings
1114 %
1115 \Photon[dash,dashsize=#8,#1](#2,#3)(#4,#5){#6}{#7}%
1116 }
1117 %
1118 % #] DashPhoton :
1119 % #[ DashDoublePhoton :
1120 %
1121 \defWithOption{DashDoublePhoton}{(#2,#3)(#4,#5)#6#7#8#9}{%
1122 %
1123 % Draws a photon from (x1,y1) to (x2,y2) with amplitude and number of windings
1124 %
1125 \Photon[double,sep=#8,dash,dashsize=#9,#1](#2,#3)(#4,#5){#6}{#7}%
1126 }
1127 %
1128 % #] DashDoublePhoton :
1129 % #[ PhotonArc :
1130 %
1131 \def\PhotonArc{%
1132 % \PhotonArc(x,y)(r,theta1,theta2){amplitude}{numwind}
1133 % draws a photon on an arc centered at (x,y) of radius r, starting
1134 % at theta1, and ending at theta2, with given amplitude and
1135 % number of windings
1136 %
1137 \AXO@Parse{\AXO@PhotonArc}{}%
1138 }
1139 %
1140 % #] PhotonArc :
1141 % #[ DoublePhotonArc :
1142 %
1143 \defWithOption{DoublePhotonArc}{(#2,#3)(#4,#5,#6)#7#8#9}{%
1144 %
1145 % \PhotonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{sep}
1146 % draws a photon on an arc centered at (x,y) of radius r, starting
1147 % at theta1, and ending at theta2, with given amplitude and
1148 % number of windings
1149 %
1150 \PhotonArc[double,sep=#9,#1](#2,#3)(#4,#5,#6){#7}{#8}%
1151 }
1152 %
1153 % #] DoublePhotonArc :
1154 % #[ DashPhotonArc :
1155 %
1156 \defWithOption{DashPhotonArc}{(#2,#3)(#4,#5,#6)#7#8#9}{%
1157 %
1158 % \DashPhotonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1159 % draws a photon on an arc centered at (x,y) of radius r, starting
1160 % at theta1, and ending at theta2, with given amplitude and
1161 % number of windings
1162 %
1163 \PhotonArc[dash,dashsize=#9,#1](#2,#3)(#4,#5,#6){#7}{#8}%
1164 }
1165 %
1166 %
1167 % #] DashPhotonArc :
1168 % #[ DashDoublePhotonArc :
1169 %
1170 \defWithOption{DashDoublePhotonArc}{(#2)(#3)#4#5#6#7}{%
1171 % Note that there are actually ten arguments with the optional #1,
1172 % which LaTeX/TeX can't handle. I consolidate the comma separated
1173 % arguments into one, and then pass them to \PhotonArc
1174 %
1175 % \DashPhotonArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1176 % draws a photon on an arc centered at (x,y) of radius r, starting
1177 % at theta1, and ending at theta2, with given amplitude and
1178 % number of windings
1179 %
1180 \PhotonArc[double,sep=#6,dash,dashsize=#7,#1](#2)(#3){#4}{#5}%
1181 }
1182 %
1183 %
1184 % #] DashDoublePhotonArc :
1185 % #[ PhotonArcn :
1186 %
1187 \defWithOption{PhotonArcn}{(#2,#3)(#4,#5,#6)#7#8}{%
1188 % \PhotonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}
1189 % draws a photon on an arc centered at (x,y) of radius r, starting
1190 % at theta1, and ending at theta2, with given amplitude and
1191 % number of windings
1192 %
1193 \PhotonArc[clockwise,#1](#2,#3)(#4,#5,#6){#7}{#8}%
1194 }
1195 %
1196 % #] PhotonArcn :
1197 % #[ DoublePhotonArcn :
1198 %
1199 \defWithOption{DoublePhotonArcn}{(#2)(#3)#4#5#6}{%
1200 % I consolidate the comma separated arguments into one, and then pass
1201 % them to \PhotonArc
1202 %
1203 % \PhotonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{sep}
1204 % draws a photon on an arc centered at (x,y) of radius r, starting
1205 % at theta1, and ending at theta2, with given amplitude and
1206 % number of windings
1207 %
1208 \PhotonArc[clockwise,double,sep=#6,#1](#2)(#3){#4}{#5}%
1209 }
1210 %
1211 % #] DoublePhotonArcn :
1212 % #[ DashPhotonArcn :
1213 %
1214 \defWithOption{DashPhotonArcn}{(#2)(#3)#4#5#6}{%
1215 % I consolidate the comma separated arguments into one, and then pass
1216 % them to \PhotonArc
1217 %
1218 % \DashPhotonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1219 % draws a photon on an arc centered at (x,y) of radius r, starting
1220 % at theta1, and ending at theta2, with given amplitude and
1221 % number of windings.Clockwise.
1222 %
1223 \PhotonArc[clockwise,dash,dashsize=#6,#1](#2)(#3){#4}{#5}%
1224 }
1225 %
1226 %
1227 % #] DashPhotonArcn :
1228 % #[ DashDoublePhotonArcn :
1229 %
1230 \defWithOption{DashDoublePhotonArcn}{(#2)(#3)#4#5#6#7}{%
1231 % I consolidate the comma separated arguments into one, and then pass
1232 % them to \PhotonArc
1233 %
1234 % \DashPhotonArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1235 % draws a photon on an arc centered at (x,y) of radius r, starting
1236 % at theta1, and ending at theta2, with given amplitude and
1237 % number of windings. Clockwise.
1238 %
1239 \PhotonArc[clockwise,double,sep=#6,dash,dashsize=#7,#1](#2)(#3){#4}{#5}%
1240 }
1241 %
1242 %
1243 % #] DashDoublePhotonArcn :
1244 % #[ ZigZag :
1245 %
1246 \def\ZigZag{%
1247 % \ZigZag[opt](x1,y1)(x2,y2){amplitude}{numwind}
1248 % Draws a zigzag from (x1,y1) to (x2,y2) with given amplitude and
1249 % number of windings
1250 % Supported options: double, sep, linesep
1251 %
1252 \AXO@Parse{\AXO@ZigZag}{}%
1253 }
1254 %
1255 % #] ZigZag :
1256 % #[ DoubleZigZag :
1257 %
1258 \defWithOption{DoubleZigZag}{(#2,#3)(#4,#5)#6#7#8}{%
1259 %
1260 % Draws a zigzag from (x1,y1) to (x2,y2) with amplitude and number of windings
1261 %
1262 \ZigZag[double,sep=#8,#1](#2,#3)(#4,#5){#6}{#7}%
1263 }
1264 %
1265 % #] DoubleZigZag :
1266 % #[ DashZigZag :
1267 %
1268 \defWithOption{DashZigZag}{(#2,#3)(#4,#5)#6#7#8}{%
1269 %
1270 % Draws a zigzag from (x1,y1) to (x2,y2) with amplitude and number of windings
1271 %
1272 \ZigZag[dash,dashsize=#8,#1](#2,#3)(#4,#5){#6}{#7}%
1273 }
1274 %
1275 % #] DashZigZag :
1276 % #[ DashDoubleZigZag :
1277 %
1278 \defWithOption{DashDoubleZigZag}{(#2,#3)(#4,#5)#6#7#8#9}{%
1279 %
1280 % Draws a zigzag from (x1,y1) to (x2,y2) with amplitude and number of windings
1281 %
1282 \ZigZag[double,sep=#8,dash,dashsize=#9,#1](#2,#3)(#4,#5){#6}{#7}%
1283 }
1284 %
1285 % #] DashDoubleZigZag :
1286 % #[ ZigZagArc :
1287 %
1288 \def\ZigZagArc{%
1289 % \ZigZagArc(x,y)(r,theta1,theta2){amplitude}{numwind}
1290 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1291 % at theta1, and ending at theta2, with given amplitude and
1292 % number of windings
1293 %
1294 \AXO@Parse{\AXO@ZigZagArc}{}%
1295 }
1296 %
1297 % #] ZigZagArc :
1298 % #[ DoubleZigZagArc :
1299 %
1300 \defWithOption{DoubleZigZagArc}{(#2,#3)(#4,#5,#6)#7#8#9}{%
1301 %
1302 % \ZigZagArc(x,y)(r,theta1,theta2){amplitude}{numwind}{sep}
1303 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1304 % at theta1, and ending at theta2, with given amplitude and
1305 % number of windings
1306 %
1307 \ZigZagArc[double,sep=#9,#1](#2,#3)(#4,#5,#6){#7}{#8}%
1308 }
1309 %
1310 % #] DoubleZigZagArc :
1311 % #[ DashZigZagArc :
1312 %
1313 \defWithOption{DashZigZagArc}{(#2)(#3)#4#5#6}{%
1314 %
1315 % \DashZigZagArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1316 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1317 % at theta1, and ending at theta2, with given amplitude and
1318 % number of windings
1319 %
1320 \ZigZagArc[dash,dashsize=#6,#1](#2)(#3){#4}{#5}%
1321 }
1322 %
1323 %
1324 % #] DashZigZagArc :
1325 % #[ DashDoubleZigZagArc :
1326 %
1327 \defWithOption{DashDoubleZigZagArc}{(#2)(#3)#4#5#6#7}{%
1328 %
1329 % \DashZigZagArc(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1330 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1331 % at theta1, and ending at theta2, with given amplitude and
1332 % number of windings
1333 %
1334 \ZigZagArc[double,sep=#6,dash,dashsize=#7,#1](#2)(#3){#4}{#5}%
1335 }
1336 %
1337 %
1338 % #] DashDoubleZigZagArc :
1339 % #[ ZigZagArcn :
1340 %
1341 \defWithOption{ZigZagArcn}{(#2)(#3)#4#5}{%
1342 % \ZigZagArcn(x,y)(r,theta1,theta2){amplitude}{numwind}
1343 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1344 % at theta1, and ending at theta2, with given amplitude and
1345 % number of windings
1346 %
1347 \ZigZagArc[clockwise,#1](#2)(#3){#4}{#5}%
1348 }
1349 %
1350 % #] ZigZagArcn :
1351 % #[ DoubleZigZagArcn :
1352 %
1353 \defWithOption{DoubleZigZagArcn}{(#2)(#3)#4#5#6}{%
1354 %
1355 % \ZigZagArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{sep}
1356 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1357 % at theta1, and ending at theta2, with given amplitude and
1358 % number of windings
1359 %
1360 \ZigZagArc[clockwise,double,sep=#6,#1](#2)(#3){#4}{#5}%
1361 }
1362 %
1363 % #] DoubleZigZagArcn :
1364 % #[ DashZigZagArcn :
1365 %
1366 \defWithOption{DashZigZagArcn}{(#2)(#3)#4#5#6}{%
1367 %
1368 % \DashZigZagArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1369 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1370 % at theta1, and ending at theta2, with given amplitude and
1371 % number of windings.Clockwise.
1372 %
1373 \ZigZagArc[clockwise,dash,dashsize=#6,#1](#2)(#3){#4}{#5}%
1374 }
1375 %
1376 %
1377 % #] DashZigZagArcn :
1378 % #[ DashDoubleZigZagArcn :
1379 %
1380 \defWithOption{DashDoubleZigZagArcn}{(#2)(#3)#4#5#6#7}{%
1381 %
1382 % \DashZigZagArcn(x,y)(r,theta1,theta2){amplitude}{numwind}{dashsize}
1383 % draws a zigzag on an arc centered at (x,y) of radius r, starting
1384 % at theta1, and ending at theta2, with given amplitude and
1385 % number of windings. Clockwise.
1386 %
1387 \ZigZagArc[clockwise,double,sep=#6,dash,dashsize=#7,#1](#2)(#3){#4}{#5}%
1388 }
1389 %
1390 % #] DashDoubleZigZagArcn :
1391 % #] Particle routines :
1392 % #[ Line routines :
1393 % #[ Line :
1394 %
1395 \def\Line{%
1396 % \Line[opt](x1,y1)(x2,y2)
1397 % draws a line from (x1,y1) to (x2,y2). NO arrow by default.
1398 % Supported options: all arrow settings, all double line settings,
1399 % all dash line settings.
1400 %
1401 \AXO@Parse{\AXO@Line}{}%
1402 }
1403 %
1404 % #] Line :
1405 % #[ DoubleLine :
1406 %
1407 \defWithOption{DoubleLine}{(#2,#3)(#4,#5)#6}{%
1408 %
1409 % \DoubleLine[opt](x1,y1)(x2,y2){sep}
1410 % Draws a double line, with NO arrow by default, from (x1,y1) to (x2,y2),
1411 % with separation sep
1412 %
1413 \Line[arrow=false,double,sep=#6,#1](#2,#3)(#4,#5)%
1414 }
1415 %
1416 % #] DoubleLine :
1417 % #[ DashLine :
1418 %
1419 \defWithOption{DashLine}{(#2,#3)(#4,#5)#6}{%
1420 % \DashLine[opt](x1,y1)(x2,y2){sep}
1421 % Draws a line from (x1,y1) to (x2,y2) with a dash pattern of which the
1422 % alternating black and white pieces are approximately sep points long
1423 %
1424 \Line[dash,dashsize=#6,#1](#2,#3)(#4,#5)%
1425 }
1426 %
1427 % #] DashLine :
1428 % #[ DashDoubleLine :
1429 %
1430 \defWithOption{DashDoubleLine}{(#2,#3)(#4,#5)#6#7}{%
1431 % \DashDoubleLine[opt](x1,y1)(x2,y2){sep}{dashsize}
1432 % Draws a double line from (x1,y1) to (x2,y2) with separation sep,
1433 % and with a dash pattern of which the
1434 % alternating black and white pieces are approximately sep points long
1435 % Arrow off.
1436 \Line[arrow=off,dash,dashsize=#7,double,sep=#6,#1](#2,#3)(#4,#5)%
1437 }
1438 %
1439 % #] DashDoubleLine :
1440 % #[ ArrowLine :
1441 %
1442 \defWithOption{ArrowLine}{(#2,#3)(#4,#5)}{%
1443 % \ArrowLine[opt](x1,y1)(x2,y2)
1444 % draws a line from (x1,y1) to (x2,y2). Arrow by default.
1445 %
1446 \Line[arrow,#1](#2,#3)(#4,#5)%
1447 }
1448 %
1449 % #] ArrowLine :
1450 % #[ ArrowDoubleLine :
1451 %
1452 \defWithOption{ArrowDoubleLine}{(#2,#3)(#4,#5)#6}{%
1453 %
1454 % \ArrowDoubleLine[opt](x1,y1)(x2,y2){sep}
1455 % Draws a double line, with arrow by default, from (x1,y1) to (x2,y2),
1456 % with separation sep
1457 %
1458 \Line[arrow,double,sep=#6,#1](#2,#3)(#4,#5)%
1459 }
1460 %
1461 % #] ArrowDoubleLine :
1462 % #[ DashArrowLine :
1463 %
1464 \defWithOption{DashArrowLine}{(#2,#3)(#4,#5)#6}{%
1465 % \DashArrowLine[opt](x1,y1)(x2,y2){sep}
1466 % Draws a line from (x1,y1) to (x2,y2) with a dash pattern of which the
1467 % alternating black and white pieces are approximately sep points
1468 % long. Arrow by default.
1469 %
1470 \Line[arrow,dash,dashsize=#6,#1](#2,#3)(#4,#5)%
1471 }
1472 %
1473 \let\ArrowDashLine=\DashArrowLine%
1474 %
1475 % #] DashArrowLine :
1476 % #[ DashArrowDoubleLine :
1477 %
1478 \defWithOption{DashArrowDoubleLine}{(#2,#3)(#4,#5)#6#7}{%
1479 % \DashArrowDoubleLine[opt](x1,y1)(x2,y2){sep}{dashsize}
1480 % Draws a double line from (x1,y1) to (x2,y2) with separation sep,
1481 % and with a dash pattern of which the
1482 % alternating black and white pieces are approximately sep points long
1483 % Arrow on.
1484 %
1485 \Line[arrow,dash,dashsize=#7,double,sep=#6,#1](#2,#3)(#4,#5)%
1486 }
1487 %
1488 \let\ArrowDashDoubleLine=\DashArrowDoubleLine%
1489 %
1490 % #] DashArrowDoubleLine :
1491 % #[ LongArrow :
1492 %
1493 \defWithOption{LongArrow}{(#2,#3)(#4,#5)}{%
1494 \Line[arrow,arrowpos=1,#1](#2,#3)(#4,#5)%
1495 }
1496 %
1497 % #] LongArrow :
1498 % #[ DashLongArrowLine :
1499 %
1500 \defWithOption{DashLongArrowLine}{(#2,#3)(#4,#5)#6}{%
1501 % \DashLongArrowLine[opt](x1,y1)(x2,y2){sep}
1502 % Draws a line from (x1,y1) to (x2,y2) with a dash pattern of which the
1503 % alternating black and white pieces are approximately sep points
1504 % long. Arrow by default.
1505 %
1506 %
1507 \Line[arrow,arrowpos=1,dash,dashsize=#6,#1](#2,#3)(#4,#5)%
1508 }
1509 \let\DashLongArrow=\DashLongArrowLine
1510 \let\LongArrowDash=\DashLongArrowLine
1511 \let\LongArrowDashLine=\DashLongArrowLine
1512 %
1513 % #] DashLongArrowLine :
1514 % #] Line routines :
1515 % #[ Arc routines :
1516 % #[ Arc :
1517 %
1518 \def\Arc{%
1519 % \Arc[opt](x,y)(r,theta1,theta2)
1520 % draws an arc centered at (x,y) of radius r, starting at theta1,
1521 % and ending at theta2. By default: no arrow, undashed, single,
1522 % anticlockwise.
1523 % Supported options: all arrow settings, all double line settings,
1524 % all dash line settings, clock
1525 %
1526 \AXO@Parse{\AXO@Arc}{}%
1527 }
1528 %
1529 % #] Arc :
1530 % #[ CArc :
1531 %
1532 \let\CArc=\Arc
1533 %
1534 % #] CArc :
1535 % #[ DoubleArc :
1536 %
1537 \defWithOption{DoubleArc}{(#2,#3)(#4,#5,#6)#7}{%
1538 %
1539 % Draws a double lined arc segment. The center of the curve
1540 % is at (1,2).
1541 % The radius, start angle and target angle are (#3,#4,#5).
1542 % The arc segment runs anticlockwise
1543 % #6 is the separation of the lines.
1544 %
1545 \Arc[double,sep=#7,#1](#2,#3)(#4,#5,#6)%
1546 }
1547 \let\DoubleCArc=\DoubleArc
1548 %
1549 % #] DoubleArc :
1550 % #[ DashArc :
1551 %
1552 \defWithOption{DashArc}{(#2,#3)(#4,#5,#6)#7}{%
1553 %
1554 % Draws a dashed arc segment. The center of the curve
1555 % is at (1,2).
1556 % The radius, start angle and target angle are (#3,#4,#5).
1557 % The arc segment runs anticlockwise
1558 % #6 is the dashsize. this is rounded to make things come
1559 % out right.
1560 %
1561 \Arc[dash,dsize=#7,#1](#2,#3)(#4,#5,#6)%
1562 }
1563 \let\DashCArc=\DashArc
1564 %
1565 % #] DashArc :
1566 % #[ DashDoubleArc :
1567 %
1568 \defWithOption{DashDoubleArc}{(#2,#3)(#4,#5,#6)#7#8}{
1569 %
1570 % Draws a dashed arc segment. The center of the curve
1571 % is at (1,2).
1572 % The radius, start angle and target angle are (#3,#4,#5).
1573 % The arc segment runs anticlockwise
1574 % #6 is the line separation.
1575 % #7 is the dashsize. this is rounded to make things come
1576 % out right.
1577 %
1578 \Arc[double,sep=#7,dash,dsize=#8,#1](#2,#3)(#4,#5,#6)%
1579 }
1580 \let\DashDoubleCArc=\DashDoubleArc
1581 %
1582 % #] DashDoubleArc :
1583 % #[ ArrowArc :
1584 %
1585 \def\ArrowArc{%
1586 \AXO@PrependOption{\Arc}{arrow}%
1587 }
1588 \let\ArrowCArc=\ArrowArc
1589 %
1590 % #] ArrowArc :
1591 % #[ ArrowDoubleArc :
1592 %
1593 \defWithOption{ArrowDoubleArc}{(#2,#3)(#4,#5,#6)#7}{%
1594 \Arc[arrow,double,sep=#7,#1](#2,#3)(#4,#5,#6)%
1595 }
1596 \let\ArrowDoubleCArc=\ArrowDoubleArc
1597 %
1598 % #] ArrowDoubleArc :
1599 % #[ ArrowDashArc :
1600 %
1601 \defWithOption{ArrowDashArc}{(#2,#3)(#4,#5,#6)#7}{%
1602 \Arc[arrow,dash,dsize=#7,#1](#2,#3)(#4,#5,#6)%
1603 }
1604 \let\ArrowDashCArc=\ArrowDashArc
1605 \let\DashArrowCArc=\ArrowDashArc
1606 \let\DashArrowArc=\ArrowDashArc
1607 %
1608 % #] ArrowDashArc :
1609 % #[ ArrowDashDoubleArc :
1610 %
1611 \defWithOption{ArrowDashDoubleArc}{(#2,#3)(#4,#5,#6)#7#8}{%
1612 \Arc[arrow,double,sep=#7,dash,dsize=#8,#1](#2,#3)(#4,#5,#6)%
1613 }
1614 \let\ArrowDashDoubleCArc=\ArrowDashDoubleArc
1615 \let\DashArrowDoubleCArc=\ArrowDashDoubleArc
1616 \let\DashArrowDoubleArc=\ArrowDashDoubleArc
1617 %
1618 %
1619 % #] ArrowDashDoubleArc :
1620 % #[ LongArrowArc :
1621 %
1622 \def\LongArrowArc{%
1623 \AXO@PrependOption{\Arc}{arrow,arrowpos=1}%
1624 }
1625 %
1626 % #] LongArrowArc :
1627 % #[ LongDashArrowArc :
1628 %
1629 \defWithOption{LongArrowDashArc}{(#2,#3)(#4,#5,#6)#7}{%
1630 \Arc[arrow,arrowpos=1,dash,dsize=#7,#1](#2,#3)(#4,#5,#6)%
1631 }
1632 \let\LongArrowDashCArc=\LongArrowDashArc
1633 \let\LongDashArrowCArc=\LongArrowDashArc
1634 \let\LongDashArrowArc=\LongArrowDashArc
1635 %
1636 %
1637 % #] LongDashArrowArc :
1638 % #[ ArrowArcn :
1639 %
1640 \def\ArrowArcn{%
1641 \AXO@PrependOption{\Arc}{arrow,clock}%
1642 }
1643 %
1644 % #] ArrowArcn :
1645 % #[ LongArrowArcn :
1646 %
1647 \def\LongArrowArcn{%
1648 % \ArrowArcn, but with arrow at end by default
1649 \AXO@PrependOption{\Arc}{arrow, clock, arrowpos=1}%
1650 }
1651 %
1652 % #] LongArrowArcn :
1653 % #[ DashArrowArcn :
1654 %
1655 \defWithOption{DashArrowArcn}{(#2,#3)(#4,#5,#6)#7}{%
1656 % (x,y)(radius,start,end){dashsize}
1657 % Draws a dashed arc segment with an arrow in it. The center of the curve
1658 % is at (x,y), with given radius, start angle, and end angle
1659 % The arc segment runs anticlockwise
1660 \Arc[clock,arrow,dash,dashsize=#7,#1](#2,#3)(#4,#5,#6)%
1661 }
1662 %
1663 \let\ArrowDashArcn=\DashArrowArcn%
1664 %
1665 %
1666 % #] DashArrowArcn :
1667 % #] Arc routines :
1668 % #[ Bezier :
1669 %
1670 \def\Bezier{%
1671 % \Bezier[opt](x1,y1)(x2,y2)(x3,y3)(x4,y4)
1672 % Draws a Bezier cubic with the control points (x1,y1), (x2,y2), (x3,y3), (x4,y4)
1673 % Supported options: dash, dashsize and dashsize
1674 \AXO@Parse{\AXO@Bezier}{}%
1675 }
1676 %
1677 \defWithOption{DoubleBezier}{(#2,#3)(#4,#5)(#6,#7)(#8)#9}{%
1678 %
1679 % Draws a Bezier cubic with control points (x1,y1), (x2,y2),
1680 % (x3,y3), (x4,y4) in a double line
1681 %
1682 \Bezier[double,sep=#9,#1](#2,#3)(#4,#5)(#6,#7)(#8)%
1683 }
1684 %
1685 \defWithOption{DashBezier}{(#2,#3)(#4,#5)(#6,#7)(#8)#9}{%
1686 %
1687 % Draws a Bezier cubic with control points (x1,y1), (x2,y2),
1688 % (x3,y3), (x4,y4) with a dash pattern of which the
1689 % alternating black and white pieces are approximately #9 points long
1690 %
1691 \Bezier[dash,dashsize=#9,#1](#2,#3)(#4,#5)(#6,#7)(#8)%
1692 }
1693 %
1694 \defWithOption{DashDoubleBezier}{(#2,#3)(#4,#5)(#6)(#7)#8#9}{%
1695 %
1696 % Draws a Bezier cubic with control points (x1,y1), (x2,y2),
1697 % (x3,y3), (x4,y4) with a dash pattern of which the
1698 % alternating black and white pieces are approximately #9 points long
1699 % The line is a double line
1700 %
1701 \Bezier[double,sep=#8,dash,dashsize=#9,#1](#2,#3)(#4,#5)(#6)(#7)%
1702 }
1703 %
1704 % #] Bezier :
1705 % #] LaTeX primitives :
1706 % #[ Mixed routines :
1707 %
1708 % Here we have routines that make different calls depending on the value
1709 % of the variable \axo@pdfoutput
1710 %
1711 % #[ EBox :
1712 %
1713 \def\EBox(#1,#2)(#3,#4){%
1714 %
1715 % Draws a transparent box with the left bottom at (x1,y1) andthe
1716 % right top at (x2,y2).
1717 %
1718 \ifcase\axo@pdfoutput
1719 \put(\axoxoff,\axoyoff){\AXOspecial{%
1720 #1 \axoxo\space add #2 \axoyo\space add
1721 #3 \axoxo\space add #4 \axoyo\space add \axowidth\space \axoscale\space ebox }}
1722 \else
1723 \getaxohelp{EBox}{#1 #2 #3 #4 \axowidth}
1724 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
1725 \fi
1726 }
1727 %
1728 % #] EBox :
1729 % #[ FBox :
1730 %
1731 \def\FBox(#1,#2)(#3,#4){%
1732 %
1733 % Draws a filled box with the left bottom at (x1,y1) and the right top
1734 % at (x2,y2).
1735 %
1736 \ifcase\axo@pdfoutput
1737 \put(\axoxoff,\axoyoff){\AXOspecial{%
1738 #1 \axoxo\space add #2 \axoyo\space add
1739 #3 \axoxo\space add #4 \axoyo\space add \axowidth\space \axoscale\space fbox }}
1740 \else
1741 \getaxohelp{FBox}{#1 #2 #3 #4 \axowidth}
1742 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
1743 \fi
1744 }
1745 %
1746 % #] FBox :
1747 % #[ BBox :
1748 %
1749 \def\BBox(#1,#2)(#3,#4){%
1750 %
1751 % Draws a box with the left bottom at (x1,y1) and the right top
1752 % at (x2,y2). The contents are blanked out.
1753 %
1754 {%
1755 \SetColor{White}%
1756 \FBox(#1,#2)(#3,#4)%
1757 }%
1758 \EBox(#1,#2)(#3,#4)%
1759 }
1760 %
1761 % #] BBox :
1762 % #[ GBox :
1763 %
1764 \def\GBox(#1,#2)(#3,#4)#5{%
1765 %
1766 % Draws a box with the left bottom at (x1,y1) and the right top
1767 % at (x2,y2). The contents are in Grayscale#5 (0=black,1=white).
1768 %
1769 {%
1770 \color[gray]{#5}%
1771 \FBox(#1,#2)(#3,#4)%
1772 \color[gray]{0}%
1773 \EBox(#1,#2)(#3,#4)%
1774 }%
1775 \ignorespaces
1776 }
1777 %
1778 % #] GBox :
1779 % #[ CBox :
1780 %
1781 \def\CBox(#1,#2)(#3,#4)#5#6{%
1782 %
1783 % Draws a box with the left bottom at (x1,y1) and the right top
1784 % at (x2,y2). The outside is color#5 and the inside color #6.
1785 %
1786 {%
1787 \SetColor{#6}%
1788 \FBox(#1,#2)(#3,#4)%
1789 \SetColor{#5}%
1790 \EBox(#1,#2)(#3,#4)%
1791 }%
1792 \ignorespaces
1793 }
1794 %
1795 % #] CBox :
1796 % #[ EBoxc :
1797 %
1798 \def\EBoxc(#1,#2)(#3,#4){%
1799 %
1800 % Draws a centered box with the center at (x1,y1).
1801 % The other parameters are the width and the height.
1802 % Uses current color
1803 %
1804 \ifcase\axo@pdfoutput
1805 \put(\axoxoff,\axoyoff){\AXOspecial{%
1806 #1 \axoxo\space add #3 2 div sub #2 \axoyo\space add
1807 #4 2 div sub #1 \axoxo\space add #3 2 div add #2
1808 \axoyo\space add #4 2 div add \axowidth\space \axoscale\space ebox }}
1809 \else
1810 \getaxohelp{Boxc}{#1 #2 #3 #4 \axowidth}
1811 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
1812 \fi
1813 }
1814 %
1815 \let\Boxc=\EBoxc
1816 %
1817 % #] EBoxc :
1818 % #[ FBoxc :
1819 %
1820 \def\FBoxc(#1,#2)(#3,#4){%
1821 %
1822 % Draws a filled centered box with the center at (x1,y1).
1823 % The other parameters are the width and the height.
1824 % Current color
1825 %
1826 \ifcase\axo@pdfoutput
1827 \put(\axoxoff,\axoyoff){\AXOspecial{%
1828 #1 \axoxo\space add #3 2 div sub #2 \axoyo\space add
1829 #4 2 div sub #1 \axoxo\space add #3 2 div add #2 \axoyo\space add #4 2 div add
1830 \axowidth\space \axoscale\space fbox }}
1831 \else
1832 \getaxohelp{FBoxc}{#1 #2 #3 #4 \axowidth}
1833 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
1834 \fi
1835 }
1836 %
1837 % #] FBoxc :
1838 % #[ BBoxc :
1839 %
1840 \def\BBoxc(#1,#2)(#3,#4){%
1841 %
1842 % Draws a centered box with the center at (x1,y1).
1843 % The other parameters are the width and the height.
1844 % The contents are blanked out.
1845 %
1846 \bgroup
1847 \SetColor{White}%
1848 \FBoxc(#1,#2)(#3,#4)%
1849 \egroup
1850 \EBoxc(#1,#2)(#3,#4)%
1851 }
1852 %
1853 % #] BBoxc :
1854 % #[ GBoxc :
1855 %
1856 \def\GBoxc(#1,#2)(#3,#4)#5{%
1857 %
1858 % Draws a centered box with the center at (x1,y1).
1859 % The other parameters are the width and the height.
1860 % The contents are in Grayscale#5 (0=black,1=white).
1861 %
1862 {%
1863 \color[gray]{#5}%
1864 \FBoxc(#1,#2)(#3,#4)%
1865 \color[gray]{0}%
1866 \EBoxc(#1,#2)(#3,#4)%
1867 }%
1868 \ignorespaces
1869 }
1870 %
1871 % #] GBoxc :
1872 % #[ CBoxc :
1873 %
1874 \def\CBoxc(#1,#2)(#3,#4)#5#6{%
1875 %
1876 % Draws a centered box with the center at (x1,y1).
1877 % The other parameters are the width and the height.
1878 % The outside is color#5 and the inside color #6.
1879 %
1880 {%
1881 \SetColor{#6}%
1882 \FBoxc(#1,#2)(#3,#4)%
1883 \SetColor{#5}%
1884 \EBoxc(#1,#2)(#3,#4)%
1885 }%
1886 \ignorespaces
1887 }
1888 %
1889 % #] CBoxc :
1890 % #[ RotatedBox :
1891 %
1892 \def\RotatedBox(#1,#2)(#3,#4)#5#6{%
1893 %
1894 % Draws a centered box with the center at (#1,#2)
1895 % with width #3, height #4, anticlockwise rotated by #5, and in
1896 % color #6.
1897 %
1898 \AxoPut(#1,#2){%
1899 {\SetColor{#6}%
1900 \rotatebox{#5}{\EBoxc(0,0)(#3,#4)}%
1901 }}%
1902 }
1903 %
1904 % #] RotatedBox :
1905 % #[ FilledRotatedBox :
1906 %
1907 \def\FilledRotatedBox(#1,#2)(#3,#4)#5#6{%
1908 %
1909 % Draws a filled centered box with the center at (#1,#2)
1910 % with width #3, height #4, anticlockwise rotated by #5, and in
1911 % color #6.
1912 %
1913 \AxoPut(#1,#2){%
1914 {\SetColor{#6}%
1915 \rotatebox{#5}{\FBoxc(0,0)(#3,#4)}%
1916 }}%
1917 }
1918 %
1919 % #] FilledRotatedBox :
1920 % #[ ETri :
1921 %
1922 % Draws a triangle. No filling.
1923 % The corners are (x1,y1), (x2,y2), (x3,y3)
1924 %
1925 \def\ETri(#1,#2)(#3,#4)(#5,#6){%
1926 %
1927 \ifcase\axo@pdfoutput
1928 \put(\axoxoff,\axoyoff){\AXOspecial{%
1929 #1 \axoxo\space add #2 \axoyo\space add
1930 #3 \axoxo\space add #4 \axoyo\space add
1931 #5 \axoxo\space add #6 \axoyo\space add
1932 \axowidth\space \axoscale\space triangle }}
1933 \else
1934 \getaxohelp{ETri}{#1 #2 #3 #4 #5 #6 \axowidth}
1935 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
1936 \fi
1937 }
1938 %
1939 % #] ETri :
1940 % #[ FTri :
1941 %
1942 % Draws a filled triangle.
1943 % The corners are (x1,y1), (x2,y2), (x3,y3)
1944 %
1945 \def\FTri(#1,#2)(#3,#4)(#5,#6){%
1946 %
1947 \ifcase\axo@pdfoutput
1948 \put(\axoxoff,\axoyoff){\AXOspecial{%
1949 #1 \axoxo\space add #2 \axoyo\space add
1950 #3 \axoxo\space add #4 \axoyo\space add
1951 #5 \axoxo\space add #6 \axoyo\space add
1952 \axowidth\space \axoscale\space ftriangle }}
1953 \else
1954 \getaxohelp{FTri}{#1 #2 #3 #4 #5 #6 \axowidth}
1955 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
1956 \fi
1957 }
1958 %
1959 % #] FTri :
1960 % #[ BTri :
1961 %
1962 % Draws a triangle. The contents are blanked out.
1963 % The corners are (x1,y1), (x2,y2), (x3,y3)
1964 %
1965 \def\BTri(#1,#2)(#3,#4)(#5,#6){%
1966 {%
1967 \SetColor{White}%
1968 \FTri(#1,#2)(#3,#4)(#5,#6)%
1969 }%
1970 \ETri(#1,#2)(#3,#4)(#5,#6)%
1971 }
1972 %
1973 % #] BTri :
1974 % #[ GTri :
1975 %
1976 % Draws a triangle. The contents are given in Grayscale #7 (0=black,1=white)
1977 % The corners are (x1,y1), (x2,y2), (x3,y3)
1978 %
1979 \def\GTri(#1,#2)(#3,#4)(#5,#6)#7{%
1980 %
1981 {%
1982 \color[gray]{#7}%
1983 \FTri(#1,#2)(#3,#4)(#5,#6)%
1984 \color[gray]{0}%
1985 \ETri(#1,#2)(#3,#4)(#5,#6)%
1986 }%
1987 \ignorespaces
1988 }
1989 %
1990 % #] GTri :
1991 % #[ CTri :
1992 %
1993 % Draws a colored(#7) triangle. The contents are blanked out in color #8
1994 % The corners are (x1,y1), (x2,y2), (x3,y3)
1995 %
1996 \def\CTri(#1,#2)(#3,#4)(#5,#6)#7#8{%
1997 {%
1998 \SetColor{#7}%
1999 \FTri(#1,#2)(#3,#4)(#5,#6)%
2000 \SetColor{#8}%
2001 \ETri(#1,#2)(#3,#4)(#5,#6)%
2002 }%
2003 \ignorespaces
2004 }
2005 %
2006 % #] CTri :
2007 % #[ Vertex :
2008 %
2009 \def\Vertex(#1,#2)#3{%
2010 %
2011 % Draws a fat dot at (1,2). The radius of the dot is given by 3.
2012 %
2013 \ifcase\axo@pdfoutput
2014 \put(\axoxoff,\axoyoff){\AXOspecial{%
2015 #1 \axoxo\space add #2 \axoyo\space add #3
2016 \axoscale\space vertex }}
2017 \else
2018 \getaxohelp{Vertex}{#1 #2 #3 \axowidth}
2019 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2020 \fi
2021 }
2022 %
2023 % #] Vertex :
2024 % #[ ECirc :
2025 %
2026 \def\ECirc(#1,#2)#3{%
2027 %
2028 % Draws a circle at (1,2) and radius 3, with current color.
2029 % Nothing is written inside.
2030 %
2031 \ifcase\axo@pdfoutput
2032 \put(\axoxoff,\axoyoff){\AXOspecial{%
2033 #1 \axoxo\space add #2 \axoyo\space add #3
2034 \axowidth\space \axoscale\space ecirc }}%
2035 \else
2036 \getaxohelp{ECirc}{#1 #2 #3 \axowidth}%
2037 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2038 \fi
2039 }
2040 %
2041 % #] ECirc :
2042 % #[ FCirc :
2043 %
2044 \let\FCirc=\Vertex
2045 %
2046 % #] FCirc :
2047 % #[ BCirc :
2048 %
2049 \def\BCirc(#1,#2)#3{%
2050 %
2051 % Draws a circle at (1,2) and radius 3 that is blanked out.
2052 {%
2053 \SetColor{White}%
2054 \FCirc(#1,#2){#3}
2055 }%
2056 \ECirc(#1,#2){#3}%
2057 }
2058 %
2059 % #] BCirc :
2060 % #[ GCirc :
2061 %
2062 \def\GCirc(#1,#2)#3#4{%
2063 %
2064 % Draws a circle at (1,2) and radius 3 that is blanked out.
2065 % Then it fills the circle with a gray scale 4 (0 = black, 1 is white)
2066 %
2067 {%
2068 \color[gray]{#4}%
2069 \FCirc(#1,#2){#3}%
2070 \color[gray]{0}%
2071 \ECirc(#1,#2){#3}%
2072 }%
2073 \ignorespaces
2074 }
2075 %
2076 % #] GCirc :
2077 % #[ CCirc :
2078 %
2079 % Draws a circle at (1,2) and radius 3 that is blanked out.
2080 % #4 is the color of the circle, #5 the color of the contents
2081 %
2082 \def\CCirc(#1,#2)#3#4#5{%
2083 %
2084 % Draws a circle at (1,2) and radius 3 that is blanked out.
2085 % #4 is the color of the circle, #5 the color of the contents
2086 %
2087 {%
2088 \SetColor{#5}%
2089 \FCirc(#1,#2){#3}%
2090 \SetColor{#4}%
2091 \ECirc(#1,#2){#3}%
2092 }%
2093 \ignorespaces
2094 }
2095 %
2096 % #] CCirc :
2097 % #[ GOval :
2098 %
2099 \def\GOval(#1,#2)(#3,#4)(#5)#6{%
2100 %
2101 % Draws a gray oval that overwrites whatever was there.
2102 % \GOval(x_center,y_center)(height,width)(rotation)(grayscale)
2103 % The grayscale: (0 = black, 1 is white)
2104 %
2105 {%
2106 \color[gray]{#6}%
2107 \FOval(#1,#2)(#3,#4)(#5)%
2108 \color[gray]{0}%
2109 \Oval(#1,#2)(#3,#4)(#5)%
2110 }%
2111 \ignorespaces
2112 }
2113 %
2114 % #] GOval :
2115 % #[ COval :
2116 %
2117 \def\COval(#1,#2)(#3,#4)(#5)#6#7{%
2118 %
2119 % Draws a colored oval that overwrites whatever was there.
2120 % \COval(x_center,y_center)(height,width)(rotation){color1}{color2}
2121 %
2122 {%
2123 \SetColor{#7}%
2124 \FOval(#1,#2)(#3,#4)(#5)%
2125 \SetColor{#6}%
2126 \Oval(#1,#2)(#3,#4)(#5)%
2127 }%
2128 \ignorespaces
2129 }
2130 %
2131 % #] COval :
2132 % #[ FOval :
2133 %
2134 \def\FOval(#1,#2)(#3,#4)(#5){%
2135 %
2136 % Draws a colored oval that overwrites whatever was there.
2137 % \FOval(x_center,y_center)(height,width)(rotation)
2138 % Uses current color
2139 %
2140 \ifcase\axo@pdfoutput
2141 \put(\axoxoff,\axoyoff)%
2142 {\AXOspecial{#1 \axoxo\space add #2 \axoyo\space add #3 #4 #5
2143 \axowidth\space \axoscale\space foval
2144 }}%
2145 \else
2146 \getaxohelp{FOval}{#1 #2 #3 #4 #5 \axowidth}%
2147 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2148 \fi
2149 }
2150 %
2151 % #] FOval :
2152 % #[ Oval :
2153 %
2154 \def\Oval(#1,#2)(#3,#4)(#5){%
2155 %
2156 % Draws an oval that does not overwrite whatever was there.
2157 % \Oval(x_center,y_center)(height,width)(rotation)
2158 %
2159 \ifcase\axo@pdfoutput
2160 \put(\axoxoff,\axoyoff)%
2161 {\AXOspecial{#1 \axoxo\space add #2 \axoyo\space add #3 #4 #5
2162 \axowidth\space \axoscale\space oval
2163 }}%
2164 \else
2165 \getaxohelp{Oval}{#1 #2 #3 #4 #5 \axowidth}%
2166 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2167 \fi
2168 }
2169 %
2170 % #] Oval :
2171 % #[ Polygon :
2172 %
2173 % Draws a curve through the points in argument 1.
2174 % The points are given as coordinates (x1,y1)(x2,y2)(x3,y3).....
2175 % The curve is continous and continuous in its first and second
2176 % derivatives. The method is linear interpolation of
2177 % quadratic curves.
2178 % Color name is argument 2.
2179 %
2180 \def\Polygon#1#2{%
2181 {%
2182 \SetColor{#2}%
2183 \ifcase\axo@pdfoutput
2184 \put(\axoxoff,\axoyoff){\AXOspecial{%
2185 [ \axoparray#1] \axowidth\space \axoscale\space polygon }}%
2186 \else
2187 \getaxohelp{Polygon}{"#1" \axowidth}%
2188 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2189 \fi
2190 }%
2191 \ignorespaces
2192 }
2193 %
2194 % #] Polygon :
2195 % #[ FilledPolygon :
2196 %
2197 % Draws a curve through the points in argument 1.
2198 % The points are given as coordinates (x1,y1)(x2,y2)(x3,y3).....
2199 % The curve is continous and continuous in its first and second
2200 % derivatives. The method is linear interpolation of
2201 % quadratic curves.
2202 % Color name is argument 2.
2203 %
2204 \def\FilledPolygon#1#2{%
2205 {%
2206 \SetColor{#2}%
2207 \ifcase\axo@pdfoutput
2208 \put(\axoxoff,\axoyoff){\AXOspecial{%
2209 [ \axoparray#1] \axowidth\space \axoscale\space filledpolygon }}
2210 \else
2211 \getaxohelp{FilledPolygon}{"#1" \axowidth}%
2212 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2213 \fi
2214 }%
2215 \ignorespaces
2216 }
2217 %
2218 % #] FilledPolygon :
2219 % #[ Curve :
2220 %
2221 % Draws a curve through the points in argument 1.
2222 % The points are given as coordinates (x1,y1)(x2,y2)(x3,y3).....
2223 % The curve is continous and continuous in its first and second
2224 % derivatives. The method is linear interpolation of quadratic curves.
2225 %
2226 \def\Curve#1{%
2227 \ifcase\axo@pdfoutput
2228 \put(\axoxoff,\axoyoff){\AXOspecial{[ \axoparray#1]
2229 \axowidth\space \axoscale\space makecurve }}
2230 \else
2231 \getaxohelp{Curve}{"#1" \axowidth}
2232 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2233 \fi
2234 }
2235 %
2236 % #] Curve :
2237 % #[ DashCurve :
2238 %
2239 % Draws a curve through the points in argument 1.
2240 % The points are given as coordinates (x1,y1)(x2,y2)(x3,y3).....
2241 % The curve is continous and continuous in its first and second
2242 % derivatives. The method is linear interpolation of quadratic curves.
2243 % Argument 2 gives a dash size.
2244 %
2245 \def\DashCurve#1#2{%
2246 \ifcase\axo@pdfoutput
2247 \put(\axoxoff,\axoyoff){\AXOspecial{[ \axoparray#1] #2
2248 \axowidth\space \axoscale\space makedashcurve }}
2249 \else
2250 \getaxohelp{DashCurve}{"#1" #2 \axowidth}
2251 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2252 \fi
2253 }
2254 %
2255 % #] DashCurve :
2256 % #[ LinAxis :
2257 %
2258 \def\LinAxis(#1,#2)(#3,#4)(#5,#6,#7,#8,#9){%
2259 %
2260 % Draws a line with linear hash marks along it.
2261 % LinAxis(x1,y1)(x2,y2)(num_decs,per_dec,hashsize,offset,width)
2262 % The line is from (x1,y1) to (x2,y2) and the marks are on the left side
2263 % when hashsize is positive, and right when it is negative.
2264 % num_decs is the number of accented marks, per_dec the number of
2265 % divisions between them and offset is the number
2266 % at which one starts at (x1,y1) (like if offset=2 we start at the second
2267 % small mark) Width is the linewidth.
2268 %
2269 \ifcase\axo@pdfoutput
2270 \put(\axoxoff,\axoyoff){\AXOspecial{%
2271 #1 \axoxo\space add #2 \axoyo\space add
2272 #3 \axoxo\space add #4 \axoyo\space add
2273 #5 #6 #7 #8 #9 \axoscale\space linaxis }}
2274 \else
2275 \getaxohelp{LinAxis}{#1 #2 #3 #4 #5 #6 #7 #8 #9}
2276 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2277 \fi
2278 }
2279 %
2280 % #] LinAxis :
2281 % #[ LogAxis :
2282 %
2283 \def\LogAxis(#1,#2)(#3,#4)(#5,#6,#7,#8){%
2284 %
2285 % Draws a line with logarithmic hash marks along it.
2286 % LogAxis(x1,y1)(x2,y2)(num_logs,hashsize,offset,width)
2287 % The line is from (x1,y1) to (x2,y2) and the marks are on the left side
2288 % when hashsize is positive, and right when it is negative.
2289 % num_logs is the number of orders of magnitude and offset is the number
2290 % at which one starts at (x1,y1) (like if offset=2 we start at 2)
2291 % When offset is 0 we start at 1. Width is the linewidth.
2292 %
2293 \ifcase\axo@pdfoutput
2294 \put(\axoxoff,\axoyoff){\AXOspecial{%
2295 #1 \axoxo\space add #2 \axoyo\space add
2296 #3 \axoxo\space add #4 \axoyo\space add
2297 #5 #6 #7 #8 \axoscale\space logaxis }}
2298 \else
2299 \getaxohelp{LogAxis}{#1 #2 #3 #4 #5 #6 #7 #8}
2300 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2301 \fi
2302 }
2303 %
2304 % #] LogAxis :
2305 % #[ AxoGrid :
2306 %
2307 \def\AxoGrid(#1,#2)(#3,#4)(#5,#6)#7#8{%
2308 %
2309 % Makes a grid with the left bottom at #1,#2
2310 % The increments in x and y are #3,#4
2311 % The number of steps in each direction are #5,#6 (there are n+1 lines)
2312 % #7 is the color and #8 the linewidth
2313 %
2314 {\SetColor{#7}%
2315 \ifcase\axo@pdfoutput
2316 \put(\axoxoff,\axoyoff){%
2317 \AXOspecial{%
2318 #3 #4 #5 #6
2319 #1 \axoxo\space add #2 \axoyo\space add
2320 #8 \axoscale\space axogrid
2321 }}%
2322 \else
2323 \getaxohelp{Grid}{#1 #2 #3 #4 #5 #6 #8}%
2324 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2325 \fi
2326 }%
2327 \ignorespaces
2328 }
2329 %
2330 % #] AxoGrid :
2331 % #[ AXO@Arc :
2332 %
2333 % Generic Arc segment with many options.
2334 %
2335 %
2336 \def\AXO@Arc(#1,#2)(#3,#4,#5){%
2337 %
2338 % Draws arc centered at (#1,#2), radius #3, starting and ending
2339 % angles #4, #5.
2340 % Double, dashing, arrow, clockwise according to current settings
2341 %
2342 {\AXO@useopts
2343 \ifcase\axo@pdfoutput
2344 \put(\axoxoff,\axoyoff){%
2345 \AXOspecial{%
2346 \AXO@ArrowArg \space
2347 \ifAXO@flip true \else false \fi
2348 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2349 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2350 \ifAXO@clock true \else false \fi
2351 #3 #4 #5
2352 #1 \axoxo\space add #2 \axoyo\space add
2353 \AXO@CurrentWidth\space \axoscale\space arc2
2354 }}%
2355 \else
2356 \getaxohelp{AxoArc}{#1 #2 #3 #4 #5
2357 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2358 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2359 \AXO@ArrowArg \space
2360 \ifAXO@flip 1 \else 0 \fi
2361 \ifAXO@clock 1 \else 0 \fi
2362 \AXO@CurrentWidth}
2363 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2364 \fi
2365 }\ignorespaces
2366 }
2367 %
2368 % #] AXO@Arc :
2369 % #[ AXO@Bezier :
2370 %
2371 \def\AXO@Bezier(#1,#2)(#3,#4)(#5,#6)(#7,#8){%
2372 %
2373 % Draws a Bezier cubic with the control points (x1,y1), (x2,y2),
2374 % (x3,y3), (x4,y4)
2375 % Assumes options have been set
2376 %
2377 {\AXO@useopts
2378 \ifcase\axo@pdfoutput
2379 \put(\axoxoff,\axoyoff){\AXOspecial{%
2380 #1 \axoxo\space add #2 \axoyo\space add
2381 #3 \axoxo\space add #4 \axoyo\space add
2382 #5 \axoxo\space add #6 \axoyo\space add
2383 #7 \axoxo\space add #8 \axoyo\space add
2384 \AXO@ArrowArg \space
2385 \ifAXO@flip true \else false \fi
2386 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2387 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2388 \AXO@CurrentWidth\space \axoscale\space dashdoublebezier
2389 }}%
2390 \else
2391 \getaxohelp{AxoBezier}{#1 #2 #3 #4 #5 #6 #7 #8
2392 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2393 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2394 \AXO@ArrowArg \space
2395 \ifAXO@flip 1 \else 0 \fi
2396 \AXO@CurrentWidth}
2397 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2398 \fi
2399 }\ignorespaces
2400 }
2401 %
2402 % #] AXO@Bezier :
2403 % #[ AXO@GluonHelper :
2404 %
2405 \def\AXO@GluonHelper(#1,#2)(#3,#4)#5#6#7#8{%
2406 %
2407 % Draws a single gluon from (x1,y1) to (x2,y2) with amplitude #5 and number
2408 % of windings #6. Width #7 + #8
2409 % Assumes options have been set.
2410 % Used as helper from \AXO@Gluon
2411 %
2412 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon}\fi
2413 \ifcase\axo@pdfoutput
2414 \put(\axoxoff,\axoyoff){%
2415 \AXOspecial{%
2416 #1 \axoxo\space add #2 \axoyo\space add
2417 #3 \axoxo\space add #4 \axoyo\space add
2418 #5 #6
2419 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2420 #7 #8 add \axoscale \space dashgluon
2421 }%
2422 }%
2423 \else
2424 \getaxohelp{AxoGluon}{#1 #2 #3 #4 #5 #6
2425 #7
2426 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2427 #8}%
2428 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2429 \fi
2430 }
2431 %
2432 \def\AXO@GluonHelperNEW(#1,#2)(#3,#4)#5#6#7#8{%
2433 % IDEA: Showing cleaner code
2434 %
2435 % Draws a single gluon from (x1,y1) to (x2,y2) with amplitude #5 and number
2436 % of windings #6. Width #7 + #8
2437 % Assumes options have been set.
2438 % Used as helper from \AXO@Gluon
2439 %
2440 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon}\fi
2441 \ifcase\axo@pdfoutput
2442 \AXOputPS{%
2443 #1 #2 #3 #4 #5 #6
2444 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2445 #7 #8 add \axoscale \space dashgluon
2446 }%
2447 \else
2448 \getaxohelp{AxoGluon}{#1 #2 #3 #4 #5 #6
2449 #7
2450 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2451 #8}%
2452 \AXOputPDF{\contentspdfNoOffset}%
2453 \fi
2454 }
2455 %
2456 % #] AXO@GluonHelper :
2457 % #[ AXO@Gluon :
2458 %
2459 \def\AXO@Gluon(#1,#2)(#3,#4)#5#6{%
2460 %
2461 % Draws a gluon from (x1,y1) to (x2,y2) with amplitude #5 and number
2462 % of windings #6.
2463 % Assumes options have been set
2464 %
2465 {\AXO@useopts
2466 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon}\fi
2467 \AXO@arrowfalse % To avoid repeated errors
2468 \ifAXO@double
2469 \AXO@GluonHelper(#1,#2)(#3,#4){#5}{#6}{\AXO@CurrentWidth}{\AXO@CurrentSep}%
2470 \SetColor{White}%
2471 \AXO@dashfalse
2472 \AXO@GluonHelper(#1,#2)(#3,#4){#5}{#6}{-\AXO@CurrentWidth}{\AXO@CurrentSep}%
2473 \else
2474 \AXO@GluonHelper(#1,#2)(#3,#4){#5}{#6}{0}{\AXO@CurrentWidth}%
2475 \fi
2476 }%
2477 \ignorespaces
2478 }
2479 % #] AXO@Gluon :
2480 % #[ AXO@GluonArcHelper :
2481 %
2482 \def\AXO@GluonArcHelper(#1,#2)(#3,#4,#5)#6#7#8#9{%
2483 %
2484 % Draws a gluon on an arc segment. The center of the curve is at (1,2)
2485 % The radius, start angle and target angle are (#3,#4,#5), #6 is the
2486 % amplitude of the gluon, and #7 is the number of windings.
2487 % Assumes options have been set
2488 % Width #8 + #9
2489 % Assumes options have been set.
2490 % Used as helper from \AXO@GluonArc
2491 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon arc}\fi
2492 \ifcase\axo@pdfoutput
2493 \put(\axoxoff,\axoyoff){\AXOspecial{#6 #7
2494 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2495 \ifAXO@clock true \else false \fi
2496 #3 #4 #5
2497 #1 \axoxo\space add #2 \axoyo\space add
2498 #8 #9 add \axoscale\space dashgluearc
2499 }}%
2500 \else
2501 \getaxohelp{AxoGluonArc}{#1 #2 #3 #4 #5 #6 #7
2502 #8
2503 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2504 \ifAXO@clock 1 \else 0 \fi
2505 #9}
2506 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2507 \fi
2508 }
2509 % #] AXO@GluonArcHelper :
2510 % #[ AXO@GluonArc :
2511 %
2512 \def\AXO@GluonArc(#1,#2)(#3,#4,#5)#6#7{%
2513 %
2514 % Draws a gluon on an arc segment. The center of the curve is at (1,2)
2515 % The radius, start angle and target angle are (#3,#4,#5), #6 is the
2516 % amplitude of the gluon, and #7 is the number of windings.
2517 % Assumes options have been set
2518 %
2519 {\AXO@useopts
2520 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon}\fi
2521 \AXO@arrowfalse % To avoid repeated errors
2522 \ifAXO@double
2523 \AXO@GluonArcHelper(#1,#2)(#3,#4,#5){#6}{#7}{\AXO@CurrentWidth}{\AXO@CurrentSep}%
2524 \SetColor{White}%
2525 \AXO@dashfalse
2526 \AXO@GluonArcHelper(#1,#2)(#3,#4,#5){#6}{#7}{-\AXO@CurrentWidth}{\AXO@CurrentSep}%
2527 \else
2528 \AXO@GluonArcHelper(#1,#2)(#3,#4,#5){#6}{#7}{0}{\AXO@CurrentWidth}%
2529 \fi
2530 }%
2531 \ignorespaces
2532 }
2533 % #] AXO@GluonArc :
2534 % #[ AXO@GluonCircHelper :
2535 %
2536 \def\AXO@GluonCircHelper(#1,#2)(#3,#4)#5#6#7#8{%
2537 %
2538 % Draws a gluon on a circle. The center of the circle is at (1,2)
2539 % The radius and the phase angle are (#3,#4), 5 is the
2540 % amplitude of the gluon, and 6 is the number of windings.
2541 % Width #7 + #8
2542 % Assumes options have been set.
2543 % Used as helper from \AXO@GluonCirc
2544 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon arc}\fi
2545 \ifcase\axo@pdfoutput
2546 \put(\axoxoff,\axoyoff){\AXOspecial{%
2547 #5 #6
2548 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2549 #3 #4
2550 #1 \axoxo\space add #2 \axoyo\space add
2551 #7 #8 add \axoscale\space dashgluoncirc
2552 }}%
2553 \else
2554 \getaxohelp{AxoGluonCirc}{#1 #2 #3 #4 #5 #6
2555 #7
2556 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2557 #8}
2558 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2559 \fi
2560 }
2561 % #] AXO@GluonCicHelper :
2562 % #[ AXO@GluonCirc :
2563 %
2564 \def\AXO@GluonCirc(#1,#2)(#3,#4)#5#6{%
2565 %
2566 % Draws a gluon on a circle. The center of the circle is at (1,2)
2567 % The radius and the phase angle are (#3,#4), 5 is the
2568 % amplitude of the gluon, and 6 is the number of windings.
2569 %
2570 {\AXO@useopts
2571 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for gluon}\fi
2572 \AXO@arrowfalse % To avoid repeated errors
2573 \ifAXO@double
2574 \AXO@GluonCircHelper(#1,#2)(#3,#4){#5}{#6}{\AXO@CurrentWidth}{\AXO@CurrentSep}%
2575 \SetColor{White}%
2576 \AXO@dashfalse
2577 \AXO@GluonCircHelper(#1,#2)(#3,#4){#5}{#6}{-\AXO@CurrentWidth}{\AXO@CurrentSep}%
2578 \else
2579 \AXO@GluonCircHelper(#1,#2)(#3,#4){#5}{#6}{0}{\AXO@CurrentWidth}%
2580 \fi
2581 }%
2582 \ignorespaces
2583 }
2584 %
2585 % #] AXO@GluonCirc :
2586 % #[ AXO@Line :
2587 %
2588 \def\AXO@Line(#1,#2)(#3,#4){%
2589 %
2590 % Draws a line from (x1,y1) to (x2,y2)
2591 % Double, dashing, arrow according to current settings
2592 %
2593 {\AXO@useopts
2594 \ifcase\axo@pdfoutput
2595 \put(\axoxoff,\axoyoff){%
2596 \AXOspecial{%
2597 \AXO@ArrowArg \space
2598 \ifAXO@flip true \else false \fi
2599 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2600 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2601 #1 \axoxo\space add #2 \axoyo\space add
2602 #3 \axoxo\space add #4 \axoyo\space add
2603 \AXO@CurrentWidth \space \axoscale \space
2604 dasharrowdoubleline
2605 }}%
2606 \else
2607 \getaxohelp{AxoLine}{#1 #2 #3 #4
2608 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2609 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2610 \AXO@ArrowArg \space
2611 \ifAXO@flip 1 \else 0 \fi
2612 \AXO@CurrentWidth}
2613 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2614 \fi
2615 }\ignorespaces
2616 }
2617 %
2618 % #] AXO@Line :
2619 % #[ AXO@Photon :
2620 %
2621 \def\AXO@Photon(#1,#2)(#3,#4)#5#6{%
2622 %
2623 % Draws a photon from (x1,y1) to (x2,y2) with amplitude #5 and number
2624 % of windings #6.
2625 % Assumes options have been set
2626 %
2627 {\AXO@useopts
2628 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for photon}\fi
2629 \ifcase\axo@pdfoutput
2630 \put(\axoxoff,\axoyoff){\AXOspecial{%
2631 #1 \axoxo\space add #2 \axoyo\space add
2632 #3 \axoxo\space add #4 \axoyo\space add #5 #6
2633 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2634 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2635 \AXO@CurrentWidth\space \axoscale\space dashdoublephoton }}%
2636 \else
2637 \getaxohelp{AxoPhoton}{#1 #2 #3 #4 #5 #6
2638 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2639 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2640 \AXO@CurrentWidth}
2641 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2642 \fi
2643 }\ignorespaces
2644 }
2645 % #] AXO@Photon :
2646 % #[ AXO@PhotonArc :
2647 %
2648 \def\AXO@PhotonArc(#1,#2)(#3,#4,#5)#6#7{%
2649 %
2650 % Draws a photon on an arc segment. The center of the curve is at (1,2)
2651 % The radius, start angle and target angle are (#3,#4,#5), #6 is the
2652 % amplitude of the gluon, and #7 is the number of wiggles.
2653 % Assumes options have been set
2654 %
2655 {\AXO@useopts
2656 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for photon arc}\fi
2657 \ifcase\axo@pdfoutput
2658 \put(\axoxoff,\axoyoff){\AXOspecial{%
2659 #6 #7
2660 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2661 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2662 \ifAXO@clock true \else false \fi
2663 #3 #4 #5
2664 #1 \axoxo\space add #2 \axoyo\space add
2665 \AXO@CurrentWidth\space \axoscale\space dashdoublephotonarc
2666 }}%
2667 \else
2668 \getaxohelp{AxoPhotonArc}{#1 #2 #3 #4 #5 #6 #7
2669 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2670 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2671 \ifAXO@clock 1 \else 0 \fi
2672 \AXO@CurrentWidth}
2673 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2674 \fi
2675 }\ignorespaces
2676 }
2677 %
2678 % #] AXO@PhotonArc :
2679 % #[ AXO@ZigZag :
2680 %
2681 \def\AXO@ZigZag(#1,#2)(#3,#4)#5#6{%
2682 %
2683 % Draws a zigzag from (x1,y1) to (x2,y2) with amplitude #5 and number
2684 % of windings #6.
2685 % Assumes options have been set
2686 %
2687 {\AXO@useopts
2688 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for zigzag}\fi
2689 \ifcase\axo@pdfoutput
2690 \put(\axoxoff,\axoyoff){\AXOspecial{%
2691 #1 \axoxo\space add #2 \axoyo\space add
2692 #3 \axoxo\space add #4 \axoyo\space add #5 #6
2693 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2694 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2695 \AXO@CurrentWidth\space \axoscale\space dashdoublezigzag }}%
2696 \else
2697 \getaxohelp{AxoZigZag}{#1 #2 #3 #4 #5 #6
2698 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2699 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2700 \AXO@CurrentWidth}
2701 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}%
2702 \fi
2703 }\ignorespaces
2704 }
2705 % #] AXO@ZigZag :
2706 % #[ AXO@ZigZagArc :
2707 %
2708 \def\AXO@ZigZagArc(#1,#2)(#3,#4,#5)#6#7{%
2709 %
2710 % Draws a zigzag on an arc segment. The center of the curve is at (1,2)
2711 % The radius, start angle and target angle are (#3,#4,#5), #6 is the
2712 % amplitude of the gluon, and #7 is the number of wiggles.
2713 % Assumes options have been set
2714 %
2715 {\AXO@useopts
2716 \ifAXO@arrow\AXO@NOTIMPLEMENTED{arrow not implemented for zigzag arc}\fi
2717 \ifcase\axo@pdfoutput
2718 \put(\axoxoff,\axoyoff){\AXOspecial{%
2719 #6 #7
2720 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2721 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2722 \ifAXO@clock true \else false \fi
2723 #3 #4 #5
2724 #1 \axoxo\space add #2 \axoyo\space add
2725 \AXO@CurrentWidth\space \axoscale\space dashdoublezigzagarc
2726 }}%
2727 \else
2728 \getaxohelp{AxoZigZagArc}{#1 #2 #3 #4 #5 #6 #7
2729 \ifAXO@double \AXO@CurrentSep \space \else 0 \fi
2730 \ifAXO@dash \AXO@CurrentDashSize \space \else 0 \fi
2731 \ifAXO@clock 1 \else 0 \fi
2732 \AXO@CurrentWidth}
2733 \put(\axoxoff,\axoyoff){\axo@pdfliteral{\contentspdf}}
2734 \fi
2735 }\ignorespaces
2736 }
2737 %
2738 % #] AXO@ZigZagArc :
2739 % #[ Text and boxes :
2740 % #[ SetPFont :
2741 %
2742 % To access fonts, from both latex and pdflatex, we need
2743 % to define a mapping from the human-readable name to
2744 % the name known to (pdf)latex. Then we can define a
2745 % user command for setting the font. The human-readable
2746 % name is the one used by postscript.
2747 % Variables used:
2748 % \pfontN = human name of current PS font (e.g., Helvetica).
2749 % \pfontC = TeX code for the font (e.g., phvr).
2750 % Both are \relax to use regular document font
2751 % \axofontsize = size of font (text command with unit)
2752
2753
2754 \def\defineaxofont#1#2{%
2755 % #1 is user visible name of font, #2 is LaTex name.
2756 % Define a command of name #1 to return #2
2757 \expandafter\def\csname #1\endcsname{#2}
2758 }
2759
2760 \def\SetPFont#1#2{%
2761 \ifthenelse{ \equal{#1}{} }%
2762 {\let\pfontN=\relax \let\pfontC=\relax}%
2763 {\@ifundefined{#1}%
2764 {\PackageWarning{axodraw2}{trying to set undefined font `#1'}}%
2765 {\def\pfontN{#1}% Human name (postscript)
2766 \def\pfontC{\@nameuse{#1}}% Code name
2767 }%
2768 }%
2769 \ifthenelse{ \equal{#2}{} }%
2770 {% Use the value of LaTeX's fontsize when the font is used:
2771 \def\axofontsize{\f@size}%
2772 }%
2773 {\def\axofontsize{#2}}%
2774 \ignorespaces
2775 }
2776
2777 \def\UseCurrentPSFont{%
2778 % Set regular size of regular font, so math has rational size
2779 \fontsize{\axofontsize}{\axofontsize}%
2780 \selectfont
2781 \ifx\pfontC\relax
2782 \else
2783 \font\axofont = \pfontC \space at \axofontsize pt
2784 \axofont
2785 \fi
2786 }
2787
2788 \defineaxofont{AvantGarde-Book}{pagk}
2789 \defineaxofont{AvantGarde-BookOblique}{pagko}
2790 \defineaxofont{AvantGarde-Demi}{pagd}
2791 \defineaxofont{AvantGarde-DemiOblique}{pagdo}
2792 \defineaxofont{Bookman-Demi}{pbkd}
2793 \defineaxofont{Bookman-DemiItalic}{pbkdi}
2794 \defineaxofont{Bookman-Light}{pbkl}
2795 \defineaxofont{Bookman-LightItalic}{pbkli}
2796 \defineaxofont{Courier-Bold}{pcrb}
2797 \defineaxofont{Courier-BoldOblique}{pcrbo}
2798 \defineaxofont{Courier}{pcrr}
2799 \defineaxofont{Courier-Oblique}{pcrro}
2800 \defineaxofont{Helvetica-Bold}{phvb}
2801 \defineaxofont{Helvetica-BoldOblique}{phvbo}
2802 \defineaxofont{Helvetica-NarrowBold}{phvbrn}
2803 \defineaxofont{Helvetica-NarrowBoldOblique}{phvbon}
2804 \defineaxofont{Helvetica}{phvr}
2805 \defineaxofont{Helvetica-Oblique}{phvro}
2806 \defineaxofont{Helvetica-Narrow}{phvrrn}
2807 \defineaxofont{Helvetica-NarrowOblique}{phvron}
2808 \defineaxofont{NewCenturySchlbk-Bold}{pncb}
2809 \defineaxofont{NewCenturySchlbk-BoldItalic}{pncbi}
2810 \defineaxofont{NewCenturySchlbk-Italic}{pncri}
2811 \defineaxofont{NewCenturySchlbk-Roman}{pncr}
2812 \defineaxofont{Palatino-Bold}{pplb}
2813 \defineaxofont{Palatino-BoldItalic}{pplbi}
2814 \defineaxofont{Palatino-Italic}{pplri}
2815 \defineaxofont{Palatino-Roman}{pplr}
2816 \defineaxofont{Symbol}{psyr}
2817 \defineaxofont{Times-Bold}{ptmb}
2818 \defineaxofont{Times-BoldItalic}{ptmbi}
2819 \defineaxofont{Times-Italic}{ptmri}
2820 \defineaxofont{Times-Roman}{ptmr}
2821 \defineaxofont{ZapfChancery-MediumItalic}{pzcmi}
2822 \defineaxofont{ZapfDingbats}{pzdr}
2823
2824 % Now we can set the default:
2825
2826 \SetPFont{Times-Roman}{10}
2827
2828 %
2829 % #] SetPFont :
2830 % #[ Text :
2831 %
2832 % Aim: \Text(#1,#2)(#3)[#4]#5, to set text #5 at position (#1,#2)
2833 % with angle #3 and positioning #4.
2834 % But the presence of (#3) and [#3] is to be optional (with
2835 % defaults being equivalent to (0) and []
2836 %
2837 \def\Text(#1,#2){%
2838 \@ifnextchar(% )
2839 {\Text@A(#1,#2)}%
2840 {\Text@A(#1,#2)(0)}%
2841 }
2842 %
2843 \def\Text@A(#1,#2)(#3){%
2844 \@ifnextchar[% ]
2845 {\Text@Z(#1,#2)(#3)}%
2846 {\Text@Z(#1,#2)(#3)[]}%
2847 }
2848 %
2849 \def\axoscaleTT{\ifPSTextScalesLikeGraphics 1\else \axotextscale \fi}
2850 \def\axoscalePT{\ifPSTextScalesLikeGraphics \axoscale\else \axotextscale \fi}
2851 %
2852 \def\Text@Z(#1,#2)(#3)[#4]#5{%
2853 %
2854 % Draws text at (#1,#2). Argument #3 is combination of l, r, t, b to
2855 % indicate positioning instead of default (which is horizontally and
2856 % vertically centered --- these are same as \makebox
2857 % the text is left adjusted, right adjusted or centered. Or b or t.
2858 % 4 is of course the text.
2859 %
2860 \AxoPut(#1,#2){%
2861 \scalebox{\axoscaleTT}%
2862 {\rotatebox{#3}{\makebox(0,0)[#4]{#5}}}%
2863 }%
2864 \ignorespaces
2865 }
2866 %
2867 % #] Text :
2868 % #[ PText : *+
2869 %
2870 \def\PText(#1,#2)(#3)[#4]#5{%
2871 %
2872 % Draws a postscript text in a postscript font.
2873 % Focal point is (1,2), rotation angle is 3, 4 is the mode (as in text)
2874 % and 5 is the text.
2875 %
2876 \begingroup
2877 \UseCurrentPSFont
2878 \AxoPut(#1,#2){%
2879 \scalebox{\axoscalePT}%
2880 {\rotatebox{#3}{\makebox(0,0)[#4]{#5}}}%
2881 }%
2882 \endgroup
2883 \ignorespaces
2884 }
2885 %
2886 % #] PText :
2887 % #[ RText :
2888 %
2889 \def\RText(#1,#2)[#3](#4)#5{%
2890 %
2891 % Draws rotated text at (1,2). Argument 3 is l,r or c indicating whether
2892 % the text is left adjusted, right adjusted or centered.
2893 % 4 is the rotation angle and 5 is of course the text.
2894 %
2895 \Text(#1,#2)(#4)[#3]{#5}%
2896 \ignorespaces
2897 }
2898 %
2899 % #] RText :
2900 % #[ rText : *
2901 %
2902 \def\rText(#1,#2)[#3][#4]#5{%
2903 %
2904 % Draws rotated text at (1,2). Argument 3 is l,r or c indicating whether
2905 % the text is left adjusted, right adjusted or centered.
2906 % 4 is the rotation angle (specified as l, r, u, or blank,
2907 % and 5 is of course the text.
2908 %
2909 \begingroup
2910 \def\this@angle{0}%
2911 \ifx#4l%
2912 \def\this@angle{90}%
2913 \else
2914 \ifx#4r%
2915 \def\this@angle{-90}%
2916 \else
2917 \ifx#4u%
2918 \def\this@angle{180}%
2919 \fi
2920 \fi
2921 \fi
2922 \Text(#1,#2)(\this@angle)[#3]{#5}%
2923 \endgroup
2924 \ignorespaces
2925 }
2926 %
2927 % #] rText :
2928 % #[ BText :
2929 %
2930 \def\BText(#1,#2)#3{%
2931 %
2932 % Draws a box with the center at (x1,y1) and postscript text #3 in it.
2933 %
2934 \AxoPut(#1,#2){%
2935 \edef\axoscale{\axoscalePT}%
2936 \SetTmpBox{#3}%
2937 \BBoxc(0,0)(\tmpXT,\tmpYT)%
2938 \PText(0,0)(0)[]{\usebox{\tmpBox}}%
2939 }%
2940 \ignorespaces
2941 }
2942 %
2943 % #] BText :
2944 % #[ GText :
2945 %
2946 \def\GText(#1,#2)#3#4{%
2947 %
2948 % Draws a box with the center at (x1,y1) and postscript(#4) text in it.
2949 % The grayness of the box is given by #3
2950 %
2951 \AxoPut(#1,#2){%
2952 \edef\axoscale{\axoscalePT}%
2953 \SetTmpBox{#4}%
2954 \GBoxc(0,0)(\tmpXT,\tmpYT){#3}%
2955 \PText(0,0)(0)[]{\usebox{\tmpBox}}%
2956 }%
2957 \ignorespaces
2958 }
2959 %
2960 % #] GText :
2961 % #[ CText :
2962 %
2963 \def\CText(#1,#2)#3#4#5{%
2964 %
2965 % Draws a box with the center at (x1,y1) and postscript(#5) text in it.
2966 % The color of box and text is in #3
2967 % The color of the background is in #4
2968 %
2969 \AxoPut(#1,#2){%
2970 \edef\axoscale{\axoscalePT}%
2971 \SetTmpBox{\SetColor{#3}{#5}}%
2972 \CBoxc(0,0)(\tmpXT,\tmpYT){#3}{#4}%
2973 \PText(0,0)(0)[]{\usebox{\tmpBox}}%
2974 }%
2975 }
2976 %
2977 % #] CText :
2978 % #[ BTwoText :
2979 %
2980 \def\BTwoText(#1,#2)#3#4{%
2981 %
2982 % Draws a box with the center at (x1,y1) and two lines of postscript
2983 % text in it.
2984 %
2985 \AxoPut(#1,#2){%
2986 \edef\axoscale{\axoscalePT}%
2987 \SetTmpBoxTwo{#3}{#4}%
2988 \BBoxc(0,0)(\tmpXT,\tmpYT)%
2989 \PText(0,0)(0)[]{\usebox{\tmpBox}}%
2990 }%
2991 \ignorespaces
2992 }
2993 %
2994 % #] BTwoText :
2995 % #[ GTwoText :
2996 %
2997 \def\GTwoText(#1,#2)#3#4#5{%
2998 %
2999 % Draws a box with the center at (x1,y1) and two lines of postscript
3000 % text (#4 and #5) in it.
3001 % The grayness of the box is given by #3
3002 %
3003 \AxoPut(#1,#2){%
3004 \edef\axoscale{\axoscalePT}%
3005 \SetTmpBoxTwo{#4}{#5}%
3006 \GBoxc(0,0)(\tmpXT,\tmpYT){#3}%
3007 \PText(0,0)(0)[]{\usebox{\tmpBox}}%
3008 }%
3009 \ignorespaces
3010 }
3011 %
3012 % #] GTwoText :
3013 % #[ CTwoText :
3014 %
3015 \def\CTwoText(#1,#2)#3#4#5#6{%
3016 %
3017 % Draws a box with the center at (x1,y1) and two lines of postscript
3018 % text (#5 and #6) in it.
3019 % The color of the box and the text is given by #3
3020 % The background color is given by #4
3021 %
3022 \AxoPut(#1,#2){%
3023 \edef\axoscale{\axoscalePT}%
3024 \SetTmpBoxTwo{\SetColor{#3}#5}{\SetColor{#3}#6}%
3025 \CBoxc(0,0)(\tmpXT,\tmpYT){#3}{#4}%
3026 \PText(0,0)(0)[]{\usebox{\tmpBox}}%
3027 }%
3028 \ignorespaces
3029 }
3030 %
3031 % #] CTwoText :
3032 % #] Text and boxes :
3033 % #] Mixed routines :
3034 % #[ Postscript specific :
3035 %
3036 % The code here is used only when we need Postscript output. This concerns
3037 % mainly the Postscript library.
3038 %
3039 \ifcase\axo@pdfoutput
3040 %
3041 % #[ PostScript preamble :
3042 %
3043 \AtBeginDvi{
3044 %
3045 % This forces the PostScript preamble commands to be put into the
3046 % dvi file. Without this, revtex4 can remove them by funny
3047 % stuff with manipulating the first page.
3048 %
3049 % #[ inventory :
3050 %
3051 % The variables in here are:
3052 % num,num1,ampi,ampi1,x1,y1,x2,y2,x3,y3,x4,y4,dx,dy,dr
3053 % width, arrowpos, arrowspec, arrowwidth, arrowlength, arrowinset
3054 % arcend, arcmid, arcstart, radius, linesep, angdsize, dsize,
3055 % clockwise, dotsize, inc, pi, sign
3056 % darc,const,amp1, amp2, amp3, amp4, amp5, amp6, amp7, amp8, amp1i
3057 % gcolor,xx2
3058 %
3059 % NOTE: blank lines are not allowed inside the postscript code!!!!!
3060 % (LaTeX sneaks \par commands in and the postscript goes boink)
3061 %
3062 \special{color} % Provoke dvips into including color.pro
3063 % Revtex4 in 2-column mode fails to force that
3064 %
3065 \special{!
3066 /savecolor { %/cmyk [ currentcmykcolor ] def
3067 /oldcolor [ [ currentcolor ] currentcolorspace ] def
3068 } def
3069 /restorecolor { oldcolor aload pop setcolorspace aload pop setcolor } def
3070 % /savecolor { [ currentcmykcolor ] /cmyk ed } def
3071 % /restorecolor { cmyk aload pop setcmykcolor } def
3072 % % Do a save color now, to ensure default variables are defined:
3073 savecolor
3074 }
3075 %
3076 \special{!
3077 /pi 3.141592 def
3078 /ed{exch def}def
3079 % Implement conversion of length unit from pt to bp by scaling
3080 /gs{gsave 1.00375 div dup scale}def
3081 /gsw{ gs
3082 /width ed
3083 width setlinewidth
3084 }def
3085 /p1{/y1 ed /x1 ed}def
3086 /p2{/y2 ed /x2 ed}def
3087 /p3{/y3 ed /x3 ed}def
3088 /p4{/y4 ed /x4 ed}def
3089 /pp1{/yy1 ed /xx1 ed}def
3090 /pp2{/yy2 ed /xx2 ed}def
3091 /pp3{/yy3 ed /xx3 ed}def
3092 /setabs{
3093 % Usage /var setabs
3094 % Sets variable to its absolute value
3095 dup load abs def
3096 }def
3097 %
3098 /normalizearc {
3099 % Usage: clockwise r angle1 angle2 x y normalizearc
3100 % Adjusts coordinate system for anticlockwize arc from angle
3101 % zero, centered at origin.
3102 % Left on stack: r d_angle, with 0<d_angle <=360.
3103 % Zero angle arc converted to loop
3104 translate
3105 exch dup rotate % Origin of arc now at angle 0
3106 sub % Change angle2 to dangle
3107 3 2 roll
3108 { % Clockwise arc: obtain from anticlockwise arc
3109 neg
3110 1 -1 scale
3111 } if
3112 dup abs 360 ge
3113 { %Outside 360 degrees, make exactly a loop
3114 pop 360
3115 }
3116 { % Convert to positive angle mod 360.
3117 dup
3118 dup 0 lt { 360 sub } if
3119 360 div truncate 360 mul sub
3120 dup 0.1 lt { pop 360 } if
3121 }ifelse
3122 } def
3123 %
3124 /normalizeline {
3125 % Usage: x1 y1 x2 y2 normalizeline
3126 % Adjusts coordinate system for line from origin in x direction
3127 % Left on stack: dr = length of line
3128 3 index 3 index translate
3129 2 index sub exch 3 index sub
3130 % 2 copy atan rotate
3131 2 copy
3132 2 copy 0 ne exch 0 ne or
3133 {atan rotate}
3134 {pop pop}
3135 ifelse
3136 dup mul exch dup mul add sqrt
3137 3 1 roll pop pop
3138 } def
3139 %
3140 /abox{
3141 newpath
3142 x1 y1 moveto
3143 x1 y2 lineto
3144 x2 y2 lineto
3145 x2 y1 lineto
3146 closepath
3147 }def
3148 /atriangle{
3149 newpath
3150 x1 y1 moveto
3151 x2 y2 lineto
3152 x3 y3 lineto
3153 closepath
3154 }def
3155 /abezier{
3156 newpath
3157 x1 y1 moveto
3158 x2 y2 x3 y3 x4 y4 curveto
3159 }def
3160 /distance{
3161 % Usage: x1 y1 x2 y2 distance -> x1 y1 x2 y2 r
3162 % Pure stack based: computes distance between points. Keeps points
3163 dup
3164 3 index sub dup mul
3165 2 index 5 index sub dup mul add sqrt
3166 } def
3167 /setbackgroundcolor{
3168 0 0 0 0 setcmykcolor
3169 } def
3170 }
3171 %
3172 % #] inventory :
3173 % #[ Arrows :
3174 %
3175 % Define better arrows
3176 %
3177 \special{!
3178 % Arrow making routines
3179 %
3180 /getarrow {
3181 /witharrow ed
3182 /arrowpos ed
3183 /arrowaspect ed
3184 /arrowscale ed
3185 /arrowinset ed
3186 /arrowlength ed
3187 /arrowwidth ed
3188 /arrowstroke ed
3189 } def
3190 /drawarrow {
3191 gsave
3192 [] 0 setdash
3193 rotate
3194 arrowwidth 0 eq {
3195 arrowlength 0 eq {
3196 linewidth linesep 0.7 mul add 1 add 1.2 mul dup
3197 2.5 lt {
3198 pop
3199 2.5
3200 } if
3201 arrowscale mul
3202 /arrowwidth ed
3203 /arrowlength arrowwidth 2 mul arrowaspect mul def
3204 } {
3205 /arrowlength arrowlength arrowscale mul def
3206 /arrowwidth arrowlength 2 div arrowaspect div def
3207 } ifelse
3208 } {
3209 arrowlength 0 eq {
3210 /arrowwidth arrowwidth arrowscale mul def
3211 /arrowlength arrowwidth 2 mul arrowaspect mul def
3212 } {
3213 /arrowwidth arrowwidth arrowscale mul def
3214 /arrowlength arrowlength arrowscale mul def
3215 } ifelse
3216 } ifelse
3217 arrowstroke 0 ne {
3218 arrowstroke setlinewidth
3219 gsave
3220 setbackgroundcolor
3221 newpath
3222 0 arrowlength -0.5 mul moveto
3223 arrowwidth arrowlength rlineto
3224 arrowwidth -1 mul arrowlength arrowinset mul -1 mul rlineto
3225 arrowwidth -1 mul arrowlength arrowinset mul rlineto
3226 closepath fill
3227 grestore
3228 newpath
3229 0 arrowlength -0.5 mul moveto
3230 arrowwidth arrowlength rlineto
3231 arrowwidth -1 mul arrowlength arrowinset mul -1 mul rlineto
3232 arrowwidth -1 mul arrowlength arrowinset mul rlineto
3233 closepath stroke
3234 } {
3235 newpath
3236 0 arrowlength -0.5 mul moveto
3237 arrowwidth arrowlength rlineto
3238 arrowwidth -1 mul arrowlength arrowinset mul -1 mul rlineto
3239 arrowwidth -1 mul arrowlength arrowinset mul rlineto
3240 closepath fill
3241 } ifelse
3242 grestore
3243 } def
3244 %
3245 }
3246 %
3247 % #] Arrows :
3248 %
3249 % Basic line drawing
3250 % #[ fixdash :
3251 %
3252 \special{! /fixdash{
3253 % Usage: r dashsize fixdash
3254 % Sets renormalized dashsize, doing
3255 % [rdsize rdsize] 0 setdash
3256 % so that n+1/2 patterns fit in length r
3257 % If dsize is too big or if dsize is zero, use continuous line
3258 % Uses stack, no named variables.
3259 2 copy gt
3260 1 index 0 ne
3261 and
3262 {
3263 2 copy
3264 2 mul div 0.5 sub round
3265 dup 0 le { pop 0 } if
3266 2 mul 1 add exch pop div
3267 dup 2 array astore 0 setdash
3268 }
3269 { pop pop [] 0 setdash }
3270 ifelse
3271 } def }
3272 %
3273 % #] fixdash :
3274 % #[ dashline :
3275 %
3276 \special{! /dashline{
3277 % Draws a straight dashed line: x1,y1,x2,y2
3278 % Assumes dsize already set
3279 % The pattern is ideally [dsize dsize] 0 setdash
3280 % but we want to have (2*n+1)/2 patterns, so dsize must be rounded
3281 % If dsize is too large or zero, use a continuous line
3282 % Pure stack operation.
3283 gsave
3284 distance dsize fixdash % Function distance leaves points on stack
3285 newpath
3286 moveto
3287 lineto
3288 stroke
3289 grestore
3290 } def }
3291 % #] dashline :
3292 % #[ dasharc :
3293 %
3294 \special{! /dasharc{
3295 % Draws an arc segment anticlockwise:
3296 % x_center, y_center, radius, start_angle, end_angle
3297 % Assumes angdsize (radians) set elsewhere
3298 gsave
3299 3 copy sub abs
3300 % Top of stack is copy of radius, start_angle, end_angle
3301 pi mul 180 div mul
3302 % Top of stack is arc length
3303 3 index angdsize mul fixdash
3304 newpath arc stroke
3305 grestore
3306 } def }
3307 %
3308 % #] dasharc :
3309 % #[ dashgluon :
3310 %
3311 \special{! /dashgluon{
3312 %
3313 % Draw gluon, possibly dashed
3314 % We have a 'head' and a 'tail' and in between the 'body'
3315 % The head + tail is 2 windings. The body is num-1 windings.
3316 %
3317 gsw
3318 /dsize ed
3319 /num ed /ampi ed
3320 normalizeline /dr ed
3321 /num num 0.5 sub round def
3322 %
3323 dsize 0 eq {
3324 [] 0 setdash
3325 } {
3326 /amp8 ampi abs 0.9 mul def
3327 /size amp8 neg 0 amp8 neg ampi 2 mul dup dr num 2 mul 2 add div exch
3328 1 lengthofbezier def
3329 %
3330 /ndash size dsize 2 mul div truncate def
3331 ndash 0 eq { /ndash 1 def } if
3332 size 2 dsize ndash mul mul sub abs
3333 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3334 /dsize size 2 ndash mul div def
3335 [ dsize dsize ] dsize 2 div setdash
3336 } ifelse
3337 %
3338 /inc dr num 2 mul 2 add div def % increment per half winding
3339 /amp8 ampi 0.9 mul def
3340 amp8 0 lt {/amp8 amp8 neg def} if
3341 %
3342 /x1 inc 2 mul def
3343 %
3344 newpath
3345 x1 ampi neg moveto
3346 x1 amp8 add dup ampi neg exch ampi inc 1.4 mul ampi curveto
3347 inc 0.5 mul ampi inc 0.1 mul ampi 0.5 mul 0 0 curveto
3348 stroke
3349 newpath
3350 x1 ampi neg moveto
3351 2 1 num {
3352 pop
3353 x1 amp8 sub dup ampi neg exch ampi dup x1 inc add exch curveto
3354 /x1 x1 inc dup add add def
3355 x1 amp8 add dup ampi exch ampi neg dup x1 exch curveto
3356 } for
3357 %
3358 x1 amp8 sub dup ampi neg exch ampi dup x1 inc 0.6 mul add exch curveto
3359 x1 inc 1.5 mul add ampi dr inc 0.1 mul sub ampi 0.5 mul dr 0 curveto
3360 stroke
3361 %
3362 grestore
3363 } def }
3364 %
3365 % #] dashgluon :
3366 % #[ dashdoublephoton :
3367 %
3368 \special{! /dashdoublephoton{
3369 %
3370 % Draws a photon from x1,y1 to x2,y2 with amplitude A and n wiggles
3371 % Possibly double
3372 %
3373 gsw
3374 /dsize ed
3375 /linesep ed
3376 /num ed /ampi ed
3377 normalizeline /dr ed
3378 /num num 2 mul 0.5 sub round def
3379 %
3380 dsize 0 eq {
3381 [] 0 setdash
3382 } {
3383 % Compute the dash size
3384 /xdd dr num div def
3385 /size 4 3 div xdd mul pi div dup neg xdd add
3386 4 3 div ampi mul dup 3 1 roll xdd 0 1 lengthofbezier 2 div def
3387 /ndash size dsize 2 mul div truncate def
3388 ndash 0 eq { /ndash 1 def } if
3389 size 2 dsize ndash mul mul sub abs
3390 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3391 /dsize size 2 ndash mul div def
3392 [ dsize dsize ] dsize 2 div setdash
3393 } ifelse
3394 %
3395 linesep 0 eq
3396 { 0 0 dr 0 ampi num photon1 }
3397 {
3398 % 0 linesep 2 div dup dr exch ampi num photon1
3399 % 0 linesep -2 div dup dr exch ampi num photon1
3400 %
3401 linesep width add setlinewidth 0 0 dr 0 ampi num photon1
3402 [] 0 setdash
3403 0 0 0 0 setcmykcolor
3404 linesep width sub setlinewidth 0 0 dr 0 ampi num photon1
3405 %
3406 }
3407 ifelse
3408 grestore
3409 } def }
3410 %
3411 % #] dashdoublephoton :
3412 % #[ photon1 :
3413 %
3414 \special{! /photon1{
3415 %
3416 % Draws a single photon from x1,y1 to x2,y2 with amplitude A and n wiggles
3417 %
3418 gsave
3419 /num1 ed /ampi1 ed
3420 normalizeline /dr ed
3421 %
3422 /x2 dr num1 div def
3423 /sign 1 def
3424 1 1 num1 {
3425 pop
3426 newpath
3427 0 0 moveto
3428 4 3 div x2 mul pi div dup neg x2 add
3429 4 3 div ampi1 sign mul mul dup 3 1 roll
3430 x2 0 curveto
3431 stroke
3432 /sign sign neg def
3433 x2 0 translate
3434 } for
3435 %
3436 grestore
3437 } def }
3438 %
3439 % #] photon1 :
3440 % #[ dashdoublezigzag :
3441 %
3442 \special{! /dashdoublezigzag{
3443 %
3444 % Draws a zigzag from x1,y1 to x2,y2 with amplitude A and n wiggles
3445 % Possibly double
3446 %
3447 gsw
3448 /dsize ed
3449 /linesep ed
3450 /num ed /ampi ed
3451 normalizeline /dr ed
3452 /num num 2 mul 0.5 sub round def
3453 %
3454 dsize 0 eq {
3455 [] 0 setdash
3456 } {
3457 % Compute the dash size
3458 /size dr num 2 mul div dup mul ampi dup mul add sqrt def
3459 /ndash size dsize 2 mul div truncate def
3460 ndash 0 eq { /ndash 1 def } if
3461 size 2 dsize ndash mul mul sub abs
3462 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3463 /dsize size 2 ndash mul div def
3464 [ dsize dsize ] dsize 2 div setdash
3465 } ifelse
3466 %
3467 linesep 0 eq
3468 { 0 0 dr 0 ampi num zigzag1 }
3469 {
3470 % 0 linesep 2 div dup dr exch ampi num zigzag1
3471 % 0 linesep -2 div dup dr exch ampi num zigzag1
3472 %
3473 linesep width add setlinewidth 0 0 dr 0 ampi num zigzag1
3474 [] 0 setdash
3475 0 0 0 0 setcmykcolor
3476 linesep width sub setlinewidth 0 0 dr 0 ampi num zigzag1
3477 %
3478 }
3479 ifelse
3480 grestore
3481 } def }
3482 %
3483 % #] dashdoublezigzag :
3484 % #[ zigzag1 :
3485 %
3486 \special{! /zigzag1{
3487 %
3488 % Draws a single zigzag from x1,y1 to x2,y2 with amplitude A and n wiggles
3489 %
3490 gsave
3491 /num1 ed /ampi1 ed
3492 normalizeline /dr ed
3493 %
3494 /x2 dr num1 div def
3495 /sign 1 def
3496 1 1 num1 {
3497 pop
3498 newpath
3499 0 0 moveto
3500 x2 2 div ampi1 sign mul lineto
3501 x2 0 lineto
3502 stroke
3503 /sign sign neg def
3504 x2 0 translate
3505 } for
3506 %
3507 grestore
3508 } def }
3509 %
3510 % #] zigzag1 :
3511 % #[ dashgluearc :
3512 %
3513 \special{! /dashgluearc{
3514 %
3515 % Draws a gluon on an arcsegment
3516 % gluon_radius, num, linesep (0 for no-double), dsize (0 for no dashes)
3517 % clock, radius, start_angle, end_angle, x_center, y_center
3518 % in which num is the number of windings of the gluon.
3519 %
3520 % Method for the gluon arc itself:
3521 % 1: compute length of arc.
3522 % 2: generate gluon in x and y as if the arc is a straight line
3523 % 3: x' = (radius+y)*cos(x*const)
3524 % y' = (radius+y)*sin(x*const)
3525 %
3526 gsw
3527 normalizearc
3528 /darc ed /radius ed /dsize ed /num ed /ampi ed
3529 /num num 0.5 sub round def
3530 %
3531 dsize 0 eq {
3532 [] 0 setdash
3533 } {
3534 /dr radius darc mul pi mul 180 div def % length of segment.
3535 /const darc dr div def % conversion constant
3536 /inc dr num 2 mul 2 add div def % increment per half winding
3537 /amp8 ampi 0.9 mul def
3538 /amp1 radius ampi add def
3539 /amp2 radius ampi sub def
3540 /amp4 amp1 inc amp8 add const mul cos div def
3541 /amp5 amp2 amp8 const mul cos div def
3542 amp8 0 lt {/amp8 amp8 neg def} if
3543 /x1 inc 2 mul def
3544 /x0 x1 const mul cos amp2 mul def
3545 /y0 x1 const mul sin amp2 mul def
3546 x1 amp8 sub const mul dup cos amp5 mul x0 sub exch sin amp5 mul y0 sub
3547 x1 amp8 sub const mul dup cos amp4 mul x0 sub exch sin amp4 mul y0 sub
3548 x1 inc add const mul dup cos amp1 mul x0 sub exch sin amp1 mul y0 sub
3549 1 lengthofbezier
3550 /size ed
3551 %
3552 /ndash size dsize 2 mul div truncate def
3553 ndash 0 eq { /ndash 1 def } if
3554 size 2 dsize ndash mul mul sub abs
3555 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3556 /dsize size 2 ndash mul div def
3557 [ dsize dsize ] dsize 2 div setdash
3558 } ifelse
3559 %
3560 /dr radius darc mul pi mul 180 div def % length of segment.
3561 /const darc dr div def % conversion constant
3562 /inc dr num 2 mul 2 add div def % increment per half winding
3563 /amp8 ampi 0.9 mul def
3564 /amp1 radius ampi add def
3565 /amp2 radius ampi sub def
3566 /amp3 radius ampi 2 div add def
3567 /amp4 amp1 inc amp8 add const mul cos div def
3568 /amp5 amp2 amp8 const mul cos div def
3569 /amp6 amp1 inc 0.6 mul amp8 add const mul cos div def
3570 /amp7 amp1 inc 0.9 mul const mul cos div def
3571 amp8 0 lt {/amp8 amp8 neg def} if
3572 %
3573 newpath
3574 /x1 inc 2 mul def
3575 x1 const mul dup cos amp2 mul exch sin amp2 mul
3576 moveto
3577 x1 amp8 add const mul dup cos amp5 mul exch sin amp5 mul
3578 x1 amp8 add const mul dup cos amp6 mul exch sin amp6 mul
3579 inc 1.4 mul const mul dup cos amp1 mul exch sin amp1 mul
3580 curveto
3581 inc 0.5 mul const mul dup cos amp7 mul exch sin amp7 mul
3582 inc 0.1 mul const mul dup cos amp3 mul exch sin amp3 mul
3583 radius 0
3584 curveto
3585 stroke
3586 newpath
3587 x1 const mul dup cos amp2 mul exch sin amp2 mul moveto
3588 2 1 num { pop
3589 x1 amp8 sub const mul dup cos amp5 mul exch sin amp5 mul
3590 x1 amp8 sub const mul dup cos amp4 mul exch sin amp4 mul
3591 x1 inc add const mul dup cos amp1 mul exch sin amp1 mul
3592 curveto
3593 /x1 x1 inc dup add add def
3594 x1 amp8 add const mul dup cos amp4 mul exch sin amp4 mul
3595 x1 amp8 add const mul dup cos amp5 mul exch sin amp5 mul
3596 x1 const mul dup cos amp2 mul exch sin amp2 mul
3597 curveto
3598 } for
3599 x1 amp8 sub const mul dup cos amp5 mul exch sin amp5 mul
3600 x1 amp8 sub const mul dup cos amp6 mul exch sin amp6 mul
3601 x1 inc 0.6 mul add const mul dup cos amp1 mul exch sin amp1 mul
3602 curveto
3603 x1 inc 1.5 mul add const mul dup cos amp7 mul exch sin amp7 mul
3604 dr inc 0.1 mul sub const mul dup cos amp3 mul exch sin amp3 mul
3605 dr const mul dup cos radius mul exch sin radius mul
3606 curveto
3607 stroke
3608 %
3609 grestore
3610 } def
3611 }
3612 %
3613 % #] dashgluearc :
3614 % #[ dashdoublephotonarc :
3615 %
3616 \special{! /dashdoublephotonarc{
3617 %
3618 % Draws a photon on an arcsegment
3619 % photon_radius, num, linesep (0 for no-double), dsize (0 for no dashes),
3620 % clock, radius, start_angle, end_angle, x_center, y_center
3621 % in which num is the number of wiggles of the photon.
3622 %
3623 gsw
3624 normalizearc
3625 /darc ed /radius ed /dsize ed /linesep ed /num ed /ampli ed
3626 %
3627 /num num 2 mul round def % number of half wiggles
3628 /darc1 darc num div def
3629 /cp darc1 cos def
3630 /sp darc1 sin def
3631 darc1 2 div dup
3632 /cp2 exch cos def
3633 /sp2 exch sin def
3634 %
3635 dsize 0 eq {
3636 [] 0 setdash
3637 } {
3638 %
3639 % Compute the length of the outer curve and the inner curve.
3640 % There must be an integer number of patterns in half the sum.
3641 % The we use half of the first to determine where in the pattern
3642 % we should start.
3643 %
3644 /ampli1 ampli def
3645 /beta radius darc1 mul 180 ampli1 mul div def
3646 /tt sp cp beta mul sub cp sp beta mul add div def
3647 /amp1 radius ampli1 add 8 mul beta cp2 mul sp2 sub mul beta 4 cp add mul
3648 tt cp mul 3 mul sp 4 mul sub add radius mul sub
3649 beta tt sub 3 mul div def % this is x2
3650 radius ampli1 add 8 mul cp2 mul 1 cp add radius mul sub 3 div amp1 sub
3651 dup radius sub exch radius sub beta mul % x1,y1
3652 amp1 radius sub amp1 radius cp mul sub tt mul radius sp mul add % x2,y2
3653 radius cp mul radius sub radius sp mul % x3 y3
3654 1 lengthofbezier
3655 /len1 ed
3656 /ampli1 ampli1 neg def
3657 /beta radius darc1 mul 180 ampli1 mul div def
3658 /tt sp cp beta mul sub cp sp beta mul add div def
3659 /amp1 radius ampli1 add 8 mul beta cp2 mul sp2 sub mul beta 4 cp add mul
3660 tt cp mul 3 mul sp 4 mul sub add radius mul sub
3661 beta tt sub 3 mul div def % this is x2
3662 radius ampli1 add 8 mul cp2 mul 1 cp add radius mul sub 3 div amp1 sub
3663 dup radius sub exch radius sub beta mul % x1,y1
3664 amp1 radius sub amp1 radius cp mul sub tt mul radius sp mul add % x2,y2
3665 radius cp mul radius sub radius sp mul % x3 y3
3666 1 lengthofbezier
3667 /len2 ed
3668 /size len1 len2 add 2 div def
3669 /size2 len1 2 div def
3670 %
3671 /ndash size dsize 2 mul div truncate def
3672 ndash 0 eq { /ndash 1 def } if
3673 size 2 dsize ndash mul mul sub abs
3674 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3675 /dsize size 2 ndash mul div def
3676 /numd size2 dsize 2 mul div truncate def
3677 /dstart dsize 2 div size2 sub 2 numd dsize mul mul add def
3678 dstart 0 lt { /dstart dstart dsize 2 mul add def } if
3679 [ dsize dsize ] dstart setdash
3680 } ifelse
3681 %
3682 linesep 0 eq {
3683 radius photonarc1
3684 } {
3685 linesep width add setlinewidth radius photonarc1
3686 [] 0 setdash
3687 0 0 0 0 setcmykcolor
3688 linesep width sub setlinewidth radius photonarc1
3689 } ifelse
3690 %
3691 grestore
3692 } def }
3693 %
3694 % #] dashdoublephotonarc :
3695 % #[ photonarc1 :
3696 %
3697 \special{! /photonarc1{
3698 % Usage: radius photonarc1
3699 % Draws a single photon on an arcsegment.
3700 % Called from dashdoublephotonarc with coordinates centered on center,
3701 % start on x-axis.
3702 % Assume the following are set: num, ampli, arcend phi, arcstart phi/2, cp,
3703 % cp2, sp, sp2.
3704 % Draws a photonarc center at x1,y1, radius arcstart,arcend, amplitude
3705 % number of wiggles, width, scale
3706 %
3707 gsave
3708 /radius1 ed
3709 % Local copy of amplitude, since I change it
3710 /ampli1 ampli def
3711 %
3712 newpath
3713 radius1 0 moveto
3714 1 1 num { 1 sub /ii ed
3715 /cpi darc1 ii mul cos def
3716 /spi darc1 ii mul sin def
3717 /beta radius1 darc1 mul 180 ampli1 mul div def
3718 /tt sp cp beta mul sub cp sp beta mul add div def
3719 /x2 radius1 ampli1 add 8 mul beta cp2 mul sp2 sub mul beta 4 cp add mul
3720 tt cp mul 3 mul sp 4 mul sub add radius1 mul sub
3721 beta tt sub 3 mul div def
3722 /x1 radius1 ampli1 add 8 mul cp2 mul 1 cp add radius1 mul sub 3 div x2 sub def
3723 /y1 x1 radius1 sub beta mul def
3724 /y2 x2 radius1 cp mul sub tt mul radius1 sp mul add def
3725 /x3 radius1 cp mul def
3726 /y3 radius1 sp mul def
3727 x1 cpi mul y1 spi mul sub y1 cpi mul x1 spi mul add
3728 x2 cpi mul y2 spi mul sub y2 cpi mul x2 spi mul add
3729 x3 cpi mul y3 spi mul sub y3 cpi mul x3 spi mul add
3730 curveto
3731 /ampli1 ampli1 neg def
3732 } for
3733 stroke
3734 %
3735 grestore
3736 } def }
3737 %
3738 % #] photonarc1 :
3739 % #[ dashdoublezigzagarc :
3740 %
3741 \special{! /dashdoublezigzagarc{
3742 %
3743 % Draws a zigzag on an arcsegment
3744 % zigzag_radius, num, linesep (0 for no-double), dsize (0 for no dashes),
3745 % clock, radius, start_angle, end_angle, x_center, y_center
3746 % in which num is the number of wiggles of the zigzag.
3747 %
3748 gsw
3749 normalizearc
3750 /darc ed /radius ed /dsize ed /linesep ed /num ed /ampli ed
3751 %
3752 /num num 2 mul round def % number of half wiggles
3753 /darc1 darc num div def
3754 /cp darc1 cos def
3755 /sp darc1 sin def
3756 darc1 2 div dup
3757 /cp2 exch cos def
3758 /sp2 exch sin def
3759 %
3760 dsize 0 eq {
3761 [] 0 setdash
3762 } {
3763 /size ampli dup mul radius dup mul add radius dup mul ampli dup mul sub
3764 cp mul sub 2 div sqrt def
3765 /size2 ampli dup mul ampli radius add radius mul 2 mul 1 cp2 sub mul
3766 add sqrt def
3767 %
3768 /ndash size dsize 2 mul div truncate def
3769 ndash 0 eq { /ndash 1 def } if
3770 size 2 dsize ndash mul mul sub abs
3771 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3772 /dsize size 2 ndash mul div def
3773 /numd size2 dsize 2 mul div truncate def
3774 /dstart dsize 2 div size2 sub 2 numd dsize mul mul add def
3775 dstart 0 lt { /dstart dstart dsize 2 mul add def } if
3776 [ dsize dsize ] dstart setdash
3777 } ifelse
3778 %
3779 linesep 0 eq {
3780 radius zigzagarc1
3781 } {
3782 linesep width add setlinewidth radius zigzagarc1
3783 [] 0 setdash
3784 0 0 0 0 setcmykcolor
3785 linesep width sub setlinewidth radius zigzagarc1
3786 } ifelse
3787 %
3788 grestore
3789 } def }
3790 %
3791 % #] dashdoublezigzagarc :
3792 % #[ zigzagarc1 :
3793 %
3794 \special{! /zigzagarc1{
3795 % Usage: radius zigzagarc1
3796 % Draws a single zigzag on an arcsegment.
3797 % Called from dashdoublezigzagarc with coordinates centered on center,
3798 % start on x-axis.
3799 % Assume the following are set: num, ampli, arcend phi, arcstart phi/2, cp,
3800 % cp2, sp, sp2.
3801 % Draws a zigzagarc center at x1,y1, radius arcstart,arcend, amplitude
3802 % number of wiggles, width, scale
3803 %
3804 gsave
3805 /radius1 ed
3806 % Local copy of amplitude, since I change it
3807 /ampli1 ampli def
3808 %
3809 % Num is the number of half wiggles. We like to start and end with
3810 % quarter wiggles though.
3811 %
3812 /darc2 darc1 2 div def
3813 newpath
3814 radius1 0 moveto
3815 darc2 dup sin exch cos
3816 radius1 ampli1 add mul exch radius1 ampli1 add mul lineto
3817 /ampli1 ampli1 neg def
3818 /num1 num 1 sub def
3819 1 1 num1 {
3820 darc1 mul darc2 add dup sin exch cos
3821 radius1 ampli1 add mul exch radius1 ampli1 add mul lineto
3822 /ampli1 ampli1 neg def
3823 } for
3824 num darc1 mul dup sin exch cos
3825 radius1 mul exch radius1 mul lineto
3826 stroke
3827 %
3828 grestore
3829 } def }
3830 %
3831 % #] zigzagarc1 :
3832 % #[ dashgluoncirc :
3833 %
3834 \special{! /dashgluoncirc{
3835 %
3836 % Draws a gluon on a complete circle
3837 % cmyk color setting
3838 % gluon_ampl, num, linesep (0 for no-double), dsize (0 for no dashes)
3839 % radius, phase_angle, x_center, y_center
3840 % in which num is the number of windings of the gluon.
3841 %
3842 gsw
3843 translate
3844 /phase ed /radius ed /dsize ed /num ed /ampi ed
3845 /num num 0.5 sub round def
3846 /darc 180 num div def
3847 %
3848 % We rotate in such a way that 0 angle becomes more accessible.
3849 %
3850 darc phase add rotate
3851 %
3852 dsize 0 eq {
3853 [] 0 setdash
3854 } {
3855 /dr radius 2 mul pi mul def % 2*pi*r
3856 /inc dr 2 num mul div def % 2*pi*r/(2*num)
3857 /const 360 dr div def % 360/(2*pi*r)
3858 /amp8 ampi 0.9 mul def
3859 /amp1 radius ampi add def
3860 /amp2 radius ampi sub def
3861 /amp4 amp1 inc amp8 add const mul cos div def
3862 /amp5 amp2 amp8 const mul cos div def
3863 amp8 0 lt {/amp8 amp8 neg def} if
3864 /xx inc 2 mul def
3865 /x0 amp1 inc const mul cos mul def
3866 /y0 amp1 inc const mul sin mul def
3867 amp4 xx amp8 add const mul cos mul x0 sub
3868 amp4 xx amp8 add const mul sin mul y0 sub
3869 amp5 xx amp8 add const mul cos mul x0 sub
3870 amp5 xx amp8 add const mul sin mul y0 sub
3871 amp2 xx const mul cos mul x0 sub
3872 amp2 xx const mul sin mul y0 sub
3873 1 lengthofbezier
3874 /size ed
3875 %
3876 /ndash size dsize 2 mul div truncate def
3877 ndash 0 eq { /ndash 1 def } if
3878 size 2 dsize ndash mul mul sub abs
3879 size 2 dsize ndash 1 add mul mul sub abs gt { /ndash ndash 1 add def } if
3880 /dsize size 2 ndash mul div def
3881 [ dsize dsize ] dsize 2 div setdash
3882 } ifelse
3883 %
3884 /dr radius 2 mul pi mul def % 2*pi*r
3885 /inc dr 2 num mul div def % 2*pi*r/(2*num)
3886 /const 360 dr div def % 360/(2*pi*r)
3887 /amp8 ampi 0.9 mul def
3888 /amp1 radius ampi add def
3889 /amp2 radius ampi sub def
3890 /amp4 amp1 inc amp8 add const mul cos div def
3891 /amp5 amp2 amp8 const mul cos div def
3892 amp8 0 lt {/amp8 amp8 neg def} if
3893 %
3894 newpath
3895 %
3896 /xx inc 2 mul def
3897 amp1 inc const mul cos mul amp1 inc const mul sin mul moveto
3898 %
3899 1 1 num { pop
3900 amp4 xx amp8 add const mul cos mul
3901 amp4 xx amp8 add const mul sin mul
3902 amp5 xx amp8 add const mul cos mul
3903 amp5 xx amp8 add const mul sin mul
3904 amp2 xx const mul cos mul
3905 amp2 xx const mul sin mul
3906 curveto
3907 amp5 xx amp8 sub const mul cos mul
3908 amp5 xx amp8 sub const mul sin mul
3909 amp4 xx amp8 sub const mul cos mul
3910 amp4 xx amp8 sub const mul sin mul
3911 amp1 xx inc add const mul cos mul
3912 amp1 xx inc add const mul sin mul
3913 curveto
3914 /xx xx inc 2 mul add def
3915 } for
3916 %
3917 stroke
3918 %
3919 grestore
3920 } def }
3921 %
3922 % #] dashgluoncirc :
3923 % #[ arc2 :
3924 %
3925 \special{! /arc2{
3926 % Draws an arc segment:
3927 % arrowspec, arrowpos, flip, linesep, dsize,
3928 % clock, radius, start_angle, end_angle, x_center, y_center, width, scale
3929 % If linesep == 0, then single line, else double with separation linesep.
3930 %
3931 gsw
3932 normalizearc
3933 /darc ed /radius ed
3934 /dsize ed /linesep ed
3935 /angdsize dsize radius div def
3936 /flip ed
3937 getarrow
3938 /arcmid darc arrowpos mul def
3939 /linewidth width def
3940 dsize 0 eq
3941 { linesep 0 eq
3942 { 0 0 radius 0 darc dasharc }
3943 { gsave
3944 linesep linewidth add setlinewidth
3945 0 0 radius 0 darc dasharc
3946 setbackgroundcolor
3947 [] 0 setdash
3948 linesep linewidth sub setlinewidth
3949 0 0 radius 0 darc dasharc
3950 grestore
3951 } ifelse
3952 }
3953 { linesep 0 eq
3954 { 0 0 radius 0 arcmid dasharc
3955 0 0 radius arcmid darc dasharc
3956 } {
3957 gsave
3958 linesep linewidth add setlinewidth
3959 0 0 radius 0 arcmid dasharc
3960 0 0 radius arcmid darc dasharc
3961 setbackgroundcolor
3962 [] 0 setdash
3963 linesep linewidth sub setlinewidth
3964 0 0 radius 0 darc dasharc
3965 grestore
3966 } ifelse
3967 } ifelse
3968 arcmid rotate
3969 radius 0 translate
3970 flip { 0 } { 180 } ifelse
3971 witharrow { drawarrow } if
3972 grestore
3973 } def }
3974 %
3975 % #] arc2 :
3976 % #[ dasharrowdoubleline :
3977 %
3978 \special{! /dasharrowdoubleline{
3979 %
3980 % arrowspec, arrowpos, flip, linesep, dsize,
3981 % x1, y1, x2, y2, width, scale
3982 % If linesep == 0, then single line, else double with separation linesep.
3983 % Draws a dashed double straight line with arrow.
3984 % If dsize==0, then continuous line.
3985 % If linesep==0, then single line.
3986 gsw
3987 normalizeline
3988 /dr ed
3989 /dsize ed
3990 /linesep ed
3991 /flip ed
3992 getarrow
3993 %
3994 % If linesep is negative, that means the arrow is flipped.
3995 % But the lineend coordinates are already flipped, so there is
3996 % no need to make any adjustment; i.e., replace linesep by
3997 % absolute value.
3998 /linesep setabs
3999 /linewidth width def
4000 linesep 0 eq {
4001 0 0 dr 0 dashline
4002 } {
4003 gsave
4004 linesep linewidth add setlinewidth 0 0 dr 0 dashline
4005 setbackgroundcolor
4006 [] 0 setdash
4007 linesep linewidth sub setlinewidth 0 0 dr 0 newpath moveto lineto stroke
4008 grestore
4009 } ifelse
4010 dr arrowpos mul 0 translate
4011 flip { -90 }{ 90 } ifelse
4012 witharrow { drawarrow } if
4013 grestore
4014 } def }
4015 %
4016 % #] dasharrowdoubleline :
4017 % #[ vertex :
4018 %
4019 \special{! /vertex{
4020 %
4021 % Puts a fat dot at x,y size is the radius of the dot
4022 %
4023 gs
4024 /dotsize ed
4025 translate
4026 newpath
4027 0 0 dotsize 0 360 arc
4028 fill stroke
4029 grestore
4030 } def }
4031 %
4032 % #] vertex :
4033 % #[ ecirc :
4034 %
4035 \special{! /ecirc{
4036 %
4037 % Draws an anti-clockwise circle :
4038 % x_center, y_center, radius
4039 % Transparent interior
4040 %
4041 gsw /radius ed
4042 translate % x and y are still on stack
4043 newpath 0 0 radius 0 360 arc stroke
4044 grestore
4045 } def }
4046 %
4047 % #] ecirc :
4048 % #[ ebox :
4049 %
4050 \special{! /ebox{
4051 %
4052 % Draws a transparent box x1,y1,x2,y2
4053 %
4054 gsw p2 p1
4055 abox stroke
4056 grestore
4057 } def }
4058 %
4059 % #] ebox :
4060 % #[ fbox :
4061 %
4062 \special{! /fbox{
4063 %
4064 % Draws a filled box x1,y1,x2,y2
4065 %
4066 gsw p2 p1
4067 abox fill
4068 grestore
4069 } def }
4070 %
4071 % #] fbox :
4072 % #[ triangle :
4073 %
4074 \special{! /triangle{
4075 %
4076 % Draws a triangle x1,y1,x2,y2,x3,y3
4077 %
4078 gsw p3 p2 p1
4079 atriangle stroke
4080 grestore
4081 } def }
4082 %
4083 % #] triangle :
4084 % #[ ftriangle :
4085 %
4086 \special{! /ftriangle{
4087 %
4088 % Draws a triangle x1,y1,x2,y2,x3,y3
4089 %
4090 gsw p3 p2 p1
4091 atriangle fill
4092 grestore
4093 } def }
4094 %
4095 % #] ftriangle :
4096 % #[ ellipse:
4097 %
4098 \special{! /ellipse {
4099 % Draw an ellipse
4100 % RedGrittyBrick 20/10/2003
4101 % From http://www.redgrittybrick.org/postscript/ellipse.html. 2011/03/22
4102 % draw an ellipse using four bezier curves
4103 %
4104 /r2 exch def % 2nd parameter
4105 /r1 exch def % 1st parameter
4106 /kappa 0.5522847498 def
4107 %
4108 newpath
4109 0 r2 moveto % start point of curve
4110 %
4111 % top clockwise
4112 kappa r1 mul r2 % 1st Bezier control point
4113 r1 kappa r2 mul % 2nd Bezier control point
4114 r1 0 curveto % end point of curve
4115 %
4116 % right clockwise
4117 r1 kappa r2 mul neg
4118 kappa r1 mul r2 neg
4119 0 r2 neg curveto
4120 %
4121 % bottom clockwise
4122 kappa r1 mul neg r2 neg
4123 r1 neg kappa r2 mul neg
4124 r1 neg 0 curveto
4125 %
4126 % left clockwise
4127 r1 neg kappa r2 mul
4128 kappa r1 mul neg r2
4129 0 r2 curveto
4130 %
4131 } def % ellipse
4132 }
4133 %
4134 % #] ellipse:
4135 % #[ goval :
4136 %
4137 \special{! /goval{
4138 %
4139 % Draws a gray oval that overwrites whatever was there.
4140 % x_center y_center height width rotation color linewidth scale
4141 %
4142 gsw /gcolor ed /angle ed /width ed /height ed
4143 %
4144 translate % x and y are still on stack
4145 angle rotate
4146 1 setgray width height ellipse fill
4147 gcolor setgray width height ellipse fill
4148 0 setgray width height ellipse stroke
4149 grestore
4150 } def }
4151 %
4152 % #] goval :
4153 % #[ fcoval :
4154 %
4155 \special{! /foval{
4156 %
4157 % Draws an oval that overwrites whatever was there.
4158 % x_center y_center height width rotation linewidth scale
4159 %
4160 gsw /angle ed /width ed /height ed
4161 %
4162 translate % x and y are still on stack
4163 angle rotate
4164 width height ellipse fill
4165 grestore
4166 } def }
4167 %
4168 % #] foval :
4169 % #[ oval :
4170 %
4171 \special{! /oval{
4172 %
4173 % Draws an oval that does not overwrite whatever was there.
4174 % x_center y_center height width rotation linewidth scale
4175 %
4176 gsw /angle ed /width ed /height ed
4177 %
4178 translate % x and y are still on stack
4179 angle rotate
4180 width height ellipse stroke
4181 grestore
4182 } def }
4183 %
4184 % #] oval :
4185 % #[ polygon :
4186 %
4187 % Incoming stack:
4188 % [array of x,y pairs] width scale
4189 %
4190 \special{! /polygon{
4191 gsw /points ed
4192 /ss points length 2 idiv 2 mul def
4193 ss 4 gt {
4194 newpath
4195 points 0 get points 1 get moveto
4196 0 2 ss 4 sub { /ii ed
4197 /x1 points ii 2 add get def
4198 /y1 points ii 3 add get def
4199 x1 y1 lineto
4200 } for
4201 closepath
4202 stroke
4203 } if
4204 grestore
4205 } def }
4206 %
4207 % #] polygon :
4208 % #[ filledpolygon :
4209 %
4210 % Incoming stack:
4211 % [array of x,y pairs] width scale
4212 %
4213 \special{! /filledpolygon{
4214 gsw /points ed
4215 /ss points length 2 idiv 2 mul def
4216 ss 4 gt {
4217 newpath
4218 points 0 get points 1 get moveto
4219 0 2 ss 4 sub { /ii ed
4220 /x1 points ii 2 add get def
4221 /y1 points ii 3 add get def
4222 x1 y1 lineto
4223 } for
4224 closepath
4225 fill
4226 } if
4227 grestore
4228 } def }
4229 %
4230 % #] filledpolygon :
4231 % #[ makecurve :
4232 %
4233 \special{! /docurve{
4234 x1 2 mul x2 add 3 div
4235 y1 y0 sub x1 x0 sub div x2 x0 sub mul
4236 y2 y0 sub x2 x0 sub div x1 x0 sub mul add
4237 y1 add y0 2 mul add 3 div
4238 x1 x2 2 mul add 3 div
4239 y2 y3 sub x2 x3 sub div x1 x3 sub mul
4240 y1 y3 sub x1 x3 sub div x2 x3 sub mul add
4241 y2 add y3 2 mul add 3 div
4242 x2 y2 curveto
4243 } def }
4244 %
4245 \special{! /makecurve{
4246 %
4247 % Incoming stack:
4248 % [array of x,y pairs] width scale
4249 %
4250 gsw /points ed
4251 /ss points length 2 idiv 2 mul def
4252 newpath
4253 ss 4 gt {
4254 /x1 points 0 get def
4255 /y1 points 1 get def
4256 /x2 points 2 get def
4257 /y2 points 3 get def
4258 /x3 points 4 get def
4259 /y3 points 5 get def
4260 /x0 x1 2 mul x2 sub def
4261 /y0 y3 y2 sub x3 x2 sub div y2 y1 sub x2 x1 sub div sub 2 mul
4262 x2 x1 sub dup mul x3 x1 sub div mul
4263 y1 2 mul add y2 sub def
4264 x1 y1 moveto
4265 docurve
4266 0 2 ss 8 sub { /ii ed
4267 /x0 points ii get def
4268 /y0 points ii 1 add get def
4269 /x1 points ii 2 add get def
4270 /y1 points ii 3 add get def
4271 /x2 points ii 4 add get def
4272 /y2 points ii 5 add get def
4273 /x3 points ii 6 add get def
4274 /y3 points ii 7 add get def
4275 docurve
4276 } for
4277 /x0 points ss 6 sub get def
4278 /y0 points ss 5 sub get def
4279 /x1 points ss 4 sub get def
4280 /y1 points ss 3 sub get def
4281 /x2 points ss 2 sub get def
4282 /y2 points ss 1 sub get def
4283 /x3 x2 2 mul x1 sub def
4284 /y3 y2 y1 sub x2 x1 sub div y1 y0 sub x1 x0 sub div sub 2 mul
4285 x2 x1 sub dup mul x2 x0 sub div mul
4286 y2 2 mul add y1 sub def
4287 docurve
4288 } {
4289 ss 4 eq {
4290 points 0 get points 1 get moveto
4291 points 2 get points 3 get lineto
4292 } if
4293 } ifelse
4294 stroke
4295 grestore
4296 } def }
4297 %
4298 % #] makecurve :
4299 % #[ makedashcurve :
4300 %
4301 \special{! /makedashcurve{
4302 %
4303 % Incoming stack:
4304 % [array of x,y pairs] dashsize width scale
4305 %
4306 gsw /dsize ed /points ed
4307 /ss points length 2 idiv 2 mul def
4308 newpath
4309 ss 4 gt {
4310 /x1 points 0 get def
4311 /y1 points 1 get def
4312 /x2 points 2 get def
4313 /y2 points 3 get def
4314 /x3 points 4 get def
4315 /y3 points 5 get def
4316 /x0 x1 2 mul x2 sub def
4317 /y0 y3 y2 sub x3 x2 sub div y2 y1 sub x2 x1 sub div sub 2 mul
4318 x2 x1 sub dup mul x3 x1 sub div mul
4319 y1 2 mul add y2 sub def
4320 x1 y1 moveto
4321 docurve
4322 0 2 ss 8 sub { /ii ed
4323 /x0 points ii get def
4324 /y0 points ii 1 add get def
4325 /x1 points ii 2 add get def
4326 /y1 points ii 3 add get def
4327 /x2 points ii 4 add get def
4328 /y2 points ii 5 add get def
4329 /x3 points ii 6 add get def
4330 /y3 points ii 7 add get def
4331 docurve
4332 } for
4333 /x0 points ss 6 sub get def
4334 /y0 points ss 5 sub get def
4335 /x1 points ss 4 sub get def
4336 /y1 points ss 3 sub get def
4337 /x2 points ss 2 sub get def
4338 /y2 points ss 1 sub get def
4339 /x3 x2 2 mul x1 sub def
4340 /y3 y2 y1 sub x2 x1 sub div y1 y0 sub x1 x0 sub div sub 2 mul
4341 x2 x1 sub dup mul x2 x0 sub div mul
4342 y2 2 mul add y1 sub def
4343 docurve
4344 } {
4345 ss 4 eq {
4346 points 0 get points 1 get moveto
4347 points 2 get points 3 get lineto
4348 } if
4349 } ifelse
4350 centerdash
4351 stroke
4352 grestore
4353 } def }
4354 %
4355 \special{! /pathlength{
4356 flattenpath
4357 /dist 0 def
4358 { /yfirst ed /xfirst ed /ymoveto yfirst def /xmoveto xfirst def }
4359 { /ynext ed /xnext ed /dist dist ynext yfirst sub dup mul
4360 xnext xfirst sub dup mul add sqrt add def
4361 /yfirst ynext def /xfirst xnext def }
4362 {}
4363 {/ynext ymoveto def /xnext xmoveto def
4364 /dist ynext yfirst sub dup mul
4365 xnext xfirst sub dup mul add sqrt add def
4366 /yfirst ynext def /xfirst xnext def }
4367 pathforall
4368 dist
4369 } def }
4370 %
4371 \special{! /centerdash{
4372 /pathlen pathlength def
4373 /jj pathlen dsize div 2.0 div cvi def
4374 /ddsize pathlen jj 2.0 mul div def
4375 [ddsize] ddsize 2 div setdash
4376 } def }
4377 %
4378 % #] makedashcurve :
4379 % #[ logaxis :
4380 %
4381 \special{! /logaxis{
4382 %
4383 % Draws an axis from x1,y1 to x2,y2 with nl log divisions
4384 % size of the hashes hs, offset F
4385 % and width W. The stack looks like
4386 % x1,y1,x2,y2,nl,hs,F,W,scale
4387 % After the rotation the hash marks are on top if nl is positive and
4388 % on the bottom if nl is negative
4389 %
4390 % Offset 0 or negative: replace by 1.
4391 % Adjust by factors of 10 to be in range 1 to 10.
4392 %
4393 gsw /offset ed /hashsize ed /nlogs ed
4394 normalizeline /rr ed
4395 offset 0 le { /offset 1 def } if
4396 /offset
4397 offset ln 10 ln div
4398 dup cvi sub
4399 dup 0 lt { 1 add } if
4400 def
4401 /lsize rr nlogs div def
4402 newpath
4403 0 0 moveto
4404 rr 0 lineto
4405 0 1 nlogs 1 add {
4406 offset sub lsize mul
4407 dup -0.001 gt {
4408 dup rr 0.001 add le {
4409 dup 0 moveto
4410 hashsize 1.2 mul lineto
4411 } if
4412 } if
4413 } for
4414 stroke
4415 width 0.6 mul setlinewidth
4416 newpath
4417 0 1 nlogs { /x2 ed
4418 2 1 9 {
4419 ln 10 ln div x2 add
4420 offset sub lsize mul
4421 dup -0.001 gt {
4422 dup rr 0.001 add le {
4423 dup 0 moveto
4424 hashsize 0.8 mul lineto
4425 } if
4426 } if
4427 } for
4428 } for
4429 stroke
4430 grestore
4431 } def }
4432 %
4433 % #] logaxis :
4434 % #[ linaxis :
4435 %
4436 \special{! /linaxis{
4437 %
4438 % x1,y1,x2,y2,num_decs,per_dec,hashsize,offset,width,scale
4439 % Bad offset <= 0: change to 1.
4440 %
4441 gsw /offset ed /hashsize ed /perdec ed /numdec ed
4442 normalizeline
4443 /rr ed
4444 /perdec
4445 perdec round
4446 dup 0 le { pop 1 } if
4447 def
4448 /offset offset
4449 % Do real equivalent of offset perdec mod
4450 dup cvi perdec idiv perdec mul
4451 sub
4452 dup 0 lt {perdec add} if
4453 dup perdec ge {perdec sub} if
4454 def
4455 newpath
4456 0 0 moveto
4457 rr 0 lineto
4458 /x1 rr numdec perdec mul div def
4459 /y1 rr numdec div def
4460 0 1 numdec 1 add
4461 { y1 mul offset x1 mul sub
4462 dup -0.001 gt {
4463 dup rr 0.001 add lt {
4464 dup 0 moveto
4465 hashsize 1.2 mul lineto
4466 } if
4467 } if
4468 } for
4469 stroke
4470 width 0.6 mul setlinewidth
4471 newpath
4472 /offset offset dup cvi sub def
4473 0 1 numdec perdec mul {
4474 offset sub x1 mul
4475 dup -0.001 ge {
4476 dup rr 0.001 add le {
4477 dup 0 moveto
4478 hashsize 0.8 mul lineto
4479 } if
4480 } if
4481 } for
4482 stroke
4483 grestore
4484 } def }
4485 %
4486 % #] linaxis :
4487 % #[ dashbezier :
4488 %
4489 \special{! /dashbezier{
4490 %
4491 % Draws a dashed Bezier with control points x1,y1,x2,y2,x3,y3,x4,y4
4492 %
4493 gsw /dsize ed p4 p3 p2 p1
4494 dsize 0 ne {
4495 /size x2 x1 sub y2 y1 sub x3 x1 sub y3 y1 sub x4 x1 sub y4 y1 sub
4496 1 lengthofbezier def
4497 /numdashes size dsize 2 mul div def
4498 numdashes 0 eq { /numdashes 1 def } if
4499 size dsize 2 mul numdashes mul sub abs
4500 size dsize 2 mul numdashes 1 add mul sub abs
4501 gt { /numdashes 1 add def } if
4502 /dsize size numdashes 2 mul div def
4503 [dsize dsize] dsize 2 div setdash
4504 } if
4505 abezier stroke
4506 grestore
4507 } def }
4508 %
4509 % #] dashbezier :
4510 % #[ dashdoublebezier :
4511 %
4512 \special{! /dashdoublebezier{
4513 %
4514 % Draws a dashed Bezier with control points x1,y1,x2,y2,x3,y3,x4,y4
4515 %
4516 gsw /dsize ed /linesep ed
4517 /flip ed
4518 getarrow
4519 p4 p3 p2 p1
4520 /linewidth width def
4521 /bsize x2 x1 sub y2 y1 sub x3 x1 sub y3 y1 sub x4 x1 sub y4 y1 sub
4522 1 lengthofbezier def
4523 dsize 0 ne {
4524 /numdashes bsize dsize 2 mul div def
4525 numdashes 0 eq { /numdashes 1 def } if
4526 bsize dsize 2 mul numdashes mul sub abs
4527 bsize dsize 2 mul numdashes 1 add mul sub abs
4528 gt { /numdashes 1 add def } if
4529 /dsize bsize numdashes 2 mul div def
4530 [dsize dsize] dsize 2 div setdash
4531 } if
4532 linesep 0 ne {
4533 linesep linewidth add setlinewidth abezier stroke
4534 gsave
4535 0 0 0 0 setcmykcolor
4536 linesep linewidth sub setlinewidth abezier stroke
4537 grestore
4538 } {
4539 abezier stroke
4540 } ifelse
4541 %
4542 witharrow {
4543 /tb arrowpos def
4544 /tbmax 1 def /tbmin 0 def
4545 {
4546 /sizeb x2 x1 sub y2 y1 sub x3 x1 sub y3 y1 sub x4 x1 sub y4 y1 sub
4547 tb lengthofbezier def
4548 sizeb bsize div arrowpos sub abs 0.0001 le { exit } if
4549 sizeb bsize div arrowpos gt
4550 { /tbmax tb def /tb tb tbmin add 2 div def }
4551 { /tbmin tb def /tb tb tbmax add 2 div def } ifelse
4552 } loop
4553 /ub 1 tb sub def
4554 x1 ub ub ub mul mul mul tb x2 3 mul ub mul ub mul tb x3 3 mul ub mul
4555 x4 tb mul add mul add mul add
4556 y1 ub ub ub mul mul mul tb y2 3 mul ub mul ub mul tb y3 3 mul ub mul
4557 y4 tb mul add mul add mul add translate
4558 y4 tb dup mul mul y3 tb mul 2 3 tb mul sub mul add y2 ub mul 1 3 tb mul
4559 sub mul add y1 ub dup mul mul sub 3 mul
4560 x4 tb dup mul mul x3 tb mul 2 3 tb mul sub mul add x2 ub mul 1 3 tb mul
4561 sub mul add x1 ub dup mul mul sub 3 mul
4562 atan rotate
4563 flip { -90 }{ 90 } ifelse
4564 drawarrow
4565 } if
4566 %
4567 grestore
4568 } def }
4569 %
4570 % #] dashdoublebezier :
4571 % #[ lengthofbezier :
4572 %
4573 % Calculates the length of a Bezier curve assuming that we start
4574 % in the point 0,0. We use a Gaussian quadrature with 16 points.
4575 % If, at any time, more precision is needed we have the 32 points
4576 % numbers in axohelp.c. (and there is more commentary in that file)
4577 %
4578 \special{!
4579 /g16x1 { 0.095012509837637440185 } def
4580 /g16x2 { 0.281603550779258913230 } def
4581 /g16x3 { 0.458016777657227386342 } def
4582 /g16x4 { 0.617876244402643748447 } def
4583 /g16x5 { 0.755404408355003033895 } def
4584 /g16x6 { 0.865631202387831743880 } def
4585 /g16x7 { 0.944575023073232576078 } def
4586 /g16x8 { 0.989400934991649932596 } def
4587 /g16w1 { 0.189450610455068496285 } def
4588 /g16w2 { 0.182603415044923588867 } def
4589 /g16w3 { 0.169156519395002538189 } def
4590 /g16w4 { 0.149595988816576732081 } def
4591 /g16w5 { 0.124628971255533872052 } def
4592 /g16w6 { 0.095158511682492784810 } def
4593 /g16w7 { 0.062253523938647892863 } def
4594 /g16w8 { 0.027152459411754094852 } def
4595 /onepoint {
4596 /gpt ed
4597 /tpt 1 gpt add 2 div tmax mul def
4598 xc tpt mul xb add tpt mul xa add dup mul
4599 yc tpt mul yb add tpt mul ya add dup mul
4600 add sqrt
4601 /tpt 1 gpt sub 2 div tmax mul def
4602 xc tpt mul xb add tpt mul xa add dup mul
4603 yc tpt mul yb add tpt mul ya add dup mul
4604 add sqrt add 2 div
4605 } def
4606 /lengthofbezier {
4607 /tmax ed
4608 pp3 pp2 pp1
4609 /xa xx1 3 mul def /xb xx2 xx1 2 mul sub 6 mul def
4610 /xc xx3 xx2 xx1 sub 3 mul sub 3 mul def
4611 /ya yy1 3 mul def /yb yy2 yy1 2 mul sub 6 mul def
4612 /yc yy3 yy2 yy1 sub 3 mul sub 3 mul def
4613 %
4614 g16x1 onepoint g16w1 mul
4615 g16x2 onepoint g16w2 mul add
4616 g16x3 onepoint g16w3 mul add
4617 g16x4 onepoint g16w4 mul add
4618 g16x5 onepoint g16w5 mul add
4619 g16x6 onepoint g16w6 mul add
4620 g16x7 onepoint g16w7 mul add
4621 g16x8 onepoint g16w8 mul add
4622 tmax mul
4623 } def
4624 }
4625 % #] lengthofbezier :
4626 % #[ axogrid :
4627 %
4628 \special{! /axogrid{
4629 gsw translate
4630 /ny ed /nx ed /dy ed /dx ed
4631 /maxx nx dx mul def
4632 /maxy ny dy mul def
4633 0 1 nx {
4634 newpath dx mul dup 0 moveto maxy lineto stroke
4635 } for
4636 0 1 ny {
4637 newpath maxx exch dy mul dup 0 exch moveto lineto stroke
4638 } for
4639 } def }
4640 %
4641 % #] axogrid :
4642 }
4643 % #] PostScript preamble :
4644 % #[ axoparray : Puts an array of 2-dim points
4645 %
4646 % Puts a sequence of points in the notation (x1,y1)(x2,y2)....
4647 % on the Postscript stack. This is for Curve and DashCurve.
4648 %
4649 \let\eind=]
4650 %
4651 \def\axoparray(#1,#2)#3{#1 \axoxo\space add #2 \axoyo\space add \ifx #3\eind\else
4652 \expandafter\axoparray\fi#3}
4653 %
4654 % #] axoparray :
4655 %
4656 \fi
4657 % #] Postscript specific :
4658 % #[ PDF specific :
4659 %
4660 % Here are the routines that are used purely for the PDF output.
4661 % The main concern here is the communication with the axohelp program.
4662 %
4663 \ifcase\axo@pdfoutput\else
4664 %
4665 % #[ getaxohelp :
4666 %
4667 % This is the command that makes the PDF work. Use as in
4668 % getaxohelp{NameOfFunction}{parameters to be passed}
4669 % The format is very precise. If axohelp is not happy there will
4670 % be no output. The most common error is that the parameters are
4671 % not separated by black spaces. Some \space might have to be inserted.
4672 % The reason we do not separate the parameters by comma's is that
4673 % both Postscript and PDF want their objects separated by blanks.
4674 % Also a separation by blanks makes the parameters into separate
4675 % arguments in the call to axohelp. Our colors need blanks....
4676 %
4677 %
4678 \def\getoneline#1#2{%
4679 % Set the command of name #1 to the next line of the file
4680 % for which the input stream number is #2.
4681 \def\tmpfh{#2}%
4682 \ifeof\tmpfh
4683 \else
4684 \read\tmpfh to \tmpline
4685 \fi
4686 \ifeof\tmpfh
4687 \@namedef{#1}{}%
4688 \else
4689 \expandafter \let \csname #1\endcsname = \tmpline
4690 \fi
4691 }
4692 %
4693 \def\getaxohelp#1#2{%
4694 \def\axohelp{}%
4695 \stepcounter{axo@objectIndex}%
4696 \def\axo@currentInput{#1 #2;}%
4697 \immediate\write\axo@spec{[\arabic{axo@objectIndex}]\space \axo@currentInput}%
4698 \ifaxo@axohelpRerun%
4699 \else%
4700 \def\axo@currentInput{{#1 #2;}}%
4701 \getoneline{axo@partOne}\axo@axohelpFile%
4702 \catcode`\ =13%
4703 \getoneline{axo@partTwo}\axo@axohelpFile%
4704 \catcode`\ =10%
4705 \getoneline{axo@partThree}\axo@axohelpFile%
4706 \ifeof\axo@axohelpFile
4707 \rlap{New object; rerun axohelp}%
4708 \global\axo@axohelpReruntrue
4709 \else
4710 \ifthenelse{\equal{\axo@partTwo}{\axo@currentInput}}%
4711 {% Current definition is same as the one processed
4712 % by axohelp, so it is safe to use
4713 \expandafter\def\expandafter\axohelp\axo@partThree%
4714 }%
4715 {%
4716 \rlap{Changed object; rerun axohelp}%
4717 \global\axo@axohelpReruntrue
4718 }%
4719 \fi
4720 \fi%
4721 }
4722 %
4723 % #] getaxohelp :
4724 % #[ Use the axohelp output :
4725 %
4726 % Implement conversion of length unit from pt to bp by scaling
4727 \def\contentspdf{q \axoscale\space 0 0 \axoscale\space 0 0 cm
4728 0.99626401 0 0 0.99626401 0 0 cm
4729 1 0 0 1 \axoxo\space \axoyo\space cm
4730 \axohelp\space
4731 Q}
4732 \def\contentspdfNoOffset{q \axoscale\space 0 0 \axoscale\space 0 0 cm
4733 0.99626401 0 0 0.99626401 0 0 cm
4734 \axohelp\space
4735 Q}
4736 %
4737 % #] Use the axohelp output :
4738 %
4739 \fi
4740 % #] PDF specific :
4741
4742 % Process options now, after all potentially necessary commands have
4743 % been defined. Use starred form, so that the options are processed
4744 % in the order the user writes them. Also set defaults here.
4745 \PSTextScalesLikeGraphicstrue
4746 \canvasScaleObjectScale
4747 \ProcessOptions*